This repository has been archived by the owner on Oct 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
sizuku_op.c
309 lines (263 loc) · 8.44 KB
/
sizuku_op.c
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
/*
* LEAF Visual Novel System For X
* (c) Copyright 1999,2000 Go Watanabe mailto:[email protected]
* All rights reserverd.
*
* ORIGINAL LVNS (c) Copyright 1996-1999 LEAF/AQUAPLUS Inc.
*
* $Id: sizuku_op.c,v 1.45 2001/08/05 10:58:10 go Exp $
*
*/
/*
* 雫 オープニング/タイトル
*/
#include <stdio.h>
#include "sizuku.h"
/* OP 用アニメデータ「涙の雫」 */
static LvnsAnimationData sizuku[] = {
{ LVNS_ANIM_IMAGE, "OP_S00.LFG", 50, 0, 160 },
{ LVNS_ANIM_IMAGE, "OP_S01.LFG", 50, 0, 160 },
{ LVNS_ANIM_IMAGE, "OP_S02.LFG", 50, 0, 160 },
{ LVNS_ANIM_IMAGE, "OP_S03.LFG", 50, 0, 160 },
{ LVNS_ANIM_IMAGE, "OP_S04.LFG", 50, 0, 160 },
{ LVNS_ANIM_IMAGE, "OP_S05.LFG", 50, 0, 160 },
{ LVNS_ANIM_IMAGE, "OP_S06.LFG", 50, 0, 160 },
{ LVNS_ANIM_IMAGE, "OP_S07.LFG", 50, 0, 160 },
{ LVNS_ANIM_IMAGE, "OP_S08.LFG", 50, 0, 160 },
{ LVNS_ANIM_IMAGE, "OP_S09.LFG", 50, 0, 160 },
{ LVNS_ANIM_IMAGE, "OP_S10.LFG", 50, 0, 160 },
{ LVNS_ANIM_IMAGE, "OP_S11.LFG", 50, 0, 160 },
{ LVNS_ANIM_IMAGE, "OP_S12.LFG", 50, 0, 160 },
{ LVNS_ANIM_IMAGE, "OP_S13.LFG", 50, 0, 160 },
{ LVNS_ANIM_IMAGE, "OP_S14.LFG", 50, 0, 160 },
{ LVNS_ANIM_IMAGE, "OP_S15.LFG", 50, 0, 160 },
{ LVNS_ANIM_IMAGE, "OP_S16.LFG", 50, 0, 160 },
{ LVNS_ANIM_NONE, NULL, 0 }
};
/* OP 用アニメデータ「瑠璃子」 */
static LvnsAnimationData ruriko[] = {
{ LVNS_ANIM_IMAGE, "OP_L0.LFG", 50, 0, 0 },
{ LVNS_ANIM_IMAGE, "OP_L1.LFG", 50, 0, 0 },
{ LVNS_ANIM_IMAGE, "OP_L2.LFG", 50, 0, 0 },
{ LVNS_ANIM_IMAGE, "OP_L1.LFG", 50, 0, 0 },
{ LVNS_ANIM_IMAGE, "OP_L0.LFG", 50, 0, 0 },
{ LVNS_ANIM_IMAGE, "OP_L1.LFG", 50, 0, 0 },
{ LVNS_ANIM_IMAGE, "OP_L2.LFG", 50, 0, 0 },
{ LVNS_ANIM_IMAGE, "OP_L1.LFG", 50, 0, 0 },
{ LVNS_ANIM_IMAGE, "OP_L0.LFG", 50, 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, "OP_L8.LFG", 50, 0, 0 },
{ LVNS_ANIM_IMAGE, "OP_L7.LFG", 50, 0, 0 },
{ LVNS_ANIM_IMAGE, "OP_L6.LFG", 50, 0, 0 },
{ LVNS_ANIM_IMAGE, "OP_L7.LFG", 50, 0, 0 },
{ LVNS_ANIM_IMAGE, "OP_L8.LFG", 50, 0, 0 },
{ LVNS_ANIM_IMAGE, "OP_L7.LFG", 50, 0, 0 },
{ LVNS_ANIM_NONE, NULL, 0 }
};
/* ------------------------------------------------------------ */
/** ゲーム初期化用メニュー */
static MenuLine from_first_menu_line[] = {
MENULINE(5, "初めから始める", 1),
MENULINE(6, "続きから始める", 2),
MENULINE(0, NULL, 0),
};
static MenuData from_first_menu = {
from_first_menu_line,
2, 1,
NULL,
};
/* ------------------------------------------------------------ */
/** しおり選択用メニュー */
static MenuLine siori_select_menu_line[] = {
MENULINE(5, "しおり 1", 1),
MENULINE(6, "しおり 2", 2),
MENULINE(7, "しおり 3", 3),
MENULINE(0, NULL, 0),
};
static int
SioriSelectMenuEngine(Lvns *lvns, int select)
{
SizukuState *state = (SizukuState *)lvns->system_state;
state->siori_no = select;
SizukuLoad(lvns);
if (lvns->savepoint.scn) { /* シナリオの先頭か? */
switch (LvnsMenu(lvns, &from_first_menu, True)) {
case -1: /* cancel */
return 0;
case 1:
SizukuScenarioInit(lvns);
case 2:
break;
}
}
LvnsJump(lvns, LVNS_JUMP_RESTART);
return select;
}
static MenuData siori_select_menu = {
siori_select_menu_line,
3, 1,
SioriSelectMenuEngine
};
/* ------------------------------------------------------------ */
/** しおり初期化用メニュー */
static MenuLine siori_init_menu_line[] = {
MENULINE(6, "初期化するしおりを選択して下さい",0),
MENULINE(7, "しおり 1",1),
MENULINE(8, "しおり 2",2),
MENULINE(9, "しおり 3",3),
MENULINE(0, NULL, 0),
};
static int
SioriInitMenuEngine(Lvns *lvns, int select)
{
SizukuState *state = (SizukuState *)lvns->system_state;
state->siori_no = select;
SizukuSioriInit(lvns);
SizukuSave(lvns);
return select;
}
static MenuData siori_init_menu = {
siori_init_menu_line,
3, 1,
SioriInitMenuEngine
};
/* ------------------------------------------------------------ */
/** タイトルメニュー */
static MenuLine title_menu_line[] = {
MENULINE(7, "ゲームを始める",1),
MENULINE(8, "しおりの初期化",2),
#if 0
MENULINE(9, "回想モード",3),
MENULINE(10, "次回予告",4),
#endif
MENULINE(9, "終了する",3),
MENULINE(0, NULL, 0),
};
/*
* タイトルメニューエンジン
*/
static int
TitleMenuEngine(Lvns *lvns, int select)
{
switch (select) {
case 1: /*ゲーム開始 */
LvnsClearLow(lvns, LVNS_EFFECT_FADE_MASK);
return LvnsMenu(lvns, &siori_select_menu, True) > 0 ? 1: 0;
case 2: /* しおり初期化 */
LvnsMenu(lvns, &siori_init_menu, True);
return 0;
case 3: /* 終了 */
LvnsClearLow(lvns, LVNS_EFFECT_FADE_MASK);
LvnsJump(lvns, LVNS_JUMP_END);
}
return select;
}
static MenuData title_menu = {
title_menu_line,
3, 1,
TitleMenuEngine
};
/* ------------------------------------------------------------ */
static int
LoadImage(Lvns *lvns, LvnsScript *scr,
void * param1, void * param2)
{
#ifndef USE_MGL
LvnsLoadImage(lvns, param1, lvns->background);
lvnsimage_copy(lvns->background, lvns->vram);
lvns->setPalette(lvns);
#else
mgImage *image = LvnsLoadImage(lvns, param1, NULL);
if (image) {
lvnsimage_clear(lvns->vram);
mglimage_add(image, lvns->vram, 0, 0);
mglimage_delete(image);
}
#endif
return True;
}
static int
AddImage(Lvns *lvns, LvnsScript *scr,
void * param1, void * param2)
{
LvnsImage *image = LvnsLoadImage(lvns, param1, NULL);
lvnsimage_add2(image, lvns->vram, 0, 0);
lvnsimage_delete(image);
return True;
}
/* 雫 オープニングスクリプト */
static LvnsScriptData opdata[] = {
{ LVNS_SCRIPT_MUSIC, (void *)16 },
{ LVNS_SCRIPT_ANIM, sizuku },
{ LVNS_SCRIPT_CLEAR, (void *)LVNS_EFFECT_NORMAL },
{ LVNS_SCRIPT_FUNC, LoadImage, "OP_V0.LFG" },
{ LVNS_SCRIPT_DISP_VRAM, (void *)LVNS_EFFECT_FADE_PALETTE },
{ LVNS_SCRIPT_WAIT, (void *)2000 },
{ LVNS_SCRIPT_CLEAR, (void *)LVNS_EFFECT_FADE_PALETTE },
{ LVNS_SCRIPT_ANIM, sizuku },
{ LVNS_SCRIPT_CLEAR, (void *)LVNS_EFFECT_NORMAL },
{ LVNS_SCRIPT_FUNC, LoadImage, "OP_V1.LFG" },
{ LVNS_SCRIPT_DISP_VRAM, (void *)LVNS_EFFECT_FADE_PALETTE },
{ LVNS_SCRIPT_WAIT, (void *)2000 },
{ LVNS_SCRIPT_CLEAR, (void *)LVNS_EFFECT_FADE_PALETTE },
{ LVNS_SCRIPT_ANIM, sizuku },
{ LVNS_SCRIPT_CLEAR, (void *)LVNS_EFFECT_NORMAL },
{ LVNS_SCRIPT_ANIM, ruriko },
{ LVNS_SCRIPT_CLICK_JUMP },
{ LVNS_SCRIPT_CLEAR, (void *)LVNS_EFFECT_FADE_PALETTE },
{ LVNS_SCRIPT_FUNC, LoadImage, "TITLE0.LFG"},
{ LVNS_SCRIPT_DISP_VRAM, (void *)LVNS_EFFECT_FADE_PALETTE },
{ LVNS_SCRIPT_WAIT, (void *)1000 },
{ LVNS_SCRIPT_FUNC, AddImage, "TITLE.LFG" },
{ LVNS_SCRIPT_DISP_VRAM, (void *)LVNS_EFFECT_FADE_MASK },
{ LVNS_SCRIPT_WAIT_CLICK },
{ LVNS_SCRIPT_END }
};
/* 雫 オープニング */
void
SizukuOpening(Lvns *lvns)
{
LvnsInitAnimation(lvns, sizuku);
LvnsInitAnimation(lvns, ruriko);
LvnsScriptRun(lvns, opdata);
LvnsMenu(lvns, &title_menu, False);
}
/* ------------------------------------------------------------ */
/* 雫タイトル用スクリプト */
static LvnsScriptData titledata[] = {
{ LVNS_SCRIPT_FUNC, LoadImage, "TITLE0.LFG" },
{ LVNS_SCRIPT_FUNC, AddImage, "TITLE.LFG" },
{ LVNS_SCRIPT_DISP_VRAM, (void *)LVNS_EFFECT_FADE_MASK },
{ LVNS_SCRIPT_WAIT_CLICK },
{ LVNS_SCRIPT_END }
};
void
SizukuTitle(Lvns *lvns)
{
LvnsScriptRun(lvns, titledata);
LvnsMenu(lvns, &title_menu, False);
}