-
Notifications
You must be signed in to change notification settings - Fork 0
/
portale.c
226 lines (200 loc) · 7.04 KB
/
portale.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
// Verlies - ein Adventure/RPG im Retrodesign
//
// Copyright (C) 2018-2022 Heiko Wolf
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License As published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY Or FITNESS For A PARTICULAR PURPOSE. See the
// GNU General Public License For more details.
//
// You should have received a copy of the GNU General Public License along
// With this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// Kontakt: projekte@kabelmail.net
//#pragma bank=8
#include "portale.h"
#include "engine.h"
#include "text.h"
#include "hud.h"
#include "globals.h"
#include "other.h"
#include "locations.h"
#include "player.h"
#include "daten/txt/portale/portalfeensee.h"
#include "daten/txt/portale/portalfelsengrund.h"
#include "daten/txt/portale/portaleichenwald.h"
#include "daten/txt/portale/portalzwergenheim.h"
#include "daten/txt/portale/portal.h"
#include "daten/tilesets/tilesets.h"
#include "daten/txt/locations/locations.h"
#include "daten/lvl/lvldatfelsengrund.h"
#include "daten/lvl/lvldatdorfseefeen.h"
#include "daten/lvl/lvldateichenwald.h"
#include "daten/lvl/lvldatzwergenheim.h"
void p_portal_init (void) __banked
{
for (v_i = 0; v_i != 4; ++v_i) v_portal [v_i] = 0;
v_use_portal = FALSE;
}
void p_portal_setup (void) __banked
{
v_aktion = TRUE;
p_engine_rahmen ();
move_win (7, 96);
v_win = TRUE;
}
void p_portal (UINT8 l_smk) __banked
{
BOOLEAN l_quit;
l_quit = FALSE;
if (l_smk == v_smk)
{
if ((v_portal [0] == 0) && (v_lvl == 2))
{
p_engine_set_txt (portalfelsengrund);
p_engine_A ();
p_engine_after_txt ();
v_portal [0] = 1;
return;
}
else if ((v_portal [1] == 0) && (v_lvl == 91))
{
p_engine_set_txt (portalfeensee);
p_engine_A ();
p_engine_after_txt ();
v_portal [1] = 1;
return;
}
//Portal im Eichenwald aktivieren
else if ((v_portal [2] == 0) && (v_lvl == 138))
{
p_engine_set_txt (portaleichenwald);
p_engine_A ();
p_engine_after_txt ();
v_portal [2] = 1;
return;
}
//Portal im Zwergenheim aktivieren
else if ((v_portal [3] == 0) && (v_lvl == 187))
{
p_engine_set_txt (portalzwergenheim);
p_engine_A ();
p_engine_after_txt ();
v_portal [3] = 1;
return;
}
if (v_use_portal == TRUE) {
p_portal_setup ();
//Felsengrund anzeigen, wenn Portal entdeckt
if (v_portal [0] == 1)
{
set_win_tiles (1, 1, 18, 1, portal1);
}
//Feensee anzeigen, wenn Portal entdeckt
if (v_portal [1] == 1)
{
set_win_tiles (1, 2, 18, 1, portal2);
}
//Hain anzeigen, wenn entdeckt
if (v_portal [2] == 1)
{
set_win_tiles (1, 3, 18, 1, portal3);
if (v_syk >= 104) for (v_i = 0; v_i != 4; ++v_i) { move_sprite (v_i, 0, 0); }
}
//Zwergenheim anzeigen, wenn entdeckt
if (v_portal [3] == 1)
{
set_win_tiles (1, 4, 18, 1, portal4);
}
SHOW_WIN;
while (l_quit == FALSE)
{
if ((joypad () & J_UP) && (v_portal [0] == 1))
{
if (v_lvl == 2)
{
l_quit = TRUE;
}
else
{
p_engine_loadTileset (2, 8, 37, felsengrund_1, BANK_8);
p_engine_loadTileset (2, 38, 81, grundtiles, BANK_8);
p_engine_loadTileset (2, 82, 127, font, BANK_8);
p_engine_loadTileset (BANK_2, 4, 15, felsengrund_2, BANK_8);
p_engine_loadMap (v_lvl1b, BANK_5, BANK_8);
p_engine_changeLvl (2, 48, 32);
p_gui_show_location (lfelsengrund);
v_region = 1;
l_quit = TRUE;
}
}
else if ((joypad () & J_DOWN) && (v_portal [1] == 1))
{
if (v_lvl == 91)
{
l_quit = TRUE;
}
else
{
p_engine_loadTileset (2, 8, 37, felsengrund_1, BANK_8);
p_engine_loadTileset (2, 38, 81, grundtiles, BANK_8);
p_engine_loadTileset (2, 82, 127, font, BANK_8);
p_engine_loadTileset (BANK_2, 4, 33, feensee_1, BANK_8);
p_engine_loadMap (v_lvl91, BANK_6, BANK_8);
p_engine_changeLvl (91, 40, 32);
p_gui_show_location (lseefeendorf);
v_region = 5;
l_quit = TRUE;
}
}
else if ((joypad () & J_LEFT) && (v_portal [2] == 1))
{
if (v_lvl == 138)
{
l_quit = TRUE;
if (v_syk >= 104) p_spieler_set_sprite ();
}
else
{
p_engine_loadTileset (2, 8, 37, felsengrund_1, BANK_8);
p_engine_loadTileset (2, 38, 81, grundtiles, BANK_8);
p_engine_loadTileset (2, 82, 127, font, BANK_8);
p_engine_loadTileset (BANK_2, 4, 38, eichenwald, BANK_8);
p_engine_loadMap (v_lvl138, BANK_18, BANK_8);
p_engine_changeLvl (138, 128, 104);
p_gui_show_location (leichenwald);
v_region = 7;
l_quit = TRUE;
}
}
else if ((joypad () & J_RIGHT) && (v_portal [3] == 1))
{
if (v_lvl == 187)
{
l_quit = TRUE;
if (v_syk >= 104) p_spieler_set_sprite ();
}
else
{
p_engine_loadTileset (2, 8, 37, felsengrund_1, BANK_8);
p_engine_loadTileset (2, 38, 81, grundtiles, BANK_8);
p_engine_loadTileset (2, 82, 127, font, BANK_8);
p_engine_loadTileset (BANK_2, 3, 34, zwergenheim, BANK_8);
p_engine_loadMap (v_lvl187, BANK_18, BANK_8);
p_engine_changeLvl (187, 136, 32);
p_gui_show_location (lzwergenheim);
v_region = 10;
l_quit = TRUE;
}
}
}
p_engine_after_txt ();
}
}
}