-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathloadg.cpp
More file actions
349 lines (310 loc) · 13.4 KB
/
Copy pathloadg.cpp
File metadata and controls
349 lines (310 loc) · 13.4 KB
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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
#include "DxLib.h"
#include "global_vars.h"
#include "main.h"
int x1;
void loadg(void)
{
for (t = 0; t < 51; t++)
{
Main_GFX[t] = 0;
}
for (int i = 0; i < 161; i++)
for (int j = 0; j < 8; j++)
Sliced_GFX[i][j] = NULL;
/*
for (t=0;t<161;t++){
for (tt=0;tt<8;tt++){
Sliced_GFX[t][tt]=0;
}}
*/
// ma-=100;//mb==5000;
// end();
// 画像読み込み
// 透過色を変更
// SetTransColor( 9*16+9 , 255 , 255 ) ;
//+KZ: the first image should have the format that every other image should use
// ブロック (Block)
Main_GFX[1] = LoadGraph("res/brock.png");
// アイテム (item)
Main_GFX[2] = LoadGraph("res/item.png");
// 敵 (enemy)
Main_GFX[3] = LoadGraph("res/teki.png");
// 背景 (background)
Main_GFX[4] = LoadGraph("res/haikei.png");
// ブロック2 (Block 2)
Main_GFX[5] = LoadGraph("res/brock2.png");
// おまけ (Extra)
Main_GFX[6] = LoadGraph("res/omake.png");
// おまけ2 (Extra 2)
Main_GFX[7] = LoadGraph("res/omake2.png");
// タイトル (Title)
Main_GFX[30] = LoadGraph("res/syobon3.png", false);
// プレイヤー (Player)
Main_GFX[0] = LoadGraph("res/player.png");
// Added by +KZ:
Main_GFX_KZ[0] = LoadGraph("res/kz/decoration_kz.png");
Main_GFX_KZ[1] = LoadGraph("res/sa3/title.png", false);
Main_GFX_KZ[2] = LoadGraph("res/sa3/spike.png", false);
Main_GFX_KZ[3] = LoadGraph("res/sa3/big_stone_ball_1.png", false);
Main_GFX_KZ[4] = LoadGraph("res/sa3/big_stone_ball_2.png", false);
Main_GFX_KZ[5] = LoadGraph("res/sa3/big_stone_ball_3.png", false);
Main_GFX_KZ[6] = LoadGraph("res/sa3/big_stone_ball_4.png", false);
Main_GFX_KZ[7] = LoadGraph("res/sa3/big_stone_ball_5.png", false);
Main_GFX_KZ[8] = LoadGraph("res/sa3/big_stone_ball_6.png", false);
Main_GFX_KZ[9] = LoadGraph("res/sa3/jumpscare_plant_1.png", false);
Main_GFX_KZ[10] = LoadGraph("res/sa3/jumpscare_plant_2.png", false);
Main_GFX_KZ[11] = LoadGraph("res/kz/levelicons.png", false);
Sliced_GFX_KZ[0] = DerivationGraph(0, 0, 64, 29, Main_GFX_KZ[0]);
Sliced_GFX_KZ[1] = DerivationGraph(0, 31, 70, 40, Main_GFX_KZ[0]);
Sliced_GFX_KZ[2] = DerivationGraph(0, 0, 19, 19, Main_GFX_KZ[11]);
Sliced_GFX_KZ[3] = DerivationGraph(19, 0, 19, 19, Main_GFX_KZ[11]);
Sliced_GFX_KZ[4] = DerivationGraph(38, 0, 19, 19, Main_GFX_KZ[11]);
Sliced_GFX_KZ[5] = DerivationGraph(32, 35, 30, 30, Main_GFX[2]);
// プレイヤー読み込み (Player loading)
Sliced_GFX[40][0] = DerivationGraph(0, 0, 30, 36, Main_GFX[0]);
Sliced_GFX[0][0] = DerivationGraph(31 * 4, 0, 30, 36, Main_GFX[0]);
Sliced_GFX[1][0] = DerivationGraph(31 * 1, 0, 30, 36, Main_GFX[0]);
Sliced_GFX[2][0] = DerivationGraph(31 * 2, 0, 30, 36, Main_GFX[0]);
Sliced_GFX[3][0] = DerivationGraph(31 * 3, 0, 30, 36, Main_GFX[0]);
Sliced_GFX[41][0] = DerivationGraph(50, 0, 51, 73, Main_GFX[6]);
x1 = 1;
// ブロック読み込み (Block loading)
for (t = 0; t <= 6; t++)
{
Sliced_GFX[t][x1] = DerivationGraph(33 * t, 0, 30, 30, Main_GFX[x1]);
Sliced_GFX[t + 30][x1] = DerivationGraph(33 * t, 33, 30, 30, Main_GFX[x1]);
Sliced_GFX[t + 60][x1] = DerivationGraph(33 * t, 66, 30, 30, Main_GFX[x1]);
Sliced_GFX[t + 90][x1] = DerivationGraph(33 * t, 99, 30, 30, Main_GFX[x1]);
}
Sliced_GFX[8][x1] = DerivationGraph(33 * 7, 0, 30, 30, Main_GFX[x1]);
Sliced_GFX[16][x1] = DerivationGraph(33 * 6, 0, 24, 27, Main_GFX[2]);
Sliced_GFX[10][x1] = DerivationGraph(33 * 9, 0, 30, 30, Main_GFX[x1]);
Sliced_GFX[40][x1] = DerivationGraph(33 * 9, 33, 30, 30, Main_GFX[x1]);
Sliced_GFX[70][x1] = DerivationGraph(33 * 9, 66, 30, 30, Main_GFX[x1]);
Sliced_GFX[100][x1] = DerivationGraph(33 * 9, 99, 30, 30, Main_GFX[x1]);
// ブロック読み込み2 (Block loading 2)
x1 = 5;
for (t = 0; t <= 6; t++)
{
Sliced_GFX[t][x1] = DerivationGraph(33 * t, 0, 30, 30, Main_GFX[x1]);
}
Sliced_GFX[10][5] = DerivationGraph(33 * 1, 33, 30, 30, Main_GFX[x1]);
Sliced_GFX[11][5] = DerivationGraph(33 * 2, 33, 30, 30, Main_GFX[x1]);
Sliced_GFX[12][5] = DerivationGraph(33 * 0, 66, 30, 30, Main_GFX[x1]);
Sliced_GFX[13][5] = DerivationGraph(33 * 1, 66, 30, 30, Main_GFX[x1]);
Sliced_GFX[14][5] = DerivationGraph(33 * 2, 66, 30, 30, Main_GFX[x1]);
// アイテム読み込み (Item loading)
x1 = 2;
for (t = 0; t <= 5; t++)
{
Sliced_GFX[t][x1] = DerivationGraph(33 * t, 0, 30, 30, Main_GFX[x1]);
}
// 敵キャラ読み込み (Loading enemy characters)
x1 = 3;
Sliced_GFX[0][x1] = DerivationGraph(33 * 0, 0, 30, 30, Main_GFX[x1]);
Sliced_GFX[1][x1] = DerivationGraph(33 * 1, 0, 30, 43, Main_GFX[x1]);
Sliced_GFX[2][x1] = DerivationGraph(33 * 2, 0, 30, 30, Main_GFX[x1]);
Sliced_GFX[3][x1] = DerivationGraph(33 * 3, 0, 30, 44, Main_GFX[x1]);
Sliced_GFX[4][x1] = DerivationGraph(33 * 4, 0, 33, 35, Main_GFX[x1]);
Sliced_GFX[5][x1] = DerivationGraph(0, 0, 37, 55, Main_GFX[7]);
Sliced_GFX[6][x1] = DerivationGraph(38 * 2, 0, 36, 50, Main_GFX[7]);
Sliced_GFX[150][x1] = DerivationGraph(38 * 2 + 37 * 2, 0, 36, 50, Main_GFX[7]);
Sliced_GFX[7][x1] = DerivationGraph(33 * 6 + 1, 0, 32, 32, Main_GFX[x1]);
Sliced_GFX[8][x1] = DerivationGraph(38 * 2 + 37 * 3, 0, 37, 47, Main_GFX[7]);
Sliced_GFX[151][x1] = DerivationGraph(38 * 3 + 37 * 3, 0, 37, 47, Main_GFX[7]);
Sliced_GFX[9][x1] = DerivationGraph(33 * 7 + 1, 0, 26, 30, Main_GFX[x1]);
Sliced_GFX[10][x1] = DerivationGraph(214, 0, 46, 16, Main_GFX[6]);
// モララー (Molalla)
Sliced_GFX[30][x1] = DerivationGraph(0, 56, 30, 36, Main_GFX[7]);
Sliced_GFX[155][x1] = DerivationGraph(31 * 3, 56, 30, 36, Main_GFX[7]);
Sliced_GFX[31][x1] = DerivationGraph(50, 74, 49, 79, Main_GFX[6]);
Sliced_GFX[80][x1] = DerivationGraph(151, 31, 70, 40, Main_GFX[4]);
Sliced_GFX[81][x1] = DerivationGraph(151, 72, 70, 40, Main_GFX[4]);
Sliced_GFX[130][x1] = DerivationGraph(151 + 71, 72, 70, 40, Main_GFX[4]);
Sliced_GFX[82][x1] = DerivationGraph(33 * 1, 0, 30, 30, Main_GFX[5]);
Sliced_GFX[83][x1] = DerivationGraph(0, 0, 49, 48, Main_GFX[6]);
Sliced_GFX[84][x1] = DerivationGraph(33 * 5 + 1, 0, 30, 30, Main_GFX[x1]);
Sliced_GFX[86][x1] = DerivationGraph(102, 66, 49, 59, Main_GFX[6]);
Sliced_GFX[152][x1] = DerivationGraph(152, 66, 49, 59, Main_GFX[6]);
Sliced_GFX[90][x1] = DerivationGraph(102, 0, 64, 63, Main_GFX[6]);
Sliced_GFX[100][x1] = DerivationGraph(33 * 1, 0, 30, 30, Main_GFX[2]);
Sliced_GFX[101][x1] = DerivationGraph(33 * 7, 0, 30, 30, Main_GFX[2]);
Sliced_GFX[102][x1] = DerivationGraph(33 * 3, 0, 30, 30, Main_GFX[2]);
// Sliced_GFX[104][x1] = DerivationGraph( 33*2, 0, 30, 30, Main_GFX[5]) ;
Sliced_GFX[105][x1] = DerivationGraph(33 * 5, 0, 30, 30, Main_GFX[2]);
Sliced_GFX[110][x1] = DerivationGraph(33 * 4, 0, 30, 30, Main_GFX[2]);
// 背景読み込み (Background loading)
x1 = 4;
Sliced_GFX[0][x1] = DerivationGraph(0, 0, 150, 90, Main_GFX[x1]);
Sliced_GFX[1][x1] = DerivationGraph(151, 0, 65, 29, Main_GFX[x1]);
Sliced_GFX[2][x1] = DerivationGraph(151, 31, 70, 40, Main_GFX[x1]);
Sliced_GFX[3][x1] = DerivationGraph(0, 91, 100, 90, Main_GFX[x1]);
Sliced_GFX[4][x1] = DerivationGraph(151, 113, 51, 29, Main_GFX[x1]);
Sliced_GFX[5][x1] = DerivationGraph(222, 0, 28, 60, Main_GFX[x1]);
Sliced_GFX[6][x1] = DerivationGraph(151, 143, 90, 40, Main_GFX[x1]);
Sliced_GFX[30][x1] = DerivationGraph(293, 0, 149, 90, Main_GFX[x1]);
//+KZ: Sliced_GFX[31][4] is 3-1 grass?? 3-1 also wants a Sliced_GFX[32][4] sprite, which seems to be a cloud
// sadly there is not a official Syobon Action 2 release containing the missing sprites.
// Sliced_GFX[32][4] was not even in this list, so probably the creator of that mod
// forgot to upload loadg.cpp and the assets in the latest game zip...
// im using alternative edited versions for now
Sliced_GFX[31][x1] = Sliced_GFX_KZ[0]; // DerivationGraph(293, 92, 64, 29, Main_GFX[x1]);
Sliced_GFX[32][x1] = Sliced_GFX_KZ[1];
// 中間フラグ (Intermediate flag)
//+KZ: 42 to fix gray line, previously it was 40
//Original Syobon Action had it in 0, i prefer the version with text
Sliced_GFX[20][x1] = DerivationGraph(42, 182, 40, 60, Main_GFX[x1]);
// グラ
x1 = 5;
Sliced_GFX[0][x1] = DerivationGraph(167, 0, 45, 45, Main_GFX[6]);
// 敵サイズ収得
// int GrHandle=0;
x1 = 3;
for (t = 0; t <= 140; t++)
{
if (Sliced_GFX[t][x1])
{
EnemyDefaultSizeX[t] = Sliced_GFX[t][x1]->w;
EnemyDefaultSizeY[t] = Sliced_GFX[t][x1]->h;
// GetGraphSize(Sliced_GFX[t][x1] ,&anx[t] ,&any[t]);
EnemyDefaultSizeX[t] *= 100;
EnemyDefaultSizeY[t] *= 100;
}
else
{
EnemyDefaultSizeX[t] = 0;
EnemyDefaultSizeY[t] = 0;
}
}
EnemyDefaultSizeX[79] = 120 * 100;
EnemyDefaultSizeY[79] = 15 * 100;
EnemyDefaultSizeX[85] = 25 * 100;
EnemyDefaultSizeY[85] = 30 * 10 * 100;
// 背景サイズ収得 (Background size acquisition)
x1 = 4;
//+KZ: value is set but never used
/*for (t = 0; t < 40; t++)
{
if (Sliced_GFX[t][x1])
{
BackgroundWidth[t] = Sliced_GFX[t][x1]->w;
BackgroundHeight[t] = Sliced_GFX[t][x1]->h;
// GetGraphSize(Sliced_GFX[t][x1] ,&ne[t] ,&nf[t]);
// ne[t]*=100;nf[t]*=100;
}
else
{
BackgroundWidth[t] = 0;
BackgroundHeight[t] = 0;
}
}*/
/*
anx[0]=30;any[0]=30;
anx[1]=30;any[1]=43;
anx[2]=30;any[2]=30;
anx[3]=30;any[3]=44;
*/
// ogg読み込み
// try{
// Sounds[2] = LoadSoundMem( "SE/1.mp3" ) ;
Music[1] = LoadMusicMem("BGM/field.ogg"); // 50
Music[2] = LoadMusicMem("BGM/dungeon.ogg"); // 40
Music[3] = LoadMusicMem("BGM/star4.ogg"); // 50
Music[4] = LoadMusicMem("BGM/castle.ogg"); // 50
Music[5] = LoadMusicMem("BGM/puyo.ogg"); // 50
Music[6] = LoadMusicMem("BGM/field3.mp3"); //+KZ from Syobon Action 2 (English version)
// Music[6]=LoadMusicMem( "BGM/last.ogg");
// ChangeVolumeSoundMem(50, Music[6]);
Sounds[1] = LoadSoundMem("SE/jump.ogg");
// Sounds[2] = LoadSoundMem("SE/brockcoin.ogg");
Sounds[3] = LoadSoundMem("SE/brockbreak.ogg");
Sounds[4] = LoadSoundMem("SE/coin.ogg");
Sounds[5] = LoadSoundMem("SE/humi.ogg");
Sounds[6] = LoadSoundMem("SE/koura.ogg");
Sounds[7] = LoadSoundMem("SE/dokan.ogg");
Sounds[8] = LoadSoundMem("SE/brockkinoko.ogg");
Sounds[9] = LoadSoundMem("SE/powerup.ogg");
Sounds[10] = LoadSoundMem("SE/kirra.ogg");
Sounds[11] = LoadSoundMem("SE/goal.ogg");
Sounds[12] = LoadSoundMem("SE/death.ogg");
Sounds[13] = LoadSoundMem("SE/Pswitch.ogg");
Sounds[14] = LoadSoundMem("SE/jumpBlock.ogg");
Sounds[15] = LoadSoundMem("SE/hintBlock.ogg");
Sounds[16] = LoadSoundMem("SE/4-clear.ogg");
Sounds[17] = LoadSoundMem("SE/allclear.ogg");
Sounds[18] = LoadSoundMem("SE/tekifire.ogg");
//+KZ
Sounds_KZ[0] = LoadSoundMem("SE/sa3/so_piranhaeat.wav");
Sounds_KZ[1] = LoadSoundMem("SE/sa3/so_1up.wav");
//}catch( int num){end();}
// ループ設定-20000-20秒
// SetLoopPosSoundMem( 1,Sounds[104]) ;
// SetLoopSamplePosSoundMem(44100,Sounds[104]);
// SetLoopSamplePosSoundMem(22050,Sounds[104]);
}
extern bool sound;
void parseArgs(int argc, char *argv[])
{
if (argc <= 1)
return;
for (int i = 0; i < argc; i++)
{
//+KZ: why only 1 dash? added a 2 dashes version, keep old for back-compat
if (
!strcasecmp(argv[i], "-nosound") ||
!memcmp(argv[i], "--nosound", sizeof("--nosound"))
)
{
sound = false;
}
//+KZ: --help
//also yeah im just using printf
if(
!memcmp(argv[i], "--help", sizeof("--help")) ||
!memcmp(argv[i], "-h", sizeof("-h"))
)
{
printf("SyobonKZ -- Syobon Action +KZ Edition\n");
printf("\n");
printf("Usage: SyobonAction [--option]\n");
printf("\n");
printf("Options:\n");
printf(" -h, --help Shows this screen\n");
printf(" -nosound, --nosound Muted game\n");
printf(" --fullscreen Start in full screen\n");
printf(" --trap-display Show trap triggers (for testing)\n");
printf(" --fast-death Skip death animation\n");
printf("\n");
printf(" --dev-sa3 Enable SA3 (unfinished)\n");
HelpFlagHandled = true;
}
//Fullscreen
if(
!memcmp(argv[i], "--fullscreen", sizeof("--fullscreen"))
)
{
StartFullScreenFlag = true;
}
//TrapDisplay
if(
!memcmp(argv[i], "--trap-display", sizeof("--trap-display"))
)
{
TrapDisplay = true;
}
//fast death
if(
!memcmp(argv[i], "--fast-death", sizeof("--fast-death"))
)
{
fast = true;
}
//SA3 (for now)
if(
!memcmp(argv[i], "--dev-sa3", sizeof("--dev-sa3"))
)
{
SA3Enabled = true;
}
}
}