blob: 46cdb5b6580ec31c3ade3a88e45afc1ad9f597ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
|
#ifndef GAME_H
#define GAME_H
#include "PHL.h"
#include "enemy.h"
#include "enemies/slime.h"
#include "enemies/bat.h"
#include "enemies/slug.h"
#include "enemies/knight.h"
#include "enemies/heads.h"
#include "enemies/gas.h"
#include "enemies/skull.h"
#include "enemies/fish.h"
#include "enemies/waterjumper.h"
#include "enemies/podoboo.h"
#include "enemies/thwomp.h"
#include "enemies/dodo.h"
#include "enemies/batboss.h"
#include "enemies/crab.h"
#include "enemies/skeleton.h"
#include "enemies/ghoul.h"
#include "enemies/seal.h"
#include "enemies/jellyfish.h"
#include "enemies/wizard.h"
#include "enemies/pendulum.h"
#include "enemies/gyra.h"
#include "enemies/lolidra.h"
#include "enemies/bee.h"
#include "enemies/devil.h"
#include "enemies/firewheel.h"
#include "enemies/boar.h"
#include "enemies/golem.h"
#include "enemies/garm.h"
#include "enemies/poisonknight.h"
#include "enemies/dog.h"
#include "enemies/boomknight.h"
#include "enemies/pumpkin.h"
#include "enemies/hydra.h"
#include "object.h"
#include "effect.h"
#include "weapon.h"
#include "platform.h"
#define TITLE 0
#define GAME 1
#define INVENTORY 2
#define OPTIONS 3
#define SAVING 4
#define LEVELSTART 5
#define GETITEM 6
//Sound channels
#define CHN_MUSIC 0
#define CHN_SOUND 1 //Various sounds, like menus and fanfares
#define CHN_HERO 2
#define CHN_WEAPONS 3
#define CHN_ENEMIES 4
#define CHN_EFFECTS 5
Door* lastDoor;
int secretTimer;
int levelStartTimer;
int saveTimer;
int quakeTimer;
int bellFlag;
int bossFlag;
int bossDefeatedFlag;
char roomDarkness;
//Used for item get message
int itemGotX;
int itemGotY;
int roomSecret;
int collisionTiles[16][12];
//Playtime in frames. At 60 frames per second can hold ~828 1/2 days worth of playtime if my math isn't shit
unsigned long playTime;
//Inventory
unsigned char hasWeapon[5];
unsigned char hasItem[28];
unsigned char hasKey[8];
//Save data flags
unsigned char flags[60];
PHL_Background background,
foreground;
//Game assets
PHL_Surface images[15];
PHL_Music bgmMusic;
PHL_Music bgmSecret;
PHL_Music bgmGameover;
PHL_Sound sounds[43];
#define MAX_WEAPONS 5
Weapon* weapons[MAX_WEAPONS];
#define MAX_OBJECTS 40
Object* objects[MAX_OBJECTS];
#define MAX_ENEMIES 20
Enemy* enemies[MAX_ENEMIES];
#define MAX_EFFECTS 30
Effect* effects[MAX_EFFECTS];
#define MAX_PLATFORMS 10
Platform* platforms[MAX_PLATFORMS];
//Graphic names
#define imgTiles 0
#define imgEnemies 1
#define imgHud 2
#define imgMisc20 3
#define imgMisc32 4
#define imgHero 5
#define imgItems 6
#define imgExplosion 7
#define imgBoss 8
#define imgMisc2040 9
#define imgFontKana 10
#define imgBoldFont 11
#define imgDark 12
#define imgMisc6020 13
#define imgTitle01 14
//Sound names
#define sndBee01 0
#define sndBell01 1
#define sndBom01 2
#define sndBom02 3
#define sndBom03 4
#define sndDoor00 5
#define sndFire01 6
#define sndGas01 7
#define sndGet01 8
#define sndGet02 9
#define sndHit01 10
#define sndHit02 11
#define sndHit03 12
#define sndHit04 13
#define sndHit05 14
#define sndHit06 15
#define sndHit07 16
#define sndJump01 17
#define sndJump02 18
#define sndNg 19
#define sndOk 20
#define sndPi01 21
#define sndPi02 22
#define sndPi03 23
#define sndPi04 24
#define sndPi05 25
#define sndPi06 26
#define sndPi07 27
#define sndPi08 28
#define sndPi09 29
#define sndPi10 30
#define sndPower01 31
#define sndPower02 32
#define sndShot01 33
#define sndShot02 34
#define sndShot03 35
#define sndShot04 36
#define sndShot05 37
#define sndShot06 38
#define sndShot07 39
#define sndStep01 40
#define sndWater01 41
#define sndWolf01 42
#ifdef _SDL
extern char savename[4096];
extern char savemap[4096];
#else
#define savename "data/save.tmp"
#define savemap "map/018.map"
#endif
void loadResources();
void freeResources();
void game();
void gameSetup();
void gameCleanup();
void enterDoor();
void getItem(int itemNum);
void saveScreen();
void gameEnding();
//void enterDoor(Door* d);
void loadScreen();
void changeScreen(int dx, int dy);
int writeSave(char* fname);
void loadSave(char* fname);
int fileExists(char* fpath);
void playSecret();
void secretCountdown();
int getDrawHP();
void setDrawHP(int val);
int getLevel();
void setBossRoom();
void setAutoSave(char val);
char getAutoSave();
#endif
|