Debian Codegraph @

pacman.c

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 /*------------------------------------------------------------------------------
2 pacman.c
3
4 A Pacman clone written in C99 using the sokol headers for platform
5 abstraction.
6
7 The git repository is here:
8
9 https://github.com/floooh/pacman.c
10
11 A WASM version running in browsers can be found here:
12
13 https://floooh.github.io/pacman.c/pacman.html
14
15 Some basic concepts and ideas are worth explaining upfront:
16
17 The game code structure is a bit "radical" and sometimes goes against
18 what is considered good practice for medium and large code bases. This is
19 fine because this is a small game written by a single person. Small
20 code bases written by small teams allow a different organizational
21 approach than large code bases written by large teams.
22
23 Here are some of those "extremist" methods used in this tiny project:
24
25 Instead of artificially splitting the code into many small source files,
26 everything is in a single source file readable from top to bottom.
27
28 Instead of data-encapsulation and -hiding, all data lives in a single,
29 global, nested data structure (this isn't actually as radical and
30 experimental as it sounds, I've been using this approach for quite a
31 while now for all my hobby code). An interesting side effect of this
32 upfront-defined static memory layout is that there are no dynamic
33 allocations in the entire game code (only a handful allocations during
34 initialization of the Sokol headers).
35
36 Instead of "wasting" time thinking too much about high-level abstractions
37 and reusability, the code has been written in a fairly adhoc-manner "from
38 start to finish", solving problems as they showed up in the most direct
39 way possible. When parts of the code became too entangled I tried to step
40 back a bit, take a pause and come back later with a better idea how to
41 rewrite those parts in a more straightforward manner. Of course
42 "straightforward" and "readability" are in the eye of the beholder.
43
44 The actual gameplay code (Pacman and ghost behaviours) has been
45 implemented after the "Pacman Dossier" by Jamey Pittman (a PDF copy has
46 been included in the project), but there are some minor differences to a
47 Pacman arcade machine emulator, some intended, some not
48 (https://floooh.github.io/tiny8bit/pacman.html):
49
50 - The attract mode animation in the intro screen is missing (where
51 Pacman is chased by ghosts, eats a pill and then hunts the ghost).
52 - Likewise, the 'interlude' animation between levels is missing.
53 - Various difficulty-related differences in later maps are ignored
54 (such a faster movement speed, smaller dot-counter-limits for ghosts etc)
55
56 The rendering and audio code resembles the original Pacman arcade machine
57 hardware:
58
59 - the tile and sprite pixel data, hardware color palette data and
60 sound wavetable data is taken directly from embedded arcade machine
61 ROM dumps
62 - background tiles are rendered from two 28x36 byte buffers (one for
63 tile-codes, the other for color-codes), this is similar to an actual
64 arcade machine, with the only difference that the tile- and color-buffer
65 has a straightforward linear memory layout
66 - background tile rendering is done with dynamically uploaded vertex
67 data (two triangles per tile), with color-palette decoding done in
68 the pixel shader
69 - up to 8 16x16 sprites are rendered as vertex quads, with the same
70 color palette decoding happening in the pixel shader as for background
71 tiles.
72 - audio output works through an actual Namco WSG emulator which generates
73 sound samples for 3 hardware voices from a 20-bit frequency counter,
74 4-bit volume and 3-bit wave type (for 8 wavetables made of 32 sample
75 values each stored in a ROM dump)
76 - sound effects are implemented by writing new values to the hardware
77 voice 'registers' once per 60Hz tick, this can happen in two ways:
78 - as 'procedural' sound effects, where a callback function computes
79 the new voice register values
80 - or via 'register dump' playback, where the voice register values
81 have been captured at 60Hz frequency from an actual Pacman arcade
82 emulator
83 Only two sound effects are register dumps: the little music track at
84 the start of a game, and the sound effect when Pacman dies. All other
85 effects are simple procedural effects.
86
87 The only concept worth explaining in the gameplay code is how timing
88 and 'asynchronous actions' work:
89
90 The entire gameplay logic is driven by a global 60 Hz game tick which is
91 counting upward.
92
93 Gameplay actions are initiated by a combination of 'time triggers' and a simple
94 vocabulary to initialize and test trigger conditions. This time trigger system
95 is an extremely simple replacement for more powerful event systems in
96 'proper' game engines.
97
98 Here are some pseudo-code examples how time triggers can be used (unrelated
99 to Pacman):
100
101 To immediately trigger an action in one place of the code, and 'realize'
102 this action in one or several other places:
103
104 // if a monster has been eaten, trigger the 'monster eaten' action:
105 if (monster_eaten()) {
106 start(&state.game.monster_eaten);
107 }
108
109 // ...somewhere else, we might increase the score if a monster has been eaten:
110 if (now(state.game.monster_eaten)) {
111 state.game.score += 10;
112 }
113
114 // ...and yet somewhere else in the code, we might want to play a sound effect
115 if (now(state.game.monster_eaten)) {
116 // play sound effect...
117 }
118
119 We can also start actions in the future, which allows to batch multiple
120 followup-actions in one place:
121
122 // start fading out now, after one second (60 ticks) start a new
123 // game round, and fade in, after another second when fadein has
124 // finished, start the actual game loop
125 start(&state.gfx.fadeout);
126 start_after(&state.game.started, 60);
127 start_after(&state.gfx.fadein, 60);
128 start_after(&state.game.gameloop_started, 2*60);
129
130 As mentioned above, there's a whole little function vocabulary built around
131 time triggers, but those are hopefully all self-explanatory.
132 */
133 #include "sokol_app.h"cxx . . $ `<file>/sokol/sokol_app.h`/
134 #include "sokol_gfx.h"cxx . . $ `<file>/sokol/sokol_gfx.h`/
135 #include "sokol_audio.h"cxx . . $ `<file>/sokol/sokol_audio.h`/
136 #include "sokol_log.h"cxx . . $ `<file>/sokol/sokol_log.h`/
137 #include "sokol_glue.h"cxx . . $ `<file>/sokol/sokol_glue.h`/
138 #include <assert.h>
139 #include <string.h> // memset()
140 #include <stdlib.h> // abs()
141
142 // config defines and global constants
143 #define AUDIO_VOLUMEcxx . . $ `pacman.c:143:9`! (0.5f)
144 #define DBG_SKIP_INTROcxx . . $ `pacman.c:144:9`! (0) // set to (1) to skip intro
145 #define DBG_SKIP_PRELUDEcxx . . $ `pacman.c:145:9`! (0) // set to (1) to skip game prelude
146 #define DBG_START_ROUNDcxx . . $ `pacman.c:146:9`! (0) // set to any starting round <=255
147 #define DBG_MARKERScxx . . $ `pacman.c:147:9`! (0) // set to (1) to show debug markers
148 #define DBG_ESCAPEcxx . . $ `pacman.c:148:9`! (0) // set to (1) to leave game loop with Esc
149 #define DBG_DOUBLE_SPEEDcxx . . $ `pacman.c:149:9`! (0) // set to (1) to speed up game (useful with godmode)
150 #define DBG_GODMODEcxx . . $ `pacman.c:150:9`! (0) // set to (1) to disable dying
151
152 // NOTE: DO NOT CHANGE THESE DEFINES TO AN ENUM
153 // gcc-13 will turn the backing type into an unsigned integer which then
154 // causes all sorts of trouble further down
155
156 // tick duration in nanoseconds
157 #if DBG_DOUBLE_SPEEDcxx . . $ `pacman.c:149:9`!
158 #define TICK_DURATION_NS (8333333)
159 #else
160 #define TICK_DURATION_NScxx . . $ `pacman.c:160:13`! (16666666)
161 #endif
162 #define TICK_TOLERANCE_NScxx . . $ `pacman.c:162:9`! (1000000) // per-frame tolerance in nanoseconds
163 #define NUM_VOICEScxx . . $ `pacman.c:163:9`! (3) // number of sound voices
164 #define NUM_SOUNDScxx . . $ `pacman.c:164:9`! (3) // max number of sounds effects that can be active at a time
165 #define NUM_SAMPLEScxx . . $ `pacman.c:165:9`! (128) // max number of audio samples in local sample buffer
166 #define DISABLED_TICKScxx . . $ `pacman.c:166:9`! (0xFFFFFFFF) // magic tick value for a disabled timer
167 #define TILE_WIDTHcxx . . $ `pacman.c:167:9`! (8) // width and height of a background tile in pixels
168 #define TILE_HEIGHTcxx . . $ `pacman.c:168:9`! (8)
169 #define SPRITE_WIDTHcxx . . $ `pacman.c:169:9`! (16) // width and height of a sprite in pixels
170 #define SPRITE_HEIGHTcxx . . $ `pacman.c:170:9`! (16)
171 #define DISPLAY_TILES_Xcxx . . $ `pacman.c:171:9`! (28) // tile buffer width and height
172 #define DISPLAY_TILES_Ycxx . . $ `pacman.c:172:9`! (36)
173 #define DISPLAY_PIXELS_Xcxx . . $ `pacman.c:173:9`! (DISPLAY_TILES_Xcxx . . $ `pacman.c:171:9`! * TILE_WIDTHcxx . . $ `pacman.c:167:9`!)
174 #define DISPLAY_PIXELS_Ycxx . . $ `pacman.c:174:9`! (DISPLAY_TILES_Ycxx . . $ `pacman.c:172:9`! * TILE_HEIGHTcxx . . $ `pacman.c:168:9`!)
175 #define NUM_SPRITEScxx . . $ `pacman.c:175:9`! (8)
176 #define NUM_DEBUG_MARKERScxx . . $ `pacman.c:176:9`! (16)
177 #define TILE_TEXTURE_WIDTHcxx . . $ `pacman.c:177:9`! (256 * TILE_WIDTHcxx . . $ `pacman.c:167:9`!)
178 #define TILE_TEXTURE_HEIGHTcxx . . $ `pacman.c:178:9`! (TILE_HEIGHTcxx . . $ `pacman.c:168:9`! + SPRITE_HEIGHTcxx . . $ `pacman.c:170:9`!)
179 #define MAX_VERTICEScxx . . $ `pacman.c:179:9`! (((DISPLAY_TILES_Xcxx . . $ `pacman.c:171:9`! * DISPLAY_TILES_Ycxx . . $ `pacman.c:172:9`!) + NUM_SPRITEScxx . . $ `pacman.c:175:9`! + NUM_DEBUG_MARKERScxx . . $ `pacman.c:176:9`!) * 6)
180 #define FADE_TICKScxx . . $ `pacman.c:180:9`! (30) // duration of fade-in/out
181 #define NUM_LIVEScxx . . $ `pacman.c:181:9`! (3)
182 #define NUM_STATUS_FRUITScxx . . $ `pacman.c:182:9`! (7) // max number of displayed fruits at bottom right
183 #define NUM_DOTScxx . . $ `pacman.c:183:9`! (244) // 240 small dots + 4 pills
184 #define NUM_PILLScxx . . $ `pacman.c:184:9`! (4) // number of energizer pills on playfield
185 #define ANTEPORTAS_Xcxx . . $ `pacman.c:185:9`! (14*TILE_WIDTHcxx . . $ `pacman.c:167:9`!) // pixel position of the ghost house enter/leave point
186 #define ANTEPORTAS_Ycxx . . $ `pacman.c:186:9`! (14*TILE_HEIGHTcxx . . $ `pacman.c:168:9`! + TILE_HEIGHTcxx . . $ `pacman.c:168:9`!/2)
187 #define GHOST_EATEN_FREEZE_TICKScxx . . $ `pacman.c:187:9`! (60) // number of ticks the game freezes after Pacman eats a ghost
188 #define PACMAN_EATEN_TICKScxx . . $ `pacman.c:188:9`! (60) // number of ticks to freeze game when Pacman is eaten
189 #define PACMAN_DEATH_TICKScxx . . $ `pacman.c:189:9`! (150) // number of ticks to show the Pacman death sequence before starting new round
190 #define GAMEOVER_TICKScxx . . $ `pacman.c:190:9`! (3*60) // number of ticks the game over message is shown
191 #define ROUNDWON_TICKScxx . . $ `pacman.c:191:9`! (4*60) // number of ticks to wait after a round was won
192 #define FRUITACTIVE_TICKScxx . . $ `pacman.c:192:9`! (10*60) // number of ticks a bonus fruit is shown
193
194 /* common tile, sprite and color codes, these are the same as on the Pacman
195 arcade machine and extracted by looking at memory locations of a Pacman emulator
196 */
197 enumcxx . . $ $anonymous_type_5882ab293b255284_0# {
198 TILE_SPACEcxx . . $ TILE_SPACE. = 0x40,
199 TILE_DOTcxx . . $ TILE_DOT. = 0x10,
200 TILE_PILLcxx . . $ TILE_PILL. = 0x14,
201 TILE_GHOSTcxx . . $ TILE_GHOST. = 0xB0,
202 TILE_LIFEcxx . . $ TILE_LIFE. = 0x20, // 0x20..0x23
203 TILE_CHERRIEScxx . . $ TILE_CHERRIES. = 0x90, // 0x90..0x93
204 TILE_STRAWBERRYcxx . . $ TILE_STRAWBERRY. = 0x94, // 0x94..0x97
205 TILE_PEACHcxx . . $ TILE_PEACH. = 0x98, // 0x98..0x9B
206 TILE_BELLcxx . . $ TILE_BELL. = 0x9C, // 0x9C..0x9F
207 TILE_APPLEcxx . . $ TILE_APPLE. = 0xA0, // 0xA0..0xA3
208 TILE_GRAPEScxx . . $ TILE_GRAPES. = 0xA4, // 0xA4..0xA7
209 TILE_GALAXIANcxx . . $ TILE_GALAXIAN. = 0xA8, // 0xA8..0xAB
210 TILE_KEYcxx . . $ TILE_KEY. = 0xAC, // 0xAC..0xAF
211 TILE_DOORcxx . . $ TILE_DOOR. = 0xCF, // the ghost-house door
212
213 SPRITETILE_INVISIBLEcxx . . $ SPRITETILE_INVISIBLE. = 30,
214 SPRITETILE_SCORE_200cxx . . $ SPRITETILE_SCORE_200. = 40,
215 SPRITETILE_SCORE_400cxx . . $ SPRITETILE_SCORE_400. = 41,
216 SPRITETILE_SCORE_800cxx . . $ SPRITETILE_SCORE_800. = 42,
217 SPRITETILE_SCORE_1600cxx . . $ SPRITETILE_SCORE_1600. = 43,
218 SPRITETILE_CHERRIEScxx . . $ SPRITETILE_CHERRIES. = 0,
219 SPRITETILE_STRAWBERRYcxx . . $ SPRITETILE_STRAWBERRY. = 1,
220 SPRITETILE_PEACHcxx . . $ SPRITETILE_PEACH. = 2,
221 SPRITETILE_BELLcxx . . $ SPRITETILE_BELL. = 3,
222 SPRITETILE_APPLEcxx . . $ SPRITETILE_APPLE. = 4,
223 SPRITETILE_GRAPEScxx . . $ SPRITETILE_GRAPES. = 5,
224 SPRITETILE_GALAXIANcxx . . $ SPRITETILE_GALAXIAN. = 6,
225 SPRITETILE_KEYcxx . . $ SPRITETILE_KEY. = 7,
226 SPRITETILE_PACMAN_CLOSED_MOUTHcxx . . $ SPRITETILE_PACMAN_CLOSED_MOUTH. = 48,
227
228 COLOR_BLANKcxx . . $ COLOR_BLANK. = 0x00,
229 COLOR_DEFAULTcxx . . $ COLOR_DEFAULT. = 0x0F,
230 COLOR_DOTcxx . . $ COLOR_DOT. = 0x10,
231 COLOR_PACMANcxx . . $ COLOR_PACMAN. = 0x09,
232 COLOR_BLINKYcxx . . $ COLOR_BLINKY. = 0x01,
233 COLOR_PINKYcxx . . $ COLOR_PINKY. = 0x03,
234 COLOR_INKYcxx . . $ COLOR_INKY. = 0x05,
235 COLOR_CLYDEcxx . . $ COLOR_CLYDE. = 0x07,
236 COLOR_FRIGHTENEDcxx . . $ COLOR_FRIGHTENED. = 0x11,
237 COLOR_FRIGHTENED_BLINKINGcxx . . $ COLOR_FRIGHTENED_BLINKING. = 0x12,
238 COLOR_GHOST_SCOREcxx . . $ COLOR_GHOST_SCORE. = 0x18,
239 COLOR_EYEScxx . . $ COLOR_EYES. = 0x19,
240 COLOR_CHERRIEScxx . . $ COLOR_CHERRIES. = 0x14,
241 COLOR_STRAWBERRYcxx . . $ COLOR_STRAWBERRY. = 0x0F,
242 COLOR_PEACHcxx . . $ COLOR_PEACH. = 0x15,
243 COLOR_BELLcxx . . $ COLOR_BELL. = 0x16,
244 COLOR_APPLEcxx . . $ COLOR_APPLE. = 0x14,
245 COLOR_GRAPEScxx . . $ COLOR_GRAPES. = 0x17,
246 COLOR_GALAXIANcxx . . $ COLOR_GALAXIAN. = 0x09,
247 COLOR_KEYcxx . . $ COLOR_KEY. = 0x16,
248 COLOR_WHITE_BORDERcxx . . $ COLOR_WHITE_BORDER. = 0x1F,
249 COLOR_FRUIT_SCOREcxx . . $ COLOR_FRUIT_SCORE. = 0x03,
250 };
251
252 // the top-level game states (intro => game => intro)
253 typedef enumcxx . . $ $anonymous_type_5882ab293b255284_1# {
254 GAMESTATE_INTROcxx . . $ GAMESTATE_INTRO.,
255 GAMESTATE_GAMEcxx . . $ GAMESTATE_GAME.,
256 } gamestate_tcxx . . $ gamestate_t#;
257
258 // directions NOTE: bit0==0: horizontal movement, bit0==1: vertical movement
259 typedef enumcxx . . $ $anonymous_type_5882ab293b255284_2# {
260 DIR_RIGHTcxx . . $ DIR_RIGHT., // 000
261 DIR_DOWNcxx . . $ DIR_DOWN., // 001
262 DIR_LEFTcxx . . $ DIR_LEFT., // 010
263 DIR_UPcxx . . $ DIR_UP., // 011
264 NUM_DIRScxx . . $ NUM_DIRS.
265 } dir_tcxx . . $ dir_t#;
266
267 // bonus fruit types
268 typedef enumcxx . . $ $anonymous_type_5882ab293b255284_3# {
269 FRUIT_NONEcxx . . $ FRUIT_NONE.,
270 FRUIT_CHERRIEScxx . . $ FRUIT_CHERRIES.,
271 FRUIT_STRAWBERRYcxx . . $ FRUIT_STRAWBERRY.,
272 FRUIT_PEACHcxx . . $ FRUIT_PEACH.,
273 FRUIT_APPLEcxx . . $ FRUIT_APPLE.,
274 FRUIT_GRAPEScxx . . $ FRUIT_GRAPES.,
275 FRUIT_GALAXIANcxx . . $ FRUIT_GALAXIAN.,
276 FRUIT_BELLcxx . . $ FRUIT_BELL.,
277 FRUIT_KEYcxx . . $ FRUIT_KEY.,
278 NUM_FRUITScxx . . $ NUM_FRUITS.
279 } fruit_tcxx . . $ fruit_t#;
280
281 // sprite 'hardware' indices
282 typedef enumcxx . . $ $anonymous_type_5882ab293b255284_4# {
283 SPRITE_PACMANcxx . . $ SPRITE_PACMAN.,
284 SPRITE_BLINKYcxx . . $ SPRITE_BLINKY.,
285 SPRITE_PINKYcxx . . $ SPRITE_PINKY.,
286 SPRITE_INKYcxx . . $ SPRITE_INKY.,
287 SPRITE_CLYDEcxx . . $ SPRITE_CLYDE.,
288 SPRITE_FRUITcxx . . $ SPRITE_FRUIT.,
289 } sprite_index_tcxx . . $ sprite_index_t#;
290
291 // ghost types
292 typedef enumcxx . . $ $anonymous_type_5882ab293b255284_5# {
293 GHOSTTYPE_BLINKYcxx . . $ GHOSTTYPE_BLINKY.,
294 GHOSTTYPE_PINKYcxx . . $ GHOSTTYPE_PINKY.,
295 GHOSTTYPE_INKYcxx . . $ GHOSTTYPE_INKY.,
296 GHOSTTYPE_CLYDEcxx . . $ GHOSTTYPE_CLYDE.,
297 NUM_GHOSTScxx . . $ NUM_GHOSTS.
298 } ghosttype_tcxx . . $ ghosttype_t#;
299
300 // ghost AI states
301 typedef enumcxx . . $ $anonymous_type_5882ab293b255284_6# {
302 GHOSTSTATE_NONEcxx . . $ GHOSTSTATE_NONE.,
303 GHOSTSTATE_CHASEcxx . . $ GHOSTSTATE_CHASE., // currently chasing Pacman
304 GHOSTSTATE_SCATTERcxx . . $ GHOSTSTATE_SCATTER., // currently heading to the corner scatter targets
305 GHOSTSTATE_FRIGHTENEDcxx . . $ GHOSTSTATE_FRIGHTENED., // frightened after Pacman has eaten an energizer pill
306 GHOSTSTATE_EYEScxx . . $ GHOSTSTATE_EYES., // eaten by Pacman and heading back to the ghost house
307 GHOSTSTATE_HOUSEcxx . . $ GHOSTSTATE_HOUSE., // currently inside the ghost house
308 GHOSTSTATE_LEAVEHOUSEcxx . . $ GHOSTSTATE_LEAVEHOUSE., // currently leaving the ghost house
309 GHOSTSTATE_ENTERHOUSEcxx . . $ GHOSTSTATE_ENTERHOUSE. // currently entering the ghost house
310 } ghoststate_tcxx . . $ ghoststate_t#;
311
312 // reasons why game loop is frozen
313 typedef enumcxx . . $ $anonymous_type_5882ab293b255284_7# {
314 FREEZETYPE_PRELUDEcxx . . $ FREEZETYPE_PRELUDE. = (1<<0), // game prelude is active (with the game start tune playing)
315 FREEZETYPE_READYcxx . . $ FREEZETYPE_READY. = (1<<1), // READY! phase is active (at start of a new game round)
316 FREEZETYPE_EAT_GHOSTcxx . . $ FREEZETYPE_EAT_GHOST. = (1<<2), // Pacman has eaten a ghost
317 FREEZETYPE_DEADcxx . . $ FREEZETYPE_DEAD. = (1<<3), // Pacman was eaten by a ghost
318 FREEZETYPE_WONcxx . . $ FREEZETYPE_WON. = (1<<4), // game round was won by eating all dots
319 } freezetype_tcxx . . $ freezetype_t#;
320
321 // a trigger holds a specific game-tick when an action should be started
322 typedef structcxx . . $ $anonymous_type_5882ab293b255284_8# {
323 uint32_tcxx . . $ uint32_t# tickcxx . . $ $anonymous_type_5882ab293b255284_8#tick.;
324 } trigger_tcxx . . $ trigger_t#;
325
326 // a 2D integer vector (used both for pixel- and tile-coordinates)
327 typedef structcxx . . $ $anonymous_type_5882ab293b255284_9# {
328 int16_tcxx . . $ int16_t# xcxx . . $ $anonymous_type_5882ab293b255284_9#x.;
329 int16_tcxx . . $ int16_t# ycxx . . $ $anonymous_type_5882ab293b255284_9#y.;
330 } int2_tcxx . . $ int2_t#;
331
332 // common state for pacman and ghosts
333 typedef structcxx . . $ $anonymous_type_5882ab293b255284_10# {
334 dir_tcxx . . $ dir_t# dircxx . . $ $anonymous_type_5882ab293b255284_10#dir.; // current movement direction
335 int2_tcxx . . $ int2_t# poscxx . . $ $anonymous_type_5882ab293b255284_10#pos.; // position of sprite center in pixel coords
336 uint32_tcxx . . $ uint32_t# anim_tickcxx . . $ $anonymous_type_5882ab293b255284_10#anim_tick.; // incremented when actor moved in current tick
337 } actor_tcxx . . $ actor_t#;
338
339 // ghost AI state
340 typedef structcxx . . $ $anonymous_type_5882ab293b255284_11# {
341 actor_tcxx . . $ actor_t# actorcxx . . $ $anonymous_type_5882ab293b255284_11#actor.;
342 ghosttype_tcxx . . $ ghosttype_t# typecxx . . $ $anonymous_type_5882ab293b255284_11#type.;
343 dir_tcxx . . $ dir_t# next_dircxx . . $ $anonymous_type_5882ab293b255284_11#next_dir.; // ghost AI looks ahead one tile when deciding movement direction
344 int2_tcxx . . $ int2_t# target_poscxx . . $ $anonymous_type_5882ab293b255284_11#target_pos.; // current target position in tile coordinates
345 ghoststate_tcxx . . $ ghoststate_t# statecxx . . $ $anonymous_type_5882ab293b255284_11#state.;
346 trigger_tcxx . . $ trigger_t# frightenedcxx . . $ $anonymous_type_5882ab293b255284_11#frightened.; // game tick when frightened mode was entered
347 trigger_tcxx . . $ trigger_t# eatencxx . . $ $anonymous_type_5882ab293b255284_11#eaten.; // game tick when eaten by Pacman
348 uint16_tcxx . . $ uint16_t# dot_countercxx . . $ $anonymous_type_5882ab293b255284_11#dot_counter.; // used to decide when to leave the ghost house
349 uint16_tcxx . . $ uint16_t# dot_limitcxx . . $ $anonymous_type_5882ab293b255284_11#dot_limit.;
350 } ghost_tcxx . . $ ghost_t#;
351
352 // pacman state
353 typedef structcxx . . $ $anonymous_type_5882ab293b255284_12# {
354 actor_tcxx . . $ actor_t# actorcxx . . $ $anonymous_type_5882ab293b255284_12#actor.;
355 } pacman_tcxx . . $ pacman_t#;
356
357 // the tile- and sprite-renderer's vertex structure
358 typedef structcxx . . $ $anonymous_type_5882ab293b255284_13# {
359 float xcxx . . $ $anonymous_type_5882ab293b255284_13#x., ycxx . . $ $anonymous_type_5882ab293b255284_13#y.; // screen coords [0..1]
360 float ucxx . . $ $anonymous_type_5882ab293b255284_13#u., vcxx . . $ $anonymous_type_5882ab293b255284_13#v.; // tile texture coords
361 uint32_tcxx . . $ uint32_t# attrcxx . . $ $anonymous_type_5882ab293b255284_13#attr.; // x: color code, y: opacity (opacity only used for fade effect)
362 } vertex_tcxx . . $ vertex_t#;
363
364 // sprite state
365 typedef structcxx . . $ $anonymous_type_5882ab293b255284_14# {
366 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! enabledcxx . . $ $anonymous_type_5882ab293b255284_14#enabled.; // if false sprite is deactivated
367 uint8_tcxx . . $ uint8_t# tilecxx . . $ $anonymous_type_5882ab293b255284_14#tile., colorcxx . . $ $anonymous_type_5882ab293b255284_14#color.; // sprite-tile number (0..63), color code
368 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! flipxcxx . . $ $anonymous_type_5882ab293b255284_14#flipx., flipycxx . . $ $anonymous_type_5882ab293b255284_14#flipy.; // horizontal/vertical flip
369 int2_tcxx . . $ int2_t# poscxx . . $ $anonymous_type_5882ab293b255284_14#pos.; // pixel position of the sprite's top-left corner
370 } sprite_tcxx . . $ sprite_t#;
371
372 // debug visualization markers (see DBG_MARKERS)
373 typedef structcxx . . $ $anonymous_type_5882ab293b255284_15# {
374 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! enabledcxx . . $ $anonymous_type_5882ab293b255284_15#enabled.;
375 uint8_tcxx . . $ uint8_t# tilecxx . . $ $anonymous_type_5882ab293b255284_15#tile., colorcxx . . $ $anonymous_type_5882ab293b255284_15#color.; // tile and color code
376 int2_tcxx . . $ int2_t# tile_poscxx . . $ $anonymous_type_5882ab293b255284_15#tile_pos.;
377 } debugmarker_tcxx . . $ debugmarker_t#;
378
379 // callback function prototype for procedural sounds
380 typedef void (*sound_func_tcxx . . $ sound_func_t#)(int sound_slot);
381
382 // a sound effect description used as param for snd_start()
383 typedef structcxx . . $ $anonymous_type_5882ab293b255284_16# {
384 sound_func_tcxx . . $ sound_func_t# funccxx . . $ $anonymous_type_5882ab293b255284_16#func.; // callback function (if procedural sound)
385 const uint32_tcxx . . $ uint32_t#* ptrcxx . . $ $anonymous_type_5882ab293b255284_16#ptr.; // pointer to register dump data (if a register-dump sound)
386 uint32_tcxx . . $ uint32_t# sizecxx . . $ $anonymous_type_5882ab293b255284_16#size.; // byte size of register dump data
387 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! voicecxx . . $ $anonymous_type_5882ab293b255284_16#voice.[3]; // true to activate voice
388 } sound_desc_tcxx . . $ sound_desc_t#;
389
390 // a sound 'hardware' voice
391 typedef structcxx . . $ $anonymous_type_5882ab293b255284_17# {
392 uint32_tcxx . . $ uint32_t# countercxx . . $ $anonymous_type_5882ab293b255284_17#counter.; // 20-bit counter, top 5 bits are index into wavetable ROM
393 uint32_tcxx . . $ uint32_t# frequencycxx . . $ $anonymous_type_5882ab293b255284_17#frequency.; // 20-bit frequency (added to counter at 96kHz)
394 uint8_tcxx . . $ uint8_t# waveformcxx . . $ $anonymous_type_5882ab293b255284_17#waveform.; // 3-bit waveform index
395 uint8_tcxx . . $ uint8_t# volumecxx . . $ $anonymous_type_5882ab293b255284_17#volume.; // 4-bit volume
396 float sample_acccxx . . $ $anonymous_type_5882ab293b255284_17#sample_acc.; // current float sample accumulator
397 float sample_divcxx . . $ $anonymous_type_5882ab293b255284_17#sample_div.; // current float sample divisor
398 } voice_tcxx . . $ voice_t#;
399
400 // flags for sound_t.flags
401 typedef enumcxx . . $ $anonymous_type_5882ab293b255284_18# {
402 SOUNDFLAG_VOICE0cxx . . $ SOUNDFLAG_VOICE0. = (1<<0),
403 SOUNDFLAG_VOICE1cxx . . $ SOUNDFLAG_VOICE1. = (1<<1),
404 SOUNDFLAG_VOICE2cxx . . $ SOUNDFLAG_VOICE2. = (1<<2),
405 SOUNDFLAG_ALL_VOICEScxx . . $ SOUNDFLAG_ALL_VOICES. = (1<<0)|(1<<1)|(1<<2)
406 } soundflag_tcxx . . $ soundflag_t#;
407
408 // a currently playing sound effect
409 typedef structcxx . . $ $anonymous_type_5882ab293b255284_19# {
410 uint32_tcxx . . $ uint32_t# cur_tickcxx . . $ $anonymous_type_5882ab293b255284_19#cur_tick.; // current tick counter
411 sound_func_tcxx . . $ sound_func_t# funccxx . . $ $anonymous_type_5882ab293b255284_19#func.; // optional function pointer for prodecural sounds
412 uint32_tcxx . . $ uint32_t# num_tickscxx . . $ $anonymous_type_5882ab293b255284_19#num_ticks.; // length of register dump sound effect in 60Hz ticks
413 uint32_tcxx . . $ uint32_t# stridecxx . . $ $anonymous_type_5882ab293b255284_19#stride.; // number of uint32_t values per tick (only for register dump effects)
414 const uint32_tcxx . . $ uint32_t#* datacxx . . $ $anonymous_type_5882ab293b255284_19#data.; // 3 * num_ticks register dump values
415 uint8_tcxx . . $ uint8_t# flagscxx . . $ $anonymous_type_5882ab293b255284_19#flags.; // combination of soundflag_t (active voices)
416 } sound_tcxx . . $ sound_t#;
417
418 // all state is in a single nested struct
419 static structcxx . . $ $anonymous_type_5882ab293b255284_20# {
420
421 gamestate_tcxx . . $ gamestate_t# gamestatecxx . . $ $anonymous_type_5882ab293b255284_20#gamestate.; // the current gamestate (intro => game => intro)
422
423 structcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_21# {
424 uint32_tcxx . . $ uint32_t# tickcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_21#tick.; // the central game tick, this drives the whole game
425 uint64_tcxx . . $ uint64_t# laptime_storecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_21#laptime_store.; // helper variable to measure frame duration
426 int32_tcxx . . $ int32_t# tick_accumcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_21#tick_accum.; // helper variable to decouple ticks from frame rate
427 } timingcxx . . $ $anonymous_type_5882ab293b255284_20#timing.;
428
429 // intro state
430 structcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_22# {
431 trigger_tcxx . . $ trigger_t# startedcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_22#started.; // tick when intro-state was started
432 } introcxx . . $ $anonymous_type_5882ab293b255284_20#intro.;
433
434 // game state
435 structcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23# {
436 uint32_tcxx . . $ uint32_t# xorshiftcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#xorshift.; // current xorshift random-number-generator state
437 uint32_tcxx . . $ uint32_t# hiscorecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#hiscore.; // hiscore / 10
438 trigger_tcxx . . $ trigger_t# startedcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#started.;
439 trigger_tcxx . . $ trigger_t# ready_startedcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#ready_started.;
440 trigger_tcxx . . $ trigger_t# round_startedcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#round_started.;
441 trigger_tcxx . . $ trigger_t# round_woncxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#round_won.;
442 trigger_tcxx . . $ trigger_t# game_overcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#game_over.;
443 trigger_tcxx . . $ trigger_t# dot_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#dot_eaten.; // last time Pacman ate a dot
444 trigger_tcxx . . $ trigger_t# pill_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#pill_eaten.; // last time Pacman ate a pill
445 trigger_tcxx . . $ trigger_t# ghost_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#ghost_eaten.; // last time Pacman ate a ghost
446 trigger_tcxx . . $ trigger_t# pacman_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#pacman_eaten.; // last time Pacman was eaten by a ghost
447 trigger_tcxx . . $ trigger_t# fruit_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#fruit_eaten.; // last time Pacman has eaten the bonus fruit
448 trigger_tcxx . . $ trigger_t# force_leave_housecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#force_leave_house.; // starts when a dot is eaten
449 trigger_tcxx . . $ trigger_t# fruit_activecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#fruit_active.; // starts when bonus fruit is shown
450 uint8_tcxx . . $ uint8_t# freezecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#freeze.; // combination of FREEZETYPE_* flags
451 uint8_tcxx . . $ uint8_t# roundcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#round.; // current game round, 0, 1, 2...
452 uint32_tcxx . . $ uint32_t# scorecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#score.; // score / 10
453 int8_tcxx . . $ int8_t# num_livescxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#num_lives.;
454 uint8_tcxx . . $ uint8_t# num_ghosts_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#num_ghosts_eaten.; // number of ghosts easten with current pill
455 uint8_tcxx . . $ uint8_t# num_dots_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#num_dots_eaten.; // if == NUM_DOTS, Pacman wins the round
456 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! global_dot_counter_activecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#global_dot_counter_active.; // set to true when Pacman loses a life
457 uint8_tcxx . . $ uint8_t# global_dot_countercxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#global_dot_counter.; // the global dot counter for the ghost-house-logic
458 ghost_tcxx . . $ ghost_t# ghostcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#ghost.[NUM_GHOSTScxx . . $ NUM_GHOSTS.];
459 pacman_tcxx . . $ pacman_t# pacmancxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#pacman.;
460 fruit_tcxx . . $ fruit_t# active_fruitcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#active_fruit.;
461 } gamecxx . . $ $anonymous_type_5882ab293b255284_20#game.;
462
463 // the current input state
464 structcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_24# {
465 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! enabledcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_24#enabled.;
466 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! upcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_24#up.;
467 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! downcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_24#down.;
468 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! leftcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_24#left.;
469 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! rightcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_24#right.;
470 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! esccxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_24#esc.; // only for debugging (see DBG_ESCACPE)
471 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! anykeycxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_24#anykey.;
472 } inputcxx . . $ $anonymous_type_5882ab293b255284_20#input.;
473
474 // the audio subsystem is essentially a Namco arcade board sound emulator
475 structcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25# {
476 voice_tcxx . . $ voice_t# voicecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#voice.[NUM_VOICEScxx . . $ `pacman.c:163:9`!];
477 sound_tcxx . . $ sound_t# soundcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#sound.[NUM_SOUNDScxx . . $ `pacman.c:164:9`!];
478 int32_tcxx . . $ int32_t# voice_tick_accumcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#voice_tick_accum.;
479 int32_tcxx . . $ int32_t# voice_tick_periodcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#voice_tick_period.;
480 int32_tcxx . . $ int32_t# sample_duration_nscxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#sample_duration_ns.;
481 int32_tcxx . . $ int32_t# sample_accumcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#sample_accum.;
482 uint32_tcxx . . $ uint32_t# num_samplescxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#num_samples.;
483 float sample_buffercxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#sample_buffer.[NUM_SAMPLEScxx . . $ `pacman.c:165:9`!];
484 } audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio.;
485
486 // the gfx subsystem implements a simple tile+sprite renderer
487 structcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26# {
488 // fade-in/out timers and current value
489 trigger_tcxx . . $ trigger_t# fadeincxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#fadein.;
490 trigger_tcxx . . $ trigger_t# fadeoutcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#fadeout.;
491 uint8_tcxx . . $ uint8_t# fadecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#fade.;
492
493 // the 36x28 tile framebuffer
494 uint8_tcxx . . $ uint8_t# video_ramcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#video_ram.[DISPLAY_TILES_Ycxx . . $ `pacman.c:172:9`!][DISPLAY_TILES_Xcxx . . $ `pacman.c:171:9`!]; // tile codes
495 uint8_tcxx . . $ uint8_t# color_ramcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#color_ram.[DISPLAY_TILES_Ycxx . . $ `pacman.c:172:9`!][DISPLAY_TILES_Xcxx . . $ `pacman.c:171:9`!]; // color codes
496
497 // up to 8 sprites
498 sprite_tcxx . . $ sprite_t# spritecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#sprite.[NUM_SPRITEScxx . . $ `pacman.c:175:9`!];
499
500 // up to 16 debug markers
501 debugmarker_tcxx . . $ debugmarker_t# debug_markercxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#debug_marker.[NUM_DEBUG_MARKERScxx . . $ `pacman.c:176:9`!];
502
503 // sokol-gfx resources
504 sg_pass_actioncxx . . $ sg_pass_action# pass_actioncxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#pass_action.;
505 structcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_27# {
506 sg_buffercxx . . $ sg_buffer# vbufcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_27#vbuf.;
507 sg_imagecxx . . $ sg_image# tile_imgcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_27#tile_img.;
508 sg_imagecxx . . $ sg_image# palette_imgcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_27#palette_img.;
509 sg_imagecxx . . $ sg_image# render_targetcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_27#render_target.;
510 sg_samplercxx . . $ sg_sampler# samplercxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_27#sampler.;
511 sg_pipelinecxx . . $ sg_pipeline# pipcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_27#pip.;
512 sg_attachmentscxx . . $ sg_attachments# attachmentscxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_27#attachments.;
513 } offscreencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#offscreen.;
514 structcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_28# {
515 sg_buffercxx . . $ sg_buffer# quad_vbufcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_28#quad_vbuf.;
516 sg_pipelinecxx . . $ sg_pipeline# pipcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_28#pip.;
517 sg_samplercxx . . $ sg_sampler# samplercxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_28#sampler.;
518 } displaycxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#display.;
519
520 // intermediate vertex buffer for tile- and sprite-rendering
521 int num_verticescxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#num_vertices.;
522 vertex_tcxx . . $ vertex_t# verticescxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#vertices.[MAX_VERTICEScxx . . $ `pacman.c:179:9`!];
523
524 // scratch-buffer for tile-decoding (only happens once)
525 uint8_tcxx . . $ uint8_t# tile_pixelscxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#tile_pixels.[TILE_TEXTURE_HEIGHTcxx . . $ `pacman.c:178:9`!][TILE_TEXTURE_WIDTHcxx . . $ `pacman.c:177:9`!];
526
527 // scratch buffer for the color palette
528 uint32_tcxx . . $ uint32_t# color_palettecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#color_palette.[256];
529 } gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx.;
530 } statecxx . . $ state.;
531
532 // scatter target positions (in tile coords)
533 static const int2_tcxx . . $ int2_t# ghost_scatter_targetscxx . . $ ghost_scatter_targets.[NUM_GHOSTScxx . . $ NUM_GHOSTS.] = {
534 { 25, 0 }, { 2, 0 }, { 27, 34 }, { 0, 34 }
535 };
536
537 // starting positions for ghosts (pixel coords)
538 static const int2_tcxx . . $ int2_t# ghost_starting_poscxx . . $ ghost_starting_pos.[NUM_GHOSTScxx . . $ NUM_GHOSTS.] = {
539 { 14*8, 14*8 + 4 },
540 { 14*8, 17*8 + 4 },
541 { 12*8, 17*8 + 4 },
542 { 16*8, 17*8 + 4 },
543 };
544
545 // target positions for ghost entering the ghost house (pixel coords)
546 static const int2_tcxx . . $ int2_t# ghost_house_target_poscxx . . $ ghost_house_target_pos.[NUM_GHOSTScxx . . $ NUM_GHOSTS.] = {
547 { 14*8, 17*8 + 4 },
548 { 14*8, 17*8 + 4 },
549 { 12*8, 17*8 + 4 },
550 { 16*8, 17*8 + 4 },
551 };
552
553 // fruit tiles, sprite tiles and colors
554 static const uint8_tcxx . . $ uint8_t# fruit_tiles_colorscxx . . $ fruit_tiles_colors.[NUM_FRUITScxx . . $ NUM_FRUITS.][3] = {
555 { 0, 0, 0 }, // FRUIT_NONE
556 { TILE_CHERRIEScxx . . $ TILE_CHERRIES., SPRITETILE_CHERRIEScxx . . $ SPRITETILE_CHERRIES., COLOR_CHERRIEScxx . . $ COLOR_CHERRIES. },
557 { TILE_STRAWBERRYcxx . . $ TILE_STRAWBERRY., SPRITETILE_STRAWBERRYcxx . . $ SPRITETILE_STRAWBERRY., COLOR_STRAWBERRYcxx . . $ COLOR_STRAWBERRY. },
558 { TILE_PEACHcxx . . $ TILE_PEACH., SPRITETILE_PEACHcxx . . $ SPRITETILE_PEACH., COLOR_PEACHcxx . . $ COLOR_PEACH. },
559 { TILE_APPLEcxx . . $ TILE_APPLE., SPRITETILE_APPLEcxx . . $ SPRITETILE_APPLE., COLOR_APPLEcxx . . $ COLOR_APPLE. },
560 { TILE_GRAPEScxx . . $ TILE_GRAPES., SPRITETILE_GRAPEScxx . . $ SPRITETILE_GRAPES., COLOR_GRAPEScxx . . $ COLOR_GRAPES. },
561 { TILE_GALAXIANcxx . . $ TILE_GALAXIAN., SPRITETILE_GALAXIANcxx . . $ SPRITETILE_GALAXIAN., COLOR_GALAXIANcxx . . $ COLOR_GALAXIAN. },
562 { TILE_BELLcxx . . $ TILE_BELL., SPRITETILE_BELLcxx . . $ SPRITETILE_BELL., COLOR_BELLcxx . . $ COLOR_BELL. },
563 { TILE_KEYcxx . . $ TILE_KEY., SPRITETILE_KEYcxx . . $ SPRITETILE_KEY., COLOR_KEYcxx . . $ COLOR_KEY. }
564 };
565
566 // the tiles for displaying the bonus-fruit-score, this is a number built from 4 tiles
567 static const uint8_tcxx . . $ uint8_t# fruit_score_tilescxx . . $ fruit_score_tiles.[NUM_FRUITScxx . . $ NUM_FRUITS.][4] = {
568 { 0x40, 0x40, 0x40, 0x40 }, // FRUIT_NONE
569 { 0x40, 0x81, 0x85, 0x40 }, // FRUIT_CHERRIES: 100
570 { 0x40, 0x82, 0x85, 0x40 }, // FRUIT_STRAWBERRY: 300
571 { 0x40, 0x83, 0x85, 0x40 }, // FRUIT_PEACH: 500
572 { 0x40, 0x84, 0x85, 0x40 }, // FRUIT_APPLE: 700
573 { 0x40, 0x86, 0x8D, 0x8E }, // FRUIT_GRAPES: 1000
574 { 0x87, 0x88, 0x8D, 0x8E }, // FRUIT_GALAXIAN: 2000
575 { 0x89, 0x8A, 0x8D, 0x8E }, // FRUIT_BELL: 3000
576 { 0x8B, 0x8C, 0x8D, 0x8E }, // FRUIT_KEY: 5000
577 };
578
579 // level specifications (see pacman_dossier.pdf)
580 typedef structcxx . . $ $anonymous_type_5882ab293b255284_29# {
581 fruit_tcxx . . $ fruit_t# bonus_fruitcxx . . $ $anonymous_type_5882ab293b255284_29#bonus_fruit.;
582 uint16_tcxx . . $ uint16_t# bonus_scorecxx . . $ $anonymous_type_5882ab293b255284_29#bonus_score.;
583 uint16_tcxx . . $ uint16_t# fright_tickscxx . . $ $anonymous_type_5882ab293b255284_29#fright_ticks.;
584 // FIXME: the various Pacman and ghost speeds
585 } levelspec_tcxx . . $ levelspec_t#;
586
587 enumcxx . . $ $anonymous_type_5882ab293b255284_30# {
588 MAX_LEVELSPECcxx . . $ MAX_LEVELSPEC. = 21,
589 };
590 static const levelspec_tcxx . . $ levelspec_t# levelspec_tablecxx . . $ levelspec_table.[MAX_LEVELSPECcxx . . $ MAX_LEVELSPEC.] = {
591 { FRUIT_CHERRIEScxx . . $ FRUIT_CHERRIES., 10, 6*60, },
592 { FRUIT_STRAWBERRYcxx . . $ FRUIT_STRAWBERRY., 30, 5*60, },
593 { FRUIT_PEACHcxx . . $ FRUIT_PEACH., 50, 4*60, },
594 { FRUIT_PEACHcxx . . $ FRUIT_PEACH., 50, 3*60, },
595 { FRUIT_APPLEcxx . . $ FRUIT_APPLE., 70, 2*60, },
596 { FRUIT_APPLEcxx . . $ FRUIT_APPLE., 70, 5*60, },
597 { FRUIT_GRAPEScxx . . $ FRUIT_GRAPES., 100, 2*60, },
598 { FRUIT_GRAPEScxx . . $ FRUIT_GRAPES., 100, 2*60, },
599 { FRUIT_GALAXIANcxx . . $ FRUIT_GALAXIAN., 200, 1*60, },
600 { FRUIT_GALAXIANcxx . . $ FRUIT_GALAXIAN., 200, 5*60, },
601 { FRUIT_BELLcxx . . $ FRUIT_BELL., 300, 2*60, },
602 { FRUIT_BELLcxx . . $ FRUIT_BELL., 300, 1*60, },
603 { FRUIT_KEYcxx . . $ FRUIT_KEY., 500, 1*60, },
604 { FRUIT_KEYcxx . . $ FRUIT_KEY., 500, 3*60, },
605 { FRUIT_KEYcxx . . $ FRUIT_KEY., 500, 1*60, },
606 { FRUIT_KEYcxx . . $ FRUIT_KEY., 500, 1*60, },
607 { FRUIT_KEYcxx . . $ FRUIT_KEY., 500, 1, },
608 { FRUIT_KEYcxx . . $ FRUIT_KEY., 500, 1*60, },
609 { FRUIT_KEYcxx . . $ FRUIT_KEY., 500, 1, },
610 { FRUIT_KEYcxx . . $ FRUIT_KEY., 500, 1, },
611 { FRUIT_KEYcxx . . $ FRUIT_KEY., 500, 1, },
612 // from here on repeating
613 };
614
615 // forward-declared sound-effect register dumps (recorded from Pacman arcade emulator)
616 static const uint32_tcxx . . $ uint32_t# snd_dump_preludecxx . . $ snd_dump_prelude.[490];
617 static const uint32_tcxx . . $ uint32_t# snd_dump_deadcxx . . $ snd_dump_dead.[90];
618
619 // procedural sound effect callbacks
620 static void snd_func_eatdot1cxx . . $ snd_func_eatdot1(d4f767463ce0a6b3).(int slot);
621 static void snd_func_eatdot2cxx . . $ snd_func_eatdot2(d4f767463ce0a6b3).(int slot);
622 static void snd_func_eatghostcxx . . $ snd_func_eatghost(d4f767463ce0a6b3).(int slot);
623 static void snd_func_eatfruitcxx . . $ snd_func_eatfruit(d4f767463ce0a6b3).(int slot);
624 static void snd_func_weeoohcxx . . $ snd_func_weeooh(d4f767463ce0a6b3).(int slot);
625 static void snd_func_frightenedcxx . . $ snd_func_frightened(d4f767463ce0a6b3).(int slot);
626
627 // sound effect description structs
628 static const sound_desc_tcxx . . $ sound_desc_t# snd_preludecxx . . $ snd_prelude. = {
629 .ptr = snd_dump_preludecxx . . $ snd_dump_prelude.,
630 .size = sizeof(snd_dump_preludecxx . . $ snd_dump_prelude.),
631 .voice = { truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`! }
632 };
633
634 static const sound_desc_tcxx . . $ sound_desc_t# snd_deadcxx . . $ snd_dead. = {
635 .ptr = snd_dump_deadcxx . . $ snd_dump_dead.,
636 .size = sizeof(snd_dump_deadcxx . . $ snd_dump_dead.),
637 .voice = { falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`! }
638 };
639
640 static const sound_desc_tcxx . . $ sound_desc_t# snd_eatdot1cxx . . $ snd_eatdot1. = {
641 .func = snd_func_eatdot1cxx . . $ snd_func_eatdot1(d4f767463ce0a6b3).,
642 .voice = { falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`! }
643 };
644
645 static const sound_desc_tcxx . . $ sound_desc_t# snd_eatdot2cxx . . $ snd_eatdot2. = {
646 .func = snd_func_eatdot2cxx . . $ snd_func_eatdot2(d4f767463ce0a6b3).,
647 .voice = { falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`! }
648 };
649
650 static const sound_desc_tcxx . . $ sound_desc_t# snd_eatghostcxx . . $ snd_eatghost. = {
651 .func = snd_func_eatghostcxx . . $ snd_func_eatghost(d4f767463ce0a6b3).,
652 .voice = { falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`! }
653 };
654
655 static const sound_desc_tcxx . . $ sound_desc_t# snd_eatfruitcxx . . $ snd_eatfruit. = {
656 .func = snd_func_eatfruitcxx . . $ snd_func_eatfruit(d4f767463ce0a6b3).,
657 .voice = { falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`! }
658 };
659
660 static const sound_desc_tcxx . . $ sound_desc_t# snd_weeoohcxx . . $ snd_weeooh. = {
661 .func = snd_func_weeoohcxx . . $ snd_func_weeooh(d4f767463ce0a6b3).,
662 .voice = { falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`! }
663 };
664
665 static const sound_desc_tcxx . . $ sound_desc_t# snd_frightenedcxx . . $ snd_frightened. = {
666 .func = snd_func_frightenedcxx . . $ snd_func_frightened(d4f767463ce0a6b3).,
667 .voice = { falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`! }
668 };
669
670 // forward declarations
671 static void initcxx . . $ init(49f6e7a06ebc5aa8).(void);
672 static void framecxx . . $ frame(49f6e7a06ebc5aa8).(void);
673 static void cleanupcxx . . $ cleanup(49f6e7a06ebc5aa8).(void);
674 static void inputcxx . . $ input(241e5018601f13a4).(const sapp_eventcxx . . $ sapp_event#*);
675
676 static void startcxx . . $ start(cb52e61069a1301a).(trigger_tcxx . . $ trigger_t#* t);
677 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! nowcxx . . $ now(e8d67d8f61cbb831).(trigger_tcxx . . $ trigger_t# t);
678
679 static void intro_tickcxx . . $ intro_tick(49f6e7a06ebc5aa8).(void);
680 static void game_tickcxx . . $ game_tick(49f6e7a06ebc5aa8).(void);
681
682 static void input_enablecxx . . $ input_enable(49f6e7a06ebc5aa8).(void);
683 static void input_disablecxx . . $ input_disable(49f6e7a06ebc5aa8).(void);
684
685 static void gfx_initcxx . . $ gfx_init(49f6e7a06ebc5aa8).(void);
686 static void gfx_shutdowncxx . . $ gfx_shutdown(49f6e7a06ebc5aa8).(void);
687 static void gfx_fadecxx . . $ gfx_fade(49f6e7a06ebc5aa8).(void);
688 static void gfx_drawcxx . . $ gfx_draw(49f6e7a06ebc5aa8).(void);
689
690 static void snd_initcxx . . $ snd_init(49f6e7a06ebc5aa8).(void);
691 static void snd_shutdowncxx . . $ snd_shutdown(49f6e7a06ebc5aa8).(void);
692 static void snd_tickcxx . . $ snd_tick(49f6e7a06ebc5aa8).(void); // called per game tick
693 static void snd_framecxx . . $ snd_frame(d4f767463ce0a6b3).(int32_tcxx . . $ int32_t# frame_time_ns); // called per frame
694 static void snd_clearcxx . . $ snd_clear(49f6e7a06ebc5aa8).(void);
695 static void snd_startcxx . . $ snd_start(eb66bf3bee49480).(int sound_slot, const sound_desc_tcxx . . $ sound_desc_t#* snd);
696 static void snd_stopcxx . . $ snd_stop(d4f767463ce0a6b3).(int sound_slot);
697
698 // forward-declared ROM dumps
699 static const uint8_tcxx . . $ uint8_t# rom_tilescxx . . $ rom_tiles.[4096];
700 static const uint8_tcxx . . $ uint8_t# rom_spritescxx . . $ rom_sprites.[4096];
701 static const uint8_tcxx . . $ uint8_t# rom_hwcolorscxx . . $ rom_hwcolors.[32];
702 static const uint8_tcxx . . $ uint8_t# rom_palettecxx . . $ rom_palette.[256];
703 static const uint8_tcxx . . $ uint8_t# rom_wavetablecxx . . $ rom_wavetable.[256];
704
705 /*== APPLICATION ENTRY AND CALLBACKS =========================================*/
706 sapp_desccxx . . $ sapp_desc# sokol_maincxx . . $ sokol_main(de724fcec28caf22).(int argc, char* argv[]) {
707 (void)argc; (void)argv;
708 return (sapp_desccxx . . $ sapp_desc#) {
709 .init_cb = initcxx . . $ init(49f6e7a06ebc5aa8).,
710 .frame_cb = framecxx . . $ frame(49f6e7a06ebc5aa8).,
711 .cleanup_cb = cleanupcxx . . $ cleanup(49f6e7a06ebc5aa8).,
712 .event_cb = inputcxx . . $ input(241e5018601f13a4).,
713 .width = DISPLAY_TILES_Xcxx . . $ `pacman.c:171:9`! * TILE_WIDTHcxx . . $ `pacman.c:167:9`! * 2,
714 .height = DISPLAY_TILES_Ycxx . . $ `pacman.c:172:9`! * TILE_HEIGHTcxx . . $ `pacman.c:168:9`! * 2,
715 .window_title = "pacman.c",
716 .logger.func = slog_funccxx . . $ slog_func(8f8bcdb52caccc4c).,
717 };
718 }
719
720 static void initcxx . . $ init(49f6e7a06ebc5aa8).(void) {
721 gfx_initcxx . . $ gfx_init(49f6e7a06ebc5aa8).();
722 snd_initcxx . . $ snd_init(49f6e7a06ebc5aa8).();
723
724 // start into intro screen
725 #if DBG_SKIP_INTROcxx . . $ `pacman.c:144:9`!
726 start(&state.game.started);
727 #else
728 startcxx . . $ start(cb52e61069a1301a).(&statecxx . . $ state..introcxx . . $ $anonymous_type_5882ab293b255284_20#intro..startedcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_22#started.);
729 #endif
730 }
731
732 static void framecxx . . $ frame(49f6e7a06ebc5aa8).(void) {
733
734 // run the game at a fixed tick rate regardless of frame rate
735 uint32_tcxx . . $ uint32_t# frame_time_ns = (uint32_tcxx . . $ uint32_t#) (sapp_frame_durationcxx . . $ sapp_frame_duration(31fa7155c10fdd13).() * 1000000000.0);
736 // clamp max frame time (so the timing isn't messed up when stopping in the debugger)
737 if (frame_time_ns > 33333333) {
738 frame_time_ns = 33333333;
739 }
740 statecxx . . $ state..timingcxx . . $ $anonymous_type_5882ab293b255284_20#timing..tick_accumcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_21#tick_accum. += frame_time_ns;
741 while (statecxx . . $ state..timingcxx . . $ $anonymous_type_5882ab293b255284_20#timing..tick_accumcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_21#tick_accum. > -TICK_TOLERANCE_NScxx . . $ `pacman.c:162:9`!) {
742 statecxx . . $ state..timingcxx . . $ $anonymous_type_5882ab293b255284_20#timing..tick_accumcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_21#tick_accum. -= TICK_DURATION_NScxx . . $ `pacman.c:160:13`!;
743 statecxx . . $ state..timingcxx . . $ $anonymous_type_5882ab293b255284_20#timing..tickcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_21#tick.++;
744
745 // call per-tick sound function (updates sound 'registers' with current sound effect values)
746 snd_tickcxx . . $ snd_tick(49f6e7a06ebc5aa8).();
747
748 // check for game state change
749 if (nowcxx . . $ now(e8d67d8f61cbb831).(statecxx . . $ state..introcxx . . $ $anonymous_type_5882ab293b255284_20#intro..startedcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_22#started.)) {
750 statecxx . . $ state..gamestatecxx . . $ $anonymous_type_5882ab293b255284_20#gamestate. = GAMESTATE_INTROcxx . . $ GAMESTATE_INTRO.;
751 }
752 if (nowcxx . . $ now(e8d67d8f61cbb831).(statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..startedcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#started.)) {
753 statecxx . . $ state..gamestatecxx . . $ $anonymous_type_5882ab293b255284_20#gamestate. = GAMESTATE_GAMEcxx . . $ GAMESTATE_GAME.;
754 }
755
756 // call the top-level game state update function
757 switch (statecxx . . $ state..gamestatecxx . . $ $anonymous_type_5882ab293b255284_20#gamestate.) {
758 case GAMESTATE_INTROcxx . . $ GAMESTATE_INTRO.:
759 intro_tickcxx . . $ intro_tick(49f6e7a06ebc5aa8).();
760 break;
761 case GAMESTATE_GAMEcxx . . $ GAMESTATE_GAME.:
762 game_tickcxx . . $ game_tick(49f6e7a06ebc5aa8).();
763 break;
764 }
765 }
766 gfx_drawcxx . . $ gfx_draw(49f6e7a06ebc5aa8).();
767 snd_framecxx . . $ snd_frame(d4f767463ce0a6b3).(frame_time_ns);
768 }
769
770 static void inputcxx . . $ input(241e5018601f13a4).(const sapp_eventcxx . . $ sapp_event#* ev) {
771 if (statecxx . . $ state..inputcxx . . $ $anonymous_type_5882ab293b255284_20#input..enabledcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_24#enabled.) {
772 if ((ev->typecxx . . $ sapp_event#type. == SAPP_EVENTTYPE_KEY_DOWNcxx . . $ SAPP_EVENTTYPE_KEY_DOWN.) || (ev->typecxx . . $ sapp_event#type. == SAPP_EVENTTYPE_KEY_UPcxx . . $ SAPP_EVENTTYPE_KEY_UP.)) {
773 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! btn_down = ev->typecxx . . $ sapp_event#type. == SAPP_EVENTTYPE_KEY_DOWNcxx . . $ SAPP_EVENTTYPE_KEY_DOWN.;
774 switch (ev->key_codecxx . . $ sapp_event#key_code.) {
775 case SAPP_KEYCODE_UPcxx . . $ SAPP_KEYCODE_UP.:
776 case SAPP_KEYCODE_Wcxx . . $ SAPP_KEYCODE_W.:
777 statecxx . . $ state..inputcxx . . $ $anonymous_type_5882ab293b255284_20#input..upcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_24#up. = statecxx . . $ state..inputcxx . . $ $anonymous_type_5882ab293b255284_20#input..anykeycxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_24#anykey. = btn_down;
778 break;
779 case SAPP_KEYCODE_DOWNcxx . . $ SAPP_KEYCODE_DOWN.:
780 case SAPP_KEYCODE_Scxx . . $ SAPP_KEYCODE_S.:
781 statecxx . . $ state..inputcxx . . $ $anonymous_type_5882ab293b255284_20#input..downcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_24#down. = statecxx . . $ state..inputcxx . . $ $anonymous_type_5882ab293b255284_20#input..anykeycxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_24#anykey. = btn_down;
782 break;
783 case SAPP_KEYCODE_LEFTcxx . . $ SAPP_KEYCODE_LEFT.:
784 case SAPP_KEYCODE_Acxx . . $ SAPP_KEYCODE_A.:
785 statecxx . . $ state..inputcxx . . $ $anonymous_type_5882ab293b255284_20#input..leftcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_24#left. = statecxx . . $ state..inputcxx . . $ $anonymous_type_5882ab293b255284_20#input..anykeycxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_24#anykey. = btn_down;
786 break;
787 case SAPP_KEYCODE_RIGHTcxx . . $ SAPP_KEYCODE_RIGHT.:
788 case SAPP_KEYCODE_Dcxx . . $ SAPP_KEYCODE_D.:
789 statecxx . . $ state..inputcxx . . $ $anonymous_type_5882ab293b255284_20#input..rightcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_24#right. = statecxx . . $ state..inputcxx . . $ $anonymous_type_5882ab293b255284_20#input..anykeycxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_24#anykey. = btn_down;
790 break;
•791 case SAPP_KEYCODE_Fcxx . . $ SAPP_KEYCODE_F.:
792 if (btn_down) {
793 sapp_toggle_fullscreencxx . . $ sapp_toggle_fullscreen(49f6e7a06ebc5aa8).();
794 }
795 break;
796 case SAPP_KEYCODE_ESCAPEcxx . . $ SAPP_KEYCODE_ESCAPE.:
797 statecxx . . $ state..inputcxx . . $ $anonymous_type_5882ab293b255284_20#input..esccxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_24#esc. = statecxx . . $ state..inputcxx . . $ $anonymous_type_5882ab293b255284_20#input..anykeycxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_24#anykey. = btn_down;
798 break;
799 default:
800 statecxx . . $ state..inputcxx . . $ $anonymous_type_5882ab293b255284_20#input..anykeycxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_24#anykey. = btn_down;
801 break;
802 }
803 }
804 }
805 }
806
807 static void cleanupcxx . . $ cleanup(49f6e7a06ebc5aa8).(void) {
808 snd_shutdowncxx . . $ snd_shutdown(49f6e7a06ebc5aa8).();
809 gfx_shutdowncxx . . $ gfx_shutdown(49f6e7a06ebc5aa8).();
810 }
811
812 /*== GRAB BAG OF HELPER FUNCTIONS ============================================*/
813
814 // xorshift random number generator
815 static uint32_tcxx . . $ uint32_t# xorshift32cxx . . $ xorshift32(db52760e79bf9054).(void) {
816 uint32_tcxx . . $ uint32_t# x = statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..xorshiftcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#xorshift.;
817 x ^= x<<13;
818 x ^= x>>17;
819 x ^= x<<5;
820 return statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..xorshiftcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#xorshift. = x;
821 }
822 // get level spec for a game round
823 static levelspec_tcxx . . $ levelspec_t# levelspeccxx . . $ levelspec(f1bb36f57ae1f872).(int round) {
824 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(round >= 0);
825 if (round >= MAX_LEVELSPECcxx . . $ MAX_LEVELSPEC.) {
826 round = MAX_LEVELSPECcxx . . $ MAX_LEVELSPEC.-1;
827 }
828 return levelspec_tablecxx . . $ levelspec_table.[round];
829 }
830
831 // set time trigger to the next game tick
832 static void startcxx . . $ start(cb52e61069a1301a).(trigger_tcxx . . $ trigger_t#* t) {
833 t->tickcxx . . $ $anonymous_type_5882ab293b255284_8#tick. = statecxx . . $ state..timingcxx . . $ $anonymous_type_5882ab293b255284_20#timing..tickcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_21#tick. + 1;
834 }
835
836 // set time trigger to a future tick
837 static void start_aftercxx . . $ start_after(ddc23952494785a4).(trigger_tcxx . . $ trigger_t#* t, uint32_tcxx . . $ uint32_t# ticks) {
838 t->tickcxx . . $ $anonymous_type_5882ab293b255284_8#tick. = statecxx . . $ state..timingcxx . . $ $anonymous_type_5882ab293b255284_20#timing..tickcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_21#tick. + ticks;
839 }
840
841 // deactivate a time trigger
842 static void disablecxx . . $ disable(cb52e61069a1301a).(trigger_tcxx . . $ trigger_t#* t) {
843 t->tickcxx . . $ $anonymous_type_5882ab293b255284_8#tick. = DISABLED_TICKScxx . . $ `pacman.c:166:9`!;
844 }
845
846 // return a disabled time trigger
847 static trigger_tcxx . . $ trigger_t# disabled_timercxx . . $ disabled_timer(b79712e3efb14ea7).(void) {
848 return (trigger_tcxx . . $ trigger_t#) { .tick = DISABLED_TICKScxx . . $ `pacman.c:166:9`! };
849 }
850
851 // check if a time trigger is triggered
852 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! nowcxx . . $ now(e8d67d8f61cbb831).(trigger_tcxx . . $ trigger_t# t) {
853 return t.tickcxx . . $ $anonymous_type_5882ab293b255284_8#tick. == statecxx . . $ state..timingcxx . . $ $anonymous_type_5882ab293b255284_20#timing..tickcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_21#tick.;
854 }
855
856 // return the number of ticks since a time trigger was triggered
857 static uint32_tcxx . . $ uint32_t# sincecxx . . $ since(2687634081d878c4).(trigger_tcxx . . $ trigger_t# t) {
858 if (statecxx . . $ state..timingcxx . . $ $anonymous_type_5882ab293b255284_20#timing..tickcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_21#tick. >= t.tickcxx . . $ $anonymous_type_5882ab293b255284_8#tick.) {
859 return statecxx . . $ state..timingcxx . . $ $anonymous_type_5882ab293b255284_20#timing..tickcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_21#tick. - t.tickcxx . . $ $anonymous_type_5882ab293b255284_8#tick.;
860 }
861 else {
862 return DISABLED_TICKScxx . . $ `pacman.c:166:9`!;
863 }
864 }
865
866 // check if a time trigger is between begin and end tick
867 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! betweencxx . . $ between(4c7ecff5836b4e3d).(trigger_tcxx . . $ trigger_t# t, uint32_tcxx . . $ uint32_t# begin, uint32_tcxx . . $ uint32_t# end) {
868 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(begin < end);
869 if (t.tickcxx . . $ $anonymous_type_5882ab293b255284_8#tick. != DISABLED_TICKScxx . . $ `pacman.c:166:9`!) {
870 uint32_tcxx . . $ uint32_t# ticks = sincecxx . . $ since(2687634081d878c4).(t);
871 return (ticks >= begin) && (ticks < end);
872 }
873 else {
874 return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
875 }
876 }
877
878 // check if a time trigger was triggered exactly N ticks ago
879 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! after_oncecxx . . $ after_once(83b89002639f1b8c).(trigger_tcxx . . $ trigger_t# t, uint32_tcxx . . $ uint32_t# ticks) {
880 return sincecxx . . $ since(2687634081d878c4).(t) == ticks;
881 }
882
883 // check if a time trigger was triggered more than N ticks ago
884 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! aftercxx . . $ after(83b89002639f1b8c).(trigger_tcxx . . $ trigger_t# t, uint32_tcxx . . $ uint32_t# ticks) {
885 uint32_tcxx . . $ uint32_t# s = sincecxx . . $ since(2687634081d878c4).(t);
886 if (s != DISABLED_TICKScxx . . $ `pacman.c:166:9`!) {
887 return s >= ticks;
888 }
889 else {
890 return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
891 }
892 }
893
894 // same as between(t, 0, ticks)
895 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! beforecxx . . $ before(83b89002639f1b8c).(trigger_tcxx . . $ trigger_t# t, uint32_tcxx . . $ uint32_t# ticks) {
896 uint32_tcxx . . $ uint32_t# s = sincecxx . . $ since(2687634081d878c4).(t);
897 if (s != DISABLED_TICKScxx . . $ `pacman.c:166:9`!) {
898 return s < ticks;
899 }
900 else {
901 return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
902 }
903 }
904
905 // clear input state and disable input
906 static void input_disablecxx . . $ input_disable(49f6e7a06ebc5aa8).(void) {
907 memsetcxx . . $ memset(d1de1e4fb215f1c6).(&statecxx . . $ state..inputcxx . . $ $anonymous_type_5882ab293b255284_20#input., 0, sizeof(statecxx . . $ state..inputcxx . . $ $anonymous_type_5882ab293b255284_20#input.));
908 }
909
910 // enable input again
911 static void input_enablecxx . . $ input_enable(49f6e7a06ebc5aa8).(void) {
912 statecxx . . $ state..inputcxx . . $ $anonymous_type_5882ab293b255284_20#input..enabledcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_24#enabled. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
913 }
914
915 // get the current input as dir_t
916 static dir_tcxx . . $ dir_t# input_dircxx . . $ input_dir(1bd62f5ae2511854).(dir_tcxx . . $ dir_t# default_dir) {
917 if (statecxx . . $ state..inputcxx . . $ $anonymous_type_5882ab293b255284_20#input..upcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_24#up.) {
918 return DIR_UPcxx . . $ DIR_UP.;
919 }
920 else if (statecxx . . $ state..inputcxx . . $ $anonymous_type_5882ab293b255284_20#input..downcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_24#down.) {
921 return DIR_DOWNcxx . . $ DIR_DOWN.;
922 }
923 else if (statecxx . . $ state..inputcxx . . $ $anonymous_type_5882ab293b255284_20#input..rightcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_24#right.) {
924 return DIR_RIGHTcxx . . $ DIR_RIGHT.;
925 }
926 else if (statecxx . . $ state..inputcxx . . $ $anonymous_type_5882ab293b255284_20#input..leftcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_24#left.) {
927 return DIR_LEFTcxx . . $ DIR_LEFT.;
928 }
929 else {
930 return default_dir;
931 }
932 }
933
934 // shortcut to create an int2_t
935 static int2_tcxx . . $ int2_t# i2cxx . . $ i2(104fe1df0a7d588d).(int16_tcxx . . $ int16_t# x, int16_tcxx . . $ int16_t# y) {
936 return (int2_tcxx . . $ int2_t#) { x, y };
937 }
938
939 // add two int2_t
940 static int2_tcxx . . $ int2_t# add_i2cxx . . $ add_i2(ac5d9af22ed1a482).(int2_tcxx . . $ int2_t# v0, int2_tcxx . . $ int2_t# v1) {
941 return (int2_tcxx . . $ int2_t#) { v0.xcxx . . $ $anonymous_type_5882ab293b255284_9#x.+v1.xcxx . . $ $anonymous_type_5882ab293b255284_9#x., v0.ycxx . . $ $anonymous_type_5882ab293b255284_9#y.+v1.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. };
942 }
943
944 // subtract two int2_t
945 static int2_tcxx . . $ int2_t# sub_i2cxx . . $ sub_i2(ac5d9af22ed1a482).(int2_tcxx . . $ int2_t# v0, int2_tcxx . . $ int2_t# v1) {
946 return (int2_tcxx . . $ int2_t#) { v0.xcxx . . $ $anonymous_type_5882ab293b255284_9#x.-v1.xcxx . . $ $anonymous_type_5882ab293b255284_9#x., v0.ycxx . . $ $anonymous_type_5882ab293b255284_9#y.-v1.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. };
947 }
948
949 // multiply int2_t with scalar
950 static int2_tcxx . . $ int2_t# mul_i2cxx . . $ mul_i2(e90c1e009caacb78).(int2_tcxx . . $ int2_t# v, int16_tcxx . . $ int16_t# s) {
951 return (int2_tcxx . . $ int2_t#) { v.xcxx . . $ $anonymous_type_5882ab293b255284_9#x.*s, v.ycxx . . $ $anonymous_type_5882ab293b255284_9#y.*s };
952 }
953
954 // squared-distance between two int2_t
955 static int32_tcxx . . $ int32_t# squared_distance_i2cxx . . $ squared_distance_i2(f2b7c97266b8aad4).(int2_tcxx . . $ int2_t# v0, int2_tcxx . . $ int2_t# v1) {
956 int2_tcxx . . $ int2_t# d = { v1.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. - v0.xcxx . . $ $anonymous_type_5882ab293b255284_9#x., v1.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. - v0.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. };
957 return d.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. * d.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. + d.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. * d.ycxx . . $ $anonymous_type_5882ab293b255284_9#y.;
958 }
959
960 // check if two int2_t are equal
961 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! equal_i2cxx . . $ equal_i2(b023337e602d1a6b).(int2_tcxx . . $ int2_t# v0, int2_tcxx . . $ int2_t# v1) {
962 return (v0.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. == v1.xcxx . . $ $anonymous_type_5882ab293b255284_9#x.) && (v0.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. == v1.ycxx . . $ $anonymous_type_5882ab293b255284_9#y.);
963 }
964
965 // check if two int2_t are nearly equal
966 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! nearequal_i2cxx . . $ nearequal_i2(cc217e74f287e46c).(int2_tcxx . . $ int2_t# v0, int2_tcxx . . $ int2_t# v1, int16_tcxx . . $ int16_t# tolerance) {
967 return (abscxx . . $ abs(7864480464b09eea).(v1.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. - v0.xcxx . . $ $anonymous_type_5882ab293b255284_9#x.) <= tolerance) && (abscxx . . $ abs(7864480464b09eea).(v1.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. - v0.ycxx . . $ $anonymous_type_5882ab293b255284_9#y.) <= tolerance);
968 }
969
970 // convert an actor pos (origin at center) to sprite pos (origin top left)
971 static int2_tcxx . . $ int2_t# actor_to_sprite_poscxx . . $ actor_to_sprite_pos(b51706a12be1efba).(int2_tcxx . . $ int2_t# pos) {
972 return i2cxx . . $ i2(104fe1df0a7d588d).(pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. - SPRITE_WIDTHcxx . . $ `pacman.c:169:9`!/2, pos.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. - SPRITE_HEIGHTcxx . . $ `pacman.c:170:9`!/2);
973 }
974
975 // compute the distance of a pixel coordinate to the next tile midpoint
976 int2_tcxx . . $ int2_t# dist_to_tile_midcxx . . $ dist_to_tile_mid(b51706a12be1efba).(int2_tcxx . . $ int2_t# pos) {
977 return i2cxx . . $ i2(104fe1df0a7d588d).((TILE_WIDTHcxx . . $ `pacman.c:167:9`!/2) - pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. % TILE_WIDTHcxx . . $ `pacman.c:167:9`!, (TILE_HEIGHTcxx . . $ `pacman.c:168:9`!/2) - pos.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. % TILE_HEIGHTcxx . . $ `pacman.c:168:9`!);
978 }
979
980 // clear tile and color buffer
981 static void vid_clearcxx . . $ vid_clear(8fbe6856f5410d23).(uint8_tcxx . . $ uint8_t# tile_code, uint8_tcxx . . $ uint8_t# color_code) {
982 memsetcxx . . $ memset(d1de1e4fb215f1c6).(&statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..video_ramcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#video_ram., tile_code, sizeof(statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..video_ramcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#video_ram.));
983 memsetcxx . . $ memset(d1de1e4fb215f1c6).(&statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..color_ramcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#color_ram., color_code, sizeof(statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..color_ramcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#color_ram.));
984 }
985
986 // clear the playfield's rectangle in the color buffer
987 static void vid_color_playfieldcxx . . $ vid_color_playfield(ac50b47256ae7414).(uint8_tcxx . . $ uint8_t# color_code) {
988 for (int y = 3; y < DISPLAY_TILES_Ycxx . . $ `pacman.c:172:9`!-2; y++) {
989 for (int x = 0; x < DISPLAY_TILES_Xcxx . . $ `pacman.c:171:9`!; x++) {
990 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..color_ramcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#color_ram.[y][x] = color_code;
991 }
992 }
993 }
994
995 // check if a tile position is valid
996 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! valid_tile_poscxx . . $ valid_tile_pos(d0e5793988c1450e).(int2_tcxx . . $ int2_t# tile_pos) {
997 return ((tile_pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. >= 0) && (tile_pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. < DISPLAY_TILES_Xcxx . . $ `pacman.c:171:9`!) && (tile_pos.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. >= 0) && (tile_pos.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. < DISPLAY_TILES_Ycxx . . $ `pacman.c:172:9`!));
998 }
999
1000 // put a color into the color buffer
1001 static void vid_colorcxx . . $ vid_color(d0277b7ce0ae0949).(int2_tcxx . . $ int2_t# tile_pos, uint8_tcxx . . $ uint8_t# color_code) {
1002 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(valid_tile_pos(tile_pos));
1003 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..color_ramcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#color_ram.[tile_pos.ycxx . . $ $anonymous_type_5882ab293b255284_9#y.][tile_pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x.] = color_code;
1004 }
1005
1006 // put a tile into the tile buffer
1007 static void vid_tilecxx . . $ vid_tile(d0277b7ce0ae0949).(int2_tcxx . . $ int2_t# tile_pos, uint8_tcxx . . $ uint8_t# tile_code) {
1008 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(valid_tile_pos(tile_pos));
1009 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..video_ramcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#video_ram.[tile_pos.ycxx . . $ $anonymous_type_5882ab293b255284_9#y.][tile_pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x.] = tile_code;
1010 }
1011
1012 // put a colored tile into the tile and color buffers
1013 static void vid_color_tilecxx . . $ vid_color_tile(4a7eff1d41ff13be).(int2_tcxx . . $ int2_t# tile_pos, uint8_tcxx . . $ uint8_t# color_code, uint8_tcxx . . $ uint8_t# tile_code) {
1014 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(valid_tile_pos(tile_pos));
1015 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..video_ramcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#video_ram.[tile_pos.ycxx . . $ $anonymous_type_5882ab293b255284_9#y.][tile_pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x.] = tile_code;
1016 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..color_ramcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#color_ram.[tile_pos.ycxx . . $ $anonymous_type_5882ab293b255284_9#y.][tile_pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x.] = color_code;
1017 }
1018
1019 // translate ASCII char into "NAMCO char"
1020 static char conv_charcxx . . $ conv_char(e6e5e845b55315fc).(char c) {
1021 switch (c) {
1022 case ' ': c = 0x40; break;
1023 case '/': c = 58; break;
1024 case '-': c = 59; break;
1025 case '\"': c = 38; break;
1026 case '!': c = 'Z'+1; break;
1027 default: break;
1028 }
1029 return c;
1030 }
1031
1032 // put colored char into tile+color buffers
1033 static void vid_color_charcxx . . $ vid_color_char(255cb8899deff517).(int2_tcxx . . $ int2_t# tile_pos, uint8_tcxx . . $ uint8_t# color_code, char chr) {
1034 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(valid_tile_pos(tile_pos));
1035 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..video_ramcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#video_ram.[tile_pos.ycxx . . $ $anonymous_type_5882ab293b255284_9#y.][tile_pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x.] = conv_charcxx . . $ conv_char(e6e5e845b55315fc).(chr);
1036 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..color_ramcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#color_ram.[tile_pos.ycxx . . $ $anonymous_type_5882ab293b255284_9#y.][tile_pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x.] = color_code;
1037 }
1038
1039 // put char into tile buffer
1040 static void vid_charcxx . . $ vid_char(81b2d5e3112aed86).(int2_tcxx . . $ int2_t# tile_pos, char chr) {
1041 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(valid_tile_pos(tile_pos));
1042 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..video_ramcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#video_ram.[tile_pos.ycxx . . $ $anonymous_type_5882ab293b255284_9#y.][tile_pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x.] = conv_charcxx . . $ conv_char(e6e5e845b55315fc).(chr);
1043 }
1044
1045 // put colored text into the tile+color buffers
1046 static void vid_color_textcxx . . $ vid_color_text(ed5b0a47fa0fc189).(int2_tcxx . . $ int2_t# tile_pos, uint8_tcxx . . $ uint8_t# color_code, const char* text) {
1047 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(valid_tile_pos(tile_pos));
1048 uint8_tcxx . . $ uint8_t# chr;
1049 while ((chr = (uint8_tcxx . . $ uint8_t#) *text++)) {
1050 if (tile_pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. < DISPLAY_TILES_Xcxx . . $ `pacman.c:171:9`!) {
1051 vid_color_charcxx . . $ vid_color_char(255cb8899deff517).(tile_pos, color_code, chr);
1052 tile_pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x.++;
1053 }
1054 else {
1055 break;
1056 }
1057 }
1058 }
1059
1060 // put text into the tile buffer
1061 static void vid_textcxx . . $ vid_text(d655b391316be79a).(int2_tcxx . . $ int2_t# tile_pos, const char* text) {
1062 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(valid_tile_pos(tile_pos));
1063 uint8_tcxx . . $ uint8_t# chr;
1064 while ((chr = (uint8_tcxx . . $ uint8_t#) *text++)) {
1065 if (tile_pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. < DISPLAY_TILES_Xcxx . . $ `pacman.c:171:9`!) {
1066 vid_charcxx . . $ vid_char(81b2d5e3112aed86).(tile_pos, chr);
1067 tile_pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x.++;
1068 }
1069 else {
1070 break;
1071 }
1072 }
1073 }
1074
1075 /* print colored score number into tile+color buffers from right to left(!),
1076 scores are /10, the last printed number is always 0,
1077 a zero-score will print as '00' (this is the same as on
1078 the Pacman arcade machine)
1079 */
1080 static void vid_color_scorecxx . . $ vid_color_score(117c4a0e4f628d0f).(int2_tcxx . . $ int2_t# tile_pos, uint8_tcxx . . $ uint8_t# color_code, uint32_tcxx . . $ uint32_t# score) {
1081 vid_color_charcxx . . $ vid_color_char(255cb8899deff517).(tile_pos, color_code, '0');
1082 tile_pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x.--;
1083 for (int digit = 0; digit < 8; digit++) {
1084 char chr = (score % 10) + '0';
1085 if (valid_tile_poscxx . . $ valid_tile_pos(d0e5793988c1450e).(tile_pos)) {
1086 vid_color_charcxx . . $ vid_color_char(255cb8899deff517).(tile_pos, color_code, chr);
1087 tile_pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x.--;
1088 score /= 10;
1089 if (0 == score) {
1090 break;
1091 }
1092 }
1093 }
1094 }
1095
1096 /* draw a colored tile-quad arranged as:
1097 |t+1|t+0|
1098 |t+3|t+2|
1099
1100 This is (for instance) used to render the current "lives" and fruit
1101 symbols at the lower border.
1102 */
1103 static void vid_draw_tile_quadcxx . . $ vid_draw_tile_quad(4a7eff1d41ff13be).(int2_tcxx . . $ int2_t# tile_pos, uint8_tcxx . . $ uint8_t# color_code, uint8_tcxx . . $ uint8_t# tile_code) {
1104 for (int yy=0; yy<2; yy++) {
1105 for (int xx=0; xx<2; xx++) {
1106 uint8_tcxx . . $ uint8_t# t = tile_code + yy*2 + (1-xx);
1107 vid_color_tilecxx . . $ vid_color_tile(4a7eff1d41ff13be).(i2cxx . . $ i2(104fe1df0a7d588d).(xx + tile_pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x., yy + tile_pos.ycxx . . $ $anonymous_type_5882ab293b255284_9#y.), color_code, t);
1108 }
1109 }
1110 }
1111
1112 // draw the fruit bonus score tiles (when Pacman has eaten the bonus fruit)
1113 static void vid_fruit_scorecxx . . $ vid_fruit_score(9b774b9e6e7fe522).(fruit_tcxx . . $ fruit_t# fruit_type) {
1114 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!((fruit_type >= 0) && (fruit_type < NUM_FRUITS));
1115 uint8_tcxx . . $ uint8_t# color_code = (fruit_type == FRUIT_NONEcxx . . $ FRUIT_NONE.) ? COLOR_DOTcxx . . $ COLOR_DOT. : COLOR_FRUIT_SCOREcxx . . $ COLOR_FRUIT_SCORE.;
1116 for (int i = 0; i < 4; i++) {
1117 vid_color_tilecxx . . $ vid_color_tile(4a7eff1d41ff13be).(i2cxx . . $ i2(104fe1df0a7d588d).(12+i, 20), color_code, fruit_score_tilescxx . . $ fruit_score_tiles.[fruit_type][i]);
1118 }
1119 }
1120
1121 // disable and clear all sprites
1122 static void spr_clearcxx . . $ spr_clear(49f6e7a06ebc5aa8).(void) {
1123 memsetcxx . . $ memset(d1de1e4fb215f1c6).(&statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..spritecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#sprite., 0, sizeof(statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..spritecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#sprite.));
1124 }
1125
1126 // get pointer to pacman sprite
1127 static sprite_tcxx . . $ sprite_t#* spr_pacmancxx . . $ spr_pacman(4410a39133e056c0).(void) {
1128 return &statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..spritecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#sprite.[SPRITE_PACMANcxx . . $ SPRITE_PACMAN.];
1129 }
1130
1131 // get pointer to ghost sprite
1132 static sprite_tcxx . . $ sprite_t#* spr_ghostcxx . . $ spr_ghost(64f868b23daa988b).(ghosttype_tcxx . . $ ghosttype_t# type) {
1133 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!((type >= 0) && (type < NUM_GHOSTS));
1134 return &statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..spritecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#sprite.[SPRITE_BLINKYcxx . . $ SPRITE_BLINKY. + type];
1135 }
1136
1137 // get pointer to fruit sprite
1138 static sprite_tcxx . . $ sprite_t#* spr_fruitcxx . . $ spr_fruit(4410a39133e056c0).(void) {
1139 return &statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..spritecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#sprite.[SPRITE_FRUITcxx . . $ SPRITE_FRUIT.];
1140 }
1141
1142 // set sprite to animated Pacman
1143 static void spr_anim_pacmancxx . . $ spr_anim_pacman(affbe6c0c106481c).(dir_tcxx . . $ dir_t# dir, uint32_tcxx . . $ uint32_t# tick) {
1144 // animation frames for horizontal and vertical movement
1145 static const uint8_tcxx . . $ uint8_t# tiles[2][4] = {
1146 { 44, 46, 48, 46 }, // horizontal (needs flipx)
1147 { 45, 47, 48, 47 } // vertical (needs flipy)
1148 };
1149 sprite_tcxx . . $ sprite_t#* spr = spr_pacmancxx . . $ spr_pacman(4410a39133e056c0).();
1150 uint32_tcxx . . $ uint32_t# phase = (tick / 2) & 3;
1151 spr->tilecxx . . $ $anonymous_type_5882ab293b255284_14#tile. = tiles[dir & 1][phase];
1152 spr->colorcxx . . $ $anonymous_type_5882ab293b255284_14#color. = COLOR_PACMANcxx . . $ COLOR_PACMAN.;
1153 spr->flipxcxx . . $ $anonymous_type_5882ab293b255284_14#flipx. = (dir == DIR_LEFTcxx . . $ DIR_LEFT.);
1154 spr->flipycxx . . $ $anonymous_type_5882ab293b255284_14#flipy. = (dir == DIR_UPcxx . . $ DIR_UP.);
1155 }
1156
1157 // set sprite to Pacman's death sequence
1158 static void spr_anim_pacman_deathcxx . . $ spr_anim_pacman_death(cb2f890c2fdad230).(uint32_tcxx . . $ uint32_t# tick) {
1159 // the death animation tile sequence starts at sprite tile number 52 and ends at 63
1160 sprite_tcxx . . $ sprite_t#* spr = spr_pacmancxx . . $ spr_pacman(4410a39133e056c0).();
1161 uint32_tcxx . . $ uint32_t# tile = 52 + (tick / 8);
1162 if (tile > 63) {
1163 tile = 63;
1164 }
1165 spr->tilecxx . . $ $anonymous_type_5882ab293b255284_14#tile. = tile;
1166 spr->flipxcxx . . $ $anonymous_type_5882ab293b255284_14#flipx. = spr->flipycxx . . $ $anonymous_type_5882ab293b255284_14#flipy. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1167 }
1168
1169 // set sprite to animated ghost
1170 static void spr_anim_ghostcxx . . $ spr_anim_ghost(4f0b6bf4b3172136).(ghosttype_tcxx . . $ ghosttype_t# ghost_type, dir_tcxx . . $ dir_t# dir, uint32_tcxx . . $ uint32_t# tick) {
1171 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!((dir >= 0) && (dir < NUM_DIRS));
1172 static const uint8_tcxx . . $ uint8_t# tiles[4][2] = {
1173 { 32, 33 }, // right
1174 { 34, 35 }, // down
1175 { 36, 37 }, // left
1176 { 38, 39 }, // up
1177 };
1178 uint32_tcxx . . $ uint32_t# phase = (tick / 8) & 1;
1179 sprite_tcxx . . $ sprite_t#* spr = spr_ghostcxx . . $ spr_ghost(64f868b23daa988b).(ghost_type);
1180 spr->tilecxx . . $ $anonymous_type_5882ab293b255284_14#tile. = tiles[dir][phase];
1181 spr->colorcxx . . $ $anonymous_type_5882ab293b255284_14#color. = COLOR_BLINKYcxx . . $ COLOR_BLINKY. + 2*ghost_type;
1182 spr->flipxcxx . . $ $anonymous_type_5882ab293b255284_14#flipx. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1183 spr->flipycxx . . $ $anonymous_type_5882ab293b255284_14#flipy. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1184 }
1185
1186 // set sprite to frightened ghost
1187 static void spr_anim_ghost_frightenedcxx . . $ spr_anim_ghost_frightened(98f9482d05bd30b1).(ghosttype_tcxx . . $ ghosttype_t# ghost_type, uint32_tcxx . . $ uint32_t# tick) {
1188 static const uint8_tcxx . . $ uint8_t# tiles[2] = { 28, 29 };
1189 uint32_tcxx . . $ uint32_t# phase = (tick / 4) & 1;
1190 sprite_tcxx . . $ sprite_t#* spr = spr_ghostcxx . . $ spr_ghost(64f868b23daa988b).(ghost_type);
1191 spr->tilecxx . . $ $anonymous_type_5882ab293b255284_14#tile. = tiles[phase];
1192 if (tick > (uint32_tcxx . . $ uint32_t#)(levelspeccxx . . $ levelspec(f1bb36f57ae1f872).(statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..roundcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#round.).fright_tickscxx . . $ $anonymous_type_5882ab293b255284_29#fright_ticks. - 60)) {
1193 // towards end of frightening period, start blinking
1194 spr->colorcxx . . $ $anonymous_type_5882ab293b255284_14#color. = (tick & 0x10) ? COLOR_FRIGHTENEDcxx . . $ COLOR_FRIGHTENED. : COLOR_FRIGHTENED_BLINKINGcxx . . $ COLOR_FRIGHTENED_BLINKING.;
1195 }
1196 else {
1197 spr->colorcxx . . $ $anonymous_type_5882ab293b255284_14#color. = COLOR_FRIGHTENEDcxx . . $ COLOR_FRIGHTENED.;
1198 }
1199 spr->flipxcxx . . $ $anonymous_type_5882ab293b255284_14#flipx. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1200 spr->flipycxx . . $ $anonymous_type_5882ab293b255284_14#flipy. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1201 }
1202
1203 /* set sprite to ghost eyes, these are the normal ghost sprite
1204 images but with a different color code which makes
1205 only the eyes visible
1206 */
1207 static void spr_anim_ghost_eyescxx . . $ spr_anim_ghost_eyes(bd284119d75388b9).(ghosttype_tcxx . . $ ghosttype_t# ghost_type, dir_tcxx . . $ dir_t# dir) {
1208 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!((dir >= 0) && (dir < NUM_DIRS));
1209 static const uint8_tcxx . . $ uint8_t# tiles[NUM_DIRScxx . . $ NUM_DIRS.] = { 32, 34, 36, 38 };
1210 sprite_tcxx . . $ sprite_t#* spr = spr_ghostcxx . . $ spr_ghost(64f868b23daa988b).(ghost_type);
1211 spr->tilecxx . . $ $anonymous_type_5882ab293b255284_14#tile. = tiles[dir];
1212 spr->colorcxx . . $ $anonymous_type_5882ab293b255284_14#color. = COLOR_EYEScxx . . $ COLOR_EYES.;
1213 spr->flipxcxx . . $ $anonymous_type_5882ab293b255284_14#flipx. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1214 spr->flipycxx . . $ $anonymous_type_5882ab293b255284_14#flipy. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1215 }
1216
1217 // convert pixel position to tile position
1218 static int2_tcxx . . $ int2_t# pixel_to_tile_poscxx . . $ pixel_to_tile_pos(b51706a12be1efba).(int2_tcxx . . $ int2_t# pix_pos) {
1219 return i2cxx . . $ i2(104fe1df0a7d588d).(pix_pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. / TILE_WIDTHcxx . . $ `pacman.c:167:9`!, pix_pos.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. / TILE_HEIGHTcxx . . $ `pacman.c:168:9`!);
1220 }
1221
1222 // clamp tile pos to valid playfield coords
1223 static int2_tcxx . . $ int2_t# clamped_tile_poscxx . . $ clamped_tile_pos(b51706a12be1efba).(int2_tcxx . . $ int2_t# tile_pos) {
1224 int2_tcxx . . $ int2_t# res = tile_pos;
1225 if (res.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. < 0) {
1226 res.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. = 0;
1227 }
1228 else if (res.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. >= DISPLAY_TILES_Xcxx . . $ `pacman.c:171:9`!) {
1229 res.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. = DISPLAY_TILES_Xcxx . . $ `pacman.c:171:9`! - 1;
1230 }
1231 if (res.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. < 3) {
1232 res.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. = 3;
1233 }
1234 else if (res.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. >= (DISPLAY_TILES_Ycxx . . $ `pacman.c:172:9`!-2)) {
1235 res.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. = DISPLAY_TILES_Ycxx . . $ `pacman.c:172:9`! - 3;
1236 }
1237 return res;
1238 }
1239
1240 // convert a direction to a movement vector
1241 static int2_tcxx . . $ int2_t# dir_to_veccxx . . $ dir_to_vec(cff186593fe90fec).(dir_tcxx . . $ dir_t# dir) {
1242 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!((dir >= 0) && (dir < NUM_DIRS));
1243 static const int2_tcxx . . $ int2_t# dir_map[NUM_DIRScxx . . $ NUM_DIRS.] = { { +1, 0 }, { 0, +1 }, { -1, 0 }, { 0, -1 } };
1244 return dir_map[dir];
1245 }
1246
1247 // return the reverse direction
1248 static dir_tcxx . . $ dir_t# reverse_dircxx . . $ reverse_dir(1bd62f5ae2511854).(dir_tcxx . . $ dir_t# dir) {
1249 switch (dir) {
1250 case DIR_RIGHTcxx . . $ DIR_RIGHT.: return DIR_LEFTcxx . . $ DIR_LEFT.;
1251 case DIR_DOWNcxx . . $ DIR_DOWN.: return DIR_UPcxx . . $ DIR_UP.;
1252 case DIR_LEFTcxx . . $ DIR_LEFT.: return DIR_RIGHTcxx . . $ DIR_RIGHT.;
1253 default: return DIR_DOWNcxx . . $ DIR_DOWN.;
1254 }
1255 }
1256
1257 // return tile code at tile position
1258 static uint8_tcxx . . $ uint8_t# tile_code_atcxx . . $ tile_code_at(2e2fdf9f68f8b8ba).(int2_tcxx . . $ int2_t# tile_pos) {
1259 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!((tile_pos.x >= 0) && (tile_pos.x < DISPLAY_TILES_Xcxx . . $ `pacman.c:171:9`!));
1260 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!((tile_pos.y >= 0) && (tile_pos.y < DISPLAY_TILES_Ycxx . . $ `pacman.c:172:9`!));
1261 return statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..video_ramcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#video_ram.[tile_pos.ycxx . . $ $anonymous_type_5882ab293b255284_9#y.][tile_pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x.];
1262 }
1263
1264 // check if a tile position contains a blocking tile (walls and ghost house door)
1265 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! is_blocking_tilecxx . . $ is_blocking_tile(d0e5793988c1450e).(int2_tcxx . . $ int2_t# tile_pos) {
1266 return tile_code_atcxx . . $ tile_code_at(2e2fdf9f68f8b8ba).(tile_pos) >= 0xC0;
1267 }
1268
1269 // check if a tile position contains a dot tile
1270 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! is_dotcxx . . $ is_dot(d0e5793988c1450e).(int2_tcxx . . $ int2_t# tile_pos) {
1271 return tile_code_atcxx . . $ tile_code_at(2e2fdf9f68f8b8ba).(tile_pos) == TILE_DOTcxx . . $ TILE_DOT.;
1272 }
1273
1274 // check if a tile position contains a pill tile
1275 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! is_pillcxx . . $ is_pill(d0e5793988c1450e).(int2_tcxx . . $ int2_t# tile_pos) {
1276 return tile_code_atcxx . . $ tile_code_at(2e2fdf9f68f8b8ba).(tile_pos) == TILE_PILLcxx . . $ TILE_PILL.;
1277 }
1278
1279 // check if a tile position is in the teleport tunnel
1280 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! is_tunnelcxx . . $ is_tunnel(d0e5793988c1450e).(int2_tcxx . . $ int2_t# tile_pos) {
1281 return (tile_pos.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. == 17) && ((tile_pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. <= 5) || (tile_pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. >= 22));
1282 }
1283
1284 // check if a position is in the ghost's red zone, where upward movement is forbidden
1285 // (see Pacman Dossier "Areas To Exploit")
1286 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! is_redzonecxx . . $ is_redzone(d0e5793988c1450e).(int2_tcxx . . $ int2_t# tile_pos) {
1287 return ((tile_pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. >= 11) && (tile_pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. <= 16) && ((tile_pos.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. == 14) || (tile_pos.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. == 26)));
1288 }
1289
1290 // test if movement from a pixel position in a wanted direction is possible,
1291 // allow_cornering is Pacman's feature to take a diagonal shortcut around corners
1292 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! can_movecxx . . $ can_move(f7aadfae283f4f5d).(int2_tcxx . . $ int2_t# pos, dir_tcxx . . $ dir_t# wanted_dir, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! allow_cornering) {
1293 const int2_tcxx . . $ int2_t# dir_vec = dir_to_veccxx . . $ dir_to_vec(cff186593fe90fec).(wanted_dir);
1294 const int2_tcxx . . $ int2_t# dist_mid = dist_to_tile_midcxx . . $ dist_to_tile_mid(b51706a12be1efba).(pos);
1295
1296 // distance to midpoint in move direction and perpendicular direction
1297 int16_tcxx . . $ int16_t# move_dist_mid, perp_dist_mid;
1298 if (dir_vec.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. != 0) {
1299 move_dist_mid = dist_mid.ycxx . . $ $anonymous_type_5882ab293b255284_9#y.;
1300 perp_dist_mid = dist_mid.xcxx . . $ $anonymous_type_5882ab293b255284_9#x.;
1301 }
1302 else {
1303 move_dist_mid = dist_mid.xcxx . . $ $anonymous_type_5882ab293b255284_9#x.;
1304 perp_dist_mid = dist_mid.ycxx . . $ $anonymous_type_5882ab293b255284_9#y.;
1305 }
1306
1307 // look one tile ahead in movement direction
1308 const int2_tcxx . . $ int2_t# tile_pos = pixel_to_tile_poscxx . . $ pixel_to_tile_pos(b51706a12be1efba).(pos);
1309 const int2_tcxx . . $ int2_t# check_pos = clamped_tile_poscxx . . $ clamped_tile_pos(b51706a12be1efba).(add_i2cxx . . $ add_i2(ac5d9af22ed1a482).(tile_pos, dir_vec));
1310 const boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! is_blocked = is_blocking_tilecxx . . $ is_blocking_tile(d0e5793988c1450e).(check_pos);
1311 if ((!allow_cornering && (0 != perp_dist_mid)) || (is_blocked && (0 == move_dist_mid))) {
1312 // way is blocked
1313 return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1314 }
1315 else {
1316 // way is free
1317 return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
1318 }
1319 }
1320
1321 // compute a new pixel position along a direction (without blocking check!)
1322 static int2_tcxx . . $ int2_t# movecxx . . $ move(7ca2b540d4e558c8).(int2_tcxx . . $ int2_t# pos, dir_tcxx . . $ dir_t# dir, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! allow_cornering) {
1323 const int2_tcxx . . $ int2_t# dir_vec = dir_to_veccxx . . $ dir_to_vec(cff186593fe90fec).(dir);
1324 pos = add_i2cxx . . $ add_i2(ac5d9af22ed1a482).(pos, dir_vec);
1325
1326 // if cornering is allowed, drag the position towards the center-line
1327 if (allow_cornering) {
1328 const int2_tcxx . . $ int2_t# dist_mid = dist_to_tile_midcxx . . $ dist_to_tile_mid(b51706a12be1efba).(pos);
1329 if (dir_vec.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. != 0) {
1330 if (dist_mid.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. < 0) { pos.ycxx . . $ $anonymous_type_5882ab293b255284_9#y.--; }
1331 else if (dist_mid.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. > 0) { pos.ycxx . . $ $anonymous_type_5882ab293b255284_9#y.++; }
1332 }
1333 else if (dir_vec.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. != 0) {
1334 if (dist_mid.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. < 0) { pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x.--; }
1335 else if (dist_mid.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. > 0) { pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x.++; }
1336 }
1337 }
1338
1339 // wrap x-position around (only possible in the teleport-tunnel)
1340 if (pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. < 0) {
1341 pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. = DISPLAY_PIXELS_Xcxx . . $ `pacman.c:173:9`! - 1;
1342 }
1343 else if (pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. >= DISPLAY_PIXELS_Xcxx . . $ `pacman.c:173:9`!) {
1344 pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. = 0;
1345 }
1346 return pos;
1347 }
1348
1349 // set a debug marker
1350 #if DBG_MARKERScxx . . $ `pacman.c:147:9`!
1351 static void dbg_marker(int index, int2_t tile_pos, uint8_t tile_code, uint8_t color_code) {
1352 assert((index >= 0) && (index < NUM_DEBUG_MARKERS));
1353 state.gfx.debug_marker[index] = (debugmarker_t) {
1354 .enabled = true,
1355 .tile = tile_code,
1356 .color = color_code,
1357 .tile_pos = clamped_tile_pos(tile_pos)
1358 };
1359 }
1360 #endif
1361
1362 /*== GAMEPLAY CODE ===========================================================*/
1363
1364 // initialize the playfield tiles
1365 static void game_init_playfieldcxx . . $ game_init_playfield(49f6e7a06ebc5aa8).(void) {
1366 vid_color_playfieldcxx . . $ vid_color_playfield(ac50b47256ae7414).(COLOR_DOTcxx . . $ COLOR_DOT.);
1367 // decode the playfield from an ASCII map into tiles codes
1368 static const char* tiles =
1369 //0123456789012345678901234567
1370 "0UUUUUUUUUUUU45UUUUUUUUUUUU1" // 3
1371 "L............rl............R" // 4
1372 "L.ebbf.ebbbf.rl.ebbbf.ebbf.R" // 5
1373 "LPr l.r l.rl.r l.r lPR" // 6
1374 "L.guuh.guuuh.gh.guuuh.guuh.R" // 7
1375 "L..........................R" // 8
1376 "L.ebbf.ef.ebbbbbbf.ef.ebbf.R" // 9
1377 "L.guuh.rl.guuyxuuh.rl.guuh.R" // 10
1378 "L......rl....rl....rl......R" // 11
1379 "2BBBBf.rzbbf rl ebbwl.eBBBB3" // 12
1380 " L.rxuuh gh guuyl.R " // 13
1381 " L.rl rl.R " // 14
1382 " L.rl mjs--tjn rl.R " // 15
1383 "UUUUUh.gh i q gh.gUUUUU" // 16
1384 " . i q . " // 17
1385 "BBBBBf.ef i q ef.eBBBBB" // 18
1386 " L.rl okkkkkkp rl.R " // 19
1387 " L.rl rl.R " // 20
1388 " L.rl ebbbbbbf rl.R " // 21
1389 "0UUUUh.gh guuyxuuh gh.gUUUU1" // 22
1390 "L............rl............R" // 23
1391 "L.ebbf.ebbbf.rl.ebbbf.ebbf.R" // 24
1392 "L.guyl.guuuh.gh.guuuh.rxuh.R" // 25
1393 "LP..rl....... .......rl..PR" // 26
1394 "6bf.rl.ef.ebbbbbbf.ef.rl.eb8" // 27
1395 "7uh.gh.rl.guuyxuuh.rl.gh.gu9" // 28
1396 "L......rl....rl....rl......R" // 29
1397 "L.ebbbbwzbbf.rl.ebbwzbbbbf.R" // 30
1398 "L.guuuuuuuuh.gh.guuuuuuuuh.R" // 31
1399 "L..........................R" // 32
1400 "2BBBBBBBBBBBBBBBBBBBBBBBBBB3"; // 33
1401 //0123456789012345678901234567
1402 uint8_tcxx . . $ uint8_t# t[128];
1403 for (int i = 0; i < 128; i++) { t[i]=TILE_DOTcxx . . $ TILE_DOT.; }
1404 t[' ']=0x40; t['0']=0xD1; t['1']=0xD0; t['2']=0xD5; t['3']=0xD4; t['4']=0xFB;
1405 t['5']=0xFA; t['6']=0xD7; t['7']=0xD9; t['8']=0xD6; t['9']=0xD8; t['U']=0xDB;
1406 t['L']=0xD3; t['R']=0xD2; t['B']=0xDC; t['b']=0xDF; t['e']=0xE7; t['f']=0xE6;
1407 t['g']=0xEB; t['h']=0xEA; t['l']=0xE8; t['r']=0xE9; t['u']=0xE5; t['w']=0xF5;
1408 t['x']=0xF2; t['y']=0xF3; t['z']=0xF4; t['m']=0xED; t['n']=0xEC; t['o']=0xEF;
1409 t['p']=0xEE; t['j']=0xDD; t['i']=0xD2; t['k']=0xDB; t['q']=0xD3; t['s']=0xF1;
1410 t['t']=0xF0; t['-']=TILE_DOORcxx . . $ TILE_DOOR.; t['P']=TILE_PILLcxx . . $ TILE_PILL.;
1411 for (int y = 3, i = 0; y <= 33; y++) {
1412 for (int x = 0; x < 28; x++, i++) {
1413 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..video_ramcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#video_ram.[y][x] = t[tiles[i] & 127];
1414 }
1415 }
1416 // ghost house gate colors
1417 vid_colorcxx . . $ vid_color(d0277b7ce0ae0949).(i2cxx . . $ i2(104fe1df0a7d588d).(13,15), 0x18);
1418 vid_colorcxx . . $ vid_color(d0277b7ce0ae0949).(i2cxx . . $ i2(104fe1df0a7d588d).(14,15), 0x18);
1419 }
1420
1421 // disable all game loop timers
1422 static void game_disable_timerscxx . . $ game_disable_timers(49f6e7a06ebc5aa8).(void) {
1423 disablecxx . . $ disable(cb52e61069a1301a).(&statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..round_woncxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#round_won.);
1424 disablecxx . . $ disable(cb52e61069a1301a).(&statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..game_overcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#game_over.);
1425 disablecxx . . $ disable(cb52e61069a1301a).(&statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..dot_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#dot_eaten.);
1426 disablecxx . . $ disable(cb52e61069a1301a).(&statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..pill_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#pill_eaten.);
1427 disablecxx . . $ disable(cb52e61069a1301a).(&statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..ghost_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#ghost_eaten.);
1428 disablecxx . . $ disable(cb52e61069a1301a).(&statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..pacman_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#pacman_eaten.);
1429 disablecxx . . $ disable(cb52e61069a1301a).(&statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..fruit_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#fruit_eaten.);
1430 disablecxx . . $ disable(cb52e61069a1301a).(&statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..force_leave_housecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#force_leave_house.);
1431 disablecxx . . $ disable(cb52e61069a1301a).(&statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..fruit_activecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#fruit_active.);
1432 }
1433
1434 // one-time init at start of game state
1435 static void game_initcxx . . $ game_init(49f6e7a06ebc5aa8).(void) {
1436 input_enablecxx . . $ input_enable(49f6e7a06ebc5aa8).();
1437 game_disable_timerscxx . . $ game_disable_timers(49f6e7a06ebc5aa8).();
1438 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..roundcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#round. = DBG_START_ROUNDcxx . . $ `pacman.c:146:9`!;
1439 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..freezecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#freeze. = FREEZETYPE_PRELUDEcxx . . $ FREEZETYPE_PRELUDE.;
1440 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..num_livescxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#num_lives. = NUM_LIVEScxx . . $ `pacman.c:181:9`!;
1441 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..global_dot_counter_activecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#global_dot_counter_active. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1442 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..global_dot_countercxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#global_dot_counter. = 0;
1443 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..num_dots_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#num_dots_eaten. = 0;
1444 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..scorecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#score. = 0;
1445
1446 // draw the playfield and PLAYER ONE READY! message
1447 vid_clearcxx . . $ vid_clear(8fbe6856f5410d23).(TILE_SPACEcxx . . $ TILE_SPACE., COLOR_DOTcxx . . $ COLOR_DOT.);
1448 vid_color_textcxx . . $ vid_color_text(ed5b0a47fa0fc189).(i2cxx . . $ i2(104fe1df0a7d588d).(9,0), COLOR_DEFAULTcxx . . $ COLOR_DEFAULT., "HIGH SCORE");
1449 game_init_playfieldcxx . . $ game_init_playfield(49f6e7a06ebc5aa8).();
1450 vid_color_textcxx . . $ vid_color_text(ed5b0a47fa0fc189).(i2cxx . . $ i2(104fe1df0a7d588d).(9,14), 0x5, "PLAYER ONE");
1451 vid_color_textcxx . . $ vid_color_text(ed5b0a47fa0fc189).(i2cxx . . $ i2(104fe1df0a7d588d).(11, 20), 0x9, "READY!");
1452 }
1453
1454 // setup state at start of a game round
1455 static void game_round_initcxx . . $ game_round_init(49f6e7a06ebc5aa8).(void) {
1456 spr_clearcxx . . $ spr_clear(49f6e7a06ebc5aa8).();
1457
1458 // clear the "PLAYER ONE" text
1459 vid_color_textcxx . . $ vid_color_text(ed5b0a47fa0fc189).(i2cxx . . $ i2(104fe1df0a7d588d).(9,14), 0x10, " ");
1460
1461 /* if a new round was started because Pacman has "won" (eaten all dots),
1462 redraw the playfield and reset the global dot counter
1463 */
1464 if (statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..num_dots_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#num_dots_eaten. == NUM_DOTScxx . . $ `pacman.c:183:9`!) {
1465 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..roundcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#round.++;
1466 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..num_dots_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#num_dots_eaten. = 0;
1467 game_init_playfieldcxx . . $ game_init_playfield(49f6e7a06ebc5aa8).();
1468 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..global_dot_counter_activecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#global_dot_counter_active. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1469 }
1470 else {
1471 /* if the previous round was lost, use the global dot counter
1472 to detect when ghosts should leave the ghost house instead
1473 of the per-ghost dot counter
1474 */
1475 if (statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..num_livescxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#num_lives. != NUM_LIVEScxx . . $ `pacman.c:181:9`!) {
1476 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..global_dot_counter_activecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#global_dot_counter_active. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
1477 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..global_dot_countercxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#global_dot_counter. = 0;
1478 }
1479 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..num_livescxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#num_lives.--;
1480 }
1481 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(state.game.num_lives >= 0);
1482
1483 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..active_fruitcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#active_fruit. = FRUIT_NONEcxx . . $ FRUIT_NONE.;
1484 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..freezecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#freeze. = FREEZETYPE_READYcxx . . $ FREEZETYPE_READY.;
1485 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..xorshiftcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#xorshift. = 0x12345678; // random-number-generator seed
1486 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..num_ghosts_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#num_ghosts_eaten. = 0;
1487 game_disable_timerscxx . . $ game_disable_timers(49f6e7a06ebc5aa8).();
1488
1489 vid_color_textcxx . . $ vid_color_text(ed5b0a47fa0fc189).(i2cxx . . $ i2(104fe1df0a7d588d).(11, 20), 0x9, "READY!");
1490
1491 // the force-house timer forces ghosts out of the house if Pacman isn't
1492 // eating dots for a while
1493 startcxx . . $ start(cb52e61069a1301a).(&statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..force_leave_housecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#force_leave_house.);
1494
1495 // Pacman starts running to the left
1496 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..pacmancxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#pacman. = (pacman_tcxx . . $ pacman_t#) {
1497 .actor = {
1498 .dir = DIR_LEFTcxx . . $ DIR_LEFT.,
1499 .pos = { 14*8, 26*8+4 },
1500 },
1501 };
1502 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..spritecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#sprite.[SPRITE_PACMANcxx . . $ SPRITE_PACMAN.] = (sprite_tcxx . . $ sprite_t#) { .enabled = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, .color = COLOR_PACMANcxx . . $ COLOR_PACMAN. };
1503
1504 // Blinky starts outside the ghost house, looking to the left, and in scatter mode
1505 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..ghostcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#ghost.[GHOSTTYPE_BLINKYcxx . . $ GHOSTTYPE_BLINKY.] = (ghost_tcxx . . $ ghost_t#) {
1506 .actor = {
1507 .dir = DIR_LEFTcxx . . $ DIR_LEFT.,
1508 .pos = ghost_starting_poscxx . . $ ghost_starting_pos.[GHOSTTYPE_BLINKYcxx . . $ GHOSTTYPE_BLINKY.],
1509 },
1510 .type = GHOSTTYPE_BLINKYcxx . . $ GHOSTTYPE_BLINKY.,
1511 .next_dir = DIR_LEFTcxx . . $ DIR_LEFT.,
1512 .state = GHOSTSTATE_SCATTERcxx . . $ GHOSTSTATE_SCATTER.,
1513 .frightened = disabled_timercxx . . $ disabled_timer(b79712e3efb14ea7).(),
1514 .eaten = disabled_timercxx . . $ disabled_timer(b79712e3efb14ea7).(),
1515 .dot_counter = 0,
1516 .dot_limit = 0
1517 };
1518 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..spritecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#sprite.[SPRITE_BLINKYcxx . . $ SPRITE_BLINKY.] = (sprite_tcxx . . $ sprite_t#) { .enabled = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, .color = COLOR_BLINKYcxx . . $ COLOR_BLINKY. };
1519
1520 // Pinky starts in the middle slot of the ghost house, moving down
1521 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..ghostcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#ghost.[GHOSTTYPE_PINKYcxx . . $ GHOSTTYPE_PINKY.] = (ghost_tcxx . . $ ghost_t#) {
1522 .actor = {
1523 .dir = DIR_DOWNcxx . . $ DIR_DOWN.,
1524 .pos = ghost_starting_poscxx . . $ ghost_starting_pos.[GHOSTTYPE_PINKYcxx . . $ GHOSTTYPE_PINKY.],
1525 },
1526 .type = GHOSTTYPE_PINKYcxx . . $ GHOSTTYPE_PINKY.,
1527 .next_dir = DIR_DOWNcxx . . $ DIR_DOWN.,
1528 .state = GHOSTSTATE_HOUSEcxx . . $ GHOSTSTATE_HOUSE.,
1529 .frightened = disabled_timercxx . . $ disabled_timer(b79712e3efb14ea7).(),
1530 .eaten = disabled_timercxx . . $ disabled_timer(b79712e3efb14ea7).(),
1531 .dot_counter = 0,
1532 .dot_limit = 0
1533 };
1534 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..spritecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#sprite.[SPRITE_PINKYcxx . . $ SPRITE_PINKY.] = (sprite_tcxx . . $ sprite_t#) { .enabled = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, .color = COLOR_PINKYcxx . . $ COLOR_PINKY. };
1535
1536 // Inky starts in the left slot of the ghost house moving up
1537 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..ghostcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#ghost.[GHOSTTYPE_INKYcxx . . $ GHOSTTYPE_INKY.] = (ghost_tcxx . . $ ghost_t#) {
1538 .actor = {
1539 .dir = DIR_UPcxx . . $ DIR_UP.,
1540 .pos = ghost_starting_poscxx . . $ ghost_starting_pos.[GHOSTTYPE_INKYcxx . . $ GHOSTTYPE_INKY.],
1541 },
1542 .type = GHOSTTYPE_INKYcxx . . $ GHOSTTYPE_INKY.,
1543 .next_dir = DIR_UPcxx . . $ DIR_UP.,
1544 .state = GHOSTSTATE_HOUSEcxx . . $ GHOSTSTATE_HOUSE.,
1545 .frightened = disabled_timercxx . . $ disabled_timer(b79712e3efb14ea7).(),
1546 .eaten = disabled_timercxx . . $ disabled_timer(b79712e3efb14ea7).(),
1547 .dot_counter = 0,
1548 // FIXME: needs to be adjusted by current round!
1549 .dot_limit = 30
1550 };
1551 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..spritecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#sprite.[SPRITE_INKYcxx . . $ SPRITE_INKY.] = (sprite_tcxx . . $ sprite_t#) { .enabled = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, .color = COLOR_INKYcxx . . $ COLOR_INKY. };
1552
1553 // Clyde starts in the right slot of the ghost house, moving up
1554 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..ghostcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#ghost.[GHOSTTYPE_CLYDEcxx . . $ GHOSTTYPE_CLYDE.] = (ghost_tcxx . . $ ghost_t#) {
1555 .actor = {
1556 .dir = DIR_UPcxx . . $ DIR_UP.,
1557 .pos = ghost_starting_poscxx . . $ ghost_starting_pos.[GHOSTTYPE_CLYDEcxx . . $ GHOSTTYPE_CLYDE.],
1558 },
1559 .type = GHOSTTYPE_CLYDEcxx . . $ GHOSTTYPE_CLYDE.,
1560 .next_dir = DIR_UPcxx . . $ DIR_UP.,
1561 .state = GHOSTSTATE_HOUSEcxx . . $ GHOSTSTATE_HOUSE.,
1562 .frightened = disabled_timercxx . . $ disabled_timer(b79712e3efb14ea7).(),
1563 .eaten = disabled_timercxx . . $ disabled_timer(b79712e3efb14ea7).(),
1564 .dot_counter = 0,
1565 // FIXME: needs to be adjusted by current round!
1566 .dot_limit = 60,
1567 };
1568 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..spritecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#sprite.[SPRITE_CLYDEcxx . . $ SPRITE_CLYDE.] = (sprite_tcxx . . $ sprite_t#) { .enabled = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, .color = COLOR_CLYDEcxx . . $ COLOR_CLYDE. };
1569 }
1570
1571 // update dynamic background tiles
1572 static void game_update_tilescxx . . $ game_update_tiles(49f6e7a06ebc5aa8).(void) {
1573 // print score and hiscore
1574 vid_color_scorecxx . . $ vid_color_score(117c4a0e4f628d0f).(i2cxx . . $ i2(104fe1df0a7d588d).(6,1), COLOR_DEFAULTcxx . . $ COLOR_DEFAULT., statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..scorecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#score.);
1575 if (statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..hiscorecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#hiscore. > 0) {
1576 vid_color_scorecxx . . $ vid_color_score(117c4a0e4f628d0f).(i2cxx . . $ i2(104fe1df0a7d588d).(16,1), COLOR_DEFAULTcxx . . $ COLOR_DEFAULT., statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..hiscorecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#hiscore.);
1577 }
1578
1579 // update the energizer pill colors (blinking/non-blinking)
1580 static const int2_tcxx . . $ int2_t# pill_pos[NUM_PILLScxx . . $ `pacman.c:184:9`!] = { { 1, 6 }, { 26, 6 }, { 1, 26 }, { 26, 26 } };
1581 for (int i = 0; i < NUM_PILLScxx . . $ `pacman.c:184:9`!; i++) {
1582 if (statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..freezecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#freeze.) {
1583 vid_colorcxx . . $ vid_color(d0277b7ce0ae0949).(pill_pos[i], COLOR_DOTcxx . . $ COLOR_DOT.);
1584 }
1585 else {
1586 vid_colorcxx . . $ vid_color(d0277b7ce0ae0949).(pill_pos[i], (statecxx . . $ state..timingcxx . . $ $anonymous_type_5882ab293b255284_20#timing..tickcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_21#tick. & 0x8) ? 0x10:0);
1587 }
1588 }
1589
1590 // clear the fruit-eaten score after Pacman has eaten a bonus fruit
1591 if (after_oncecxx . . $ after_once(83b89002639f1b8c).(statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..fruit_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#fruit_eaten., 2*60)) {
1592 vid_fruit_scorecxx . . $ vid_fruit_score(9b774b9e6e7fe522).(FRUIT_NONEcxx . . $ FRUIT_NONE.);
1593 }
1594
1595 // remaining lives at bottom left screen
1596 for (int i = 0; i < NUM_LIVEScxx . . $ `pacman.c:181:9`!; i++) {
1597 uint8_tcxx . . $ uint8_t# color = (i < statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..num_livescxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#num_lives.) ? COLOR_PACMANcxx . . $ COLOR_PACMAN. : 0;
1598 vid_draw_tile_quadcxx . . $ vid_draw_tile_quad(4a7eff1d41ff13be).(i2cxx . . $ i2(104fe1df0a7d588d).(2+2*i,34), color, TILE_LIFEcxx . . $ TILE_LIFE.);
1599 }
1600
1601 // bonus fruit list in bottom-right corner
1602 {
1603 int16_tcxx . . $ int16_t# x = 24;
1604 for (int i = ((int)statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..roundcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#round. - NUM_STATUS_FRUITScxx . . $ `pacman.c:182:9`! + 1); i <= (int)statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..roundcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#round.; i++) {
1605 if (i >= 0) {
1606 fruit_tcxx . . $ fruit_t# fruit = levelspeccxx . . $ levelspec(f1bb36f57ae1f872).(i).bonus_fruitcxx . . $ $anonymous_type_5882ab293b255284_29#bonus_fruit.;
1607 uint8_tcxx . . $ uint8_t# tile_code = fruit_tiles_colorscxx . . $ fruit_tiles_colors.[fruit][0];
1608 uint8_tcxx . . $ uint8_t# color_code = fruit_tiles_colorscxx . . $ fruit_tiles_colors.[fruit][2];
1609 vid_draw_tile_quadcxx . . $ vid_draw_tile_quad(4a7eff1d41ff13be).(i2cxx . . $ i2(104fe1df0a7d588d).(x,34), color_code, tile_code);
1610 x -= 2;
1611 }
1612 }
1613 }
1614
1615 // if game round was won, render the entire playfield as blinking blue/white
1616 if (aftercxx . . $ after(83b89002639f1b8c).(statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..round_woncxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#round_won., 1*60)) {
1617 if (sincecxx . . $ since(2687634081d878c4).(statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..round_woncxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#round_won.) & 0x10) {
1618 vid_color_playfieldcxx . . $ vid_color_playfield(ac50b47256ae7414).(COLOR_DOTcxx . . $ COLOR_DOT.);
1619 }
1620 else {
1621 vid_color_playfieldcxx . . $ vid_color_playfield(ac50b47256ae7414).(COLOR_WHITE_BORDERcxx . . $ COLOR_WHITE_BORDER.);
1622 }
1623 }
1624 }
1625
1626 // this function takes care of updating all sprite images during gameplay
1627 static void game_update_spritescxx . . $ game_update_sprites(49f6e7a06ebc5aa8).(void) {
1628 // update Pacman sprite
1629 {
1630 sprite_tcxx . . $ sprite_t#* spr = spr_pacmancxx . . $ spr_pacman(4410a39133e056c0).();
1631 if (spr->enabledcxx . . $ $anonymous_type_5882ab293b255284_14#enabled.) {
1632 const actor_tcxx . . $ actor_t#* actor = &statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..pacmancxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#pacman..actorcxx . . $ $anonymous_type_5882ab293b255284_12#actor.;
1633 spr->poscxx . . $ $anonymous_type_5882ab293b255284_14#pos. = actor_to_sprite_poscxx . . $ actor_to_sprite_pos(b51706a12be1efba).(actor->poscxx . . $ $anonymous_type_5882ab293b255284_10#pos.);
1634 if (statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..freezecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#freeze. & FREEZETYPE_EAT_GHOSTcxx . . $ FREEZETYPE_EAT_GHOST.) {
1635 // hide Pacman shortly after he's eaten a ghost (via an invisible Sprite tile)
1636 spr->tilecxx . . $ $anonymous_type_5882ab293b255284_14#tile. = SPRITETILE_INVISIBLEcxx . . $ SPRITETILE_INVISIBLE.;
1637 }
1638 else if (statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..freezecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#freeze. & (FREEZETYPE_PRELUDEcxx . . $ FREEZETYPE_PRELUDE.|FREEZETYPE_READYcxx . . $ FREEZETYPE_READY.)) {
1639 // special case game frozen at start of round, show Pacman with 'closed mouth'
1640 spr->tilecxx . . $ $anonymous_type_5882ab293b255284_14#tile. = SPRITETILE_PACMAN_CLOSED_MOUTHcxx . . $ SPRITETILE_PACMAN_CLOSED_MOUTH.;
1641 }
1642 else if (statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..freezecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#freeze. & FREEZETYPE_DEADcxx . . $ FREEZETYPE_DEAD.) {
1643 // play the Pacman-death-animation after a short pause
1644 if (aftercxx . . $ after(83b89002639f1b8c).(statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..pacman_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#pacman_eaten., PACMAN_EATEN_TICKScxx . . $ `pacman.c:188:9`!)) {
1645 spr_anim_pacman_deathcxx . . $ spr_anim_pacman_death(cb2f890c2fdad230).(sincecxx . . $ since(2687634081d878c4).(statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..pacman_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#pacman_eaten.) - PACMAN_EATEN_TICKScxx . . $ `pacman.c:188:9`!);
1646 }
1647 }
1648 else {
1649 // regular Pacman animation
1650 spr_anim_pacmancxx . . $ spr_anim_pacman(affbe6c0c106481c).(actor->dircxx . . $ $anonymous_type_5882ab293b255284_10#dir., actor->anim_tickcxx . . $ $anonymous_type_5882ab293b255284_10#anim_tick.);
1651 }
1652 }
1653 }
1654
1655 // update ghost sprites
1656 for (int i = 0; i < NUM_GHOSTScxx . . $ NUM_GHOSTS.; i++) {
1657 sprite_tcxx . . $ sprite_t#* sprite = spr_ghostcxx . . $ spr_ghost(64f868b23daa988b).(i);
1658 if (sprite->enabledcxx . . $ $anonymous_type_5882ab293b255284_14#enabled.) {
1659 const ghost_tcxx . . $ ghost_t#* ghost = &statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..ghostcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#ghost.[i];
1660 sprite->poscxx . . $ $anonymous_type_5882ab293b255284_14#pos. = actor_to_sprite_poscxx . . $ actor_to_sprite_pos(b51706a12be1efba).(ghost->actorcxx . . $ $anonymous_type_5882ab293b255284_11#actor..poscxx . . $ $anonymous_type_5882ab293b255284_10#pos.);
1661 // if Pacman has just died, hide ghosts
1662 if (statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..freezecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#freeze. & FREEZETYPE_DEADcxx . . $ FREEZETYPE_DEAD.) {
1663 if (aftercxx . . $ after(83b89002639f1b8c).(statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..pacman_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#pacman_eaten., PACMAN_EATEN_TICKScxx . . $ `pacman.c:188:9`!)) {
1664 sprite->tilecxx . . $ $anonymous_type_5882ab293b255284_14#tile. = SPRITETILE_INVISIBLEcxx . . $ SPRITETILE_INVISIBLE.;
1665 }
1666 }
1667 // if Pacman has won the round, hide ghosts
1668 else if (statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..freezecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#freeze. & FREEZETYPE_WONcxx . . $ FREEZETYPE_WON.) {
1669 sprite->tilecxx . . $ $anonymous_type_5882ab293b255284_14#tile. = SPRITETILE_INVISIBLEcxx . . $ SPRITETILE_INVISIBLE.;
1670 }
1671 else switch (ghost->statecxx . . $ $anonymous_type_5882ab293b255284_11#state.) {
1672 case GHOSTSTATE_EYEScxx . . $ GHOSTSTATE_EYES.:
1673 if (beforecxx . . $ before(83b89002639f1b8c).(ghost->eatencxx . . $ $anonymous_type_5882ab293b255284_11#eaten., GHOST_EATEN_FREEZE_TICKScxx . . $ `pacman.c:187:9`!)) {
1674 // if the ghost was *just* eaten by Pacman, the ghost's sprite
1675 // is replaced with a score number for a short time
1676 // (200 for the first ghost, followed by 400, 800 and 1600)
1677 sprite->tilecxx . . $ $anonymous_type_5882ab293b255284_14#tile. = SPRITETILE_SCORE_200cxx . . $ SPRITETILE_SCORE_200. + statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..num_ghosts_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#num_ghosts_eaten. - 1;
1678 sprite->colorcxx . . $ $anonymous_type_5882ab293b255284_14#color. = COLOR_GHOST_SCOREcxx . . $ COLOR_GHOST_SCORE.;
1679 }
1680 else {
1681 // afterwards, the ghost's eyes are shown, heading back to the ghost house
1682 spr_anim_ghost_eyescxx . . $ spr_anim_ghost_eyes(bd284119d75388b9).(i, ghost->next_dircxx . . $ $anonymous_type_5882ab293b255284_11#next_dir.);
1683 }
1684 break;
1685 case GHOSTSTATE_ENTERHOUSEcxx . . $ GHOSTSTATE_ENTERHOUSE.:
1686 // ...still show the ghost eyes while entering the ghost house
1687 spr_anim_ghost_eyescxx . . $ spr_anim_ghost_eyes(bd284119d75388b9).(i, ghost->actorcxx . . $ $anonymous_type_5882ab293b255284_11#actor..dircxx . . $ $anonymous_type_5882ab293b255284_10#dir.);
1688 break;
1689 case GHOSTSTATE_FRIGHTENEDcxx . . $ GHOSTSTATE_FRIGHTENED.:
1690 // when inside the ghost house, show the normal ghost images
1691 // (FIXME: ghost's inside the ghost house also show the
1692 // frightened appearance when Pacman has eaten an energizer pill)
1693 spr_anim_ghost_frightenedcxx . . $ spr_anim_ghost_frightened(98f9482d05bd30b1).(i, sincecxx . . $ since(2687634081d878c4).(ghost->frightenedcxx . . $ $anonymous_type_5882ab293b255284_11#frightened.));
1694 break;
1695 default:
1696 // show the regular ghost sprite image, the ghost's
1697 // 'next_dir' is used to visualize the direction the ghost
1698 // is heading to, this has the effect that ghosts already look
1699 // into the direction they will move into one tile ahead
1700 spr_anim_ghostcxx . . $ spr_anim_ghost(4f0b6bf4b3172136).(i, ghost->next_dircxx . . $ $anonymous_type_5882ab293b255284_11#next_dir., ghost->actorcxx . . $ $anonymous_type_5882ab293b255284_11#actor..anim_tickcxx . . $ $anonymous_type_5882ab293b255284_10#anim_tick.);
1701 break;
1702 }
1703 }
1704 }
1705
1706 // hide or display the currently active bonus fruit
1707 if (statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..active_fruitcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#active_fruit. == FRUIT_NONEcxx . . $ FRUIT_NONE.) {
1708 spr_fruitcxx . . $ spr_fruit(4410a39133e056c0).()->enabledcxx . . $ $anonymous_type_5882ab293b255284_14#enabled. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1709 }
1710 else {
1711 sprite_tcxx . . $ sprite_t#* spr = spr_fruitcxx . . $ spr_fruit(4410a39133e056c0).();
1712 spr->enabledcxx . . $ $anonymous_type_5882ab293b255284_14#enabled. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
1713 spr->poscxx . . $ $anonymous_type_5882ab293b255284_14#pos. = i2cxx . . $ i2(104fe1df0a7d588d).(13 * TILE_WIDTHcxx . . $ `pacman.c:167:9`!, 19 * TILE_HEIGHTcxx . . $ `pacman.c:168:9`! + TILE_HEIGHTcxx . . $ `pacman.c:168:9`!/2);
1714 spr->tilecxx . . $ $anonymous_type_5882ab293b255284_14#tile. = fruit_tiles_colorscxx . . $ fruit_tiles_colors.[statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..active_fruitcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#active_fruit.][1];
1715 spr->colorcxx . . $ $anonymous_type_5882ab293b255284_14#color. = fruit_tiles_colorscxx . . $ fruit_tiles_colors.[statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..active_fruitcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#active_fruit.][2];
1716 }
1717 }
1718
1719 // return true if Pacman should move in this tick, when eating dots, Pacman
1720 // is slightly slower than ghosts, otherwise slightly faster
1721 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! game_pacman_should_movecxx . . $ game_pacman_should_move(c9857a73d68e59ba).(void) {
1722 if (nowcxx . . $ now(e8d67d8f61cbb831).(statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..dot_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#dot_eaten.)) {
1723 // eating a dot causes Pacman to stop for 1 tick
1724 return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1725 }
1726 else if (sincecxx . . $ since(2687634081d878c4).(statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..pill_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#pill_eaten.) < 3) {
1727 // eating an energizer pill causes Pacman to stop for 3 ticks
1728 return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1729 }
1730 else {
1731 return 0 != (statecxx . . $ state..timingcxx . . $ $anonymous_type_5882ab293b255284_20#timing..tickcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_21#tick. % 8);
1732 }
1733 }
1734
1735 // return number of pixels a ghost should move this tick, this can't be a simple
1736 // move/don't move boolean return value, because ghosts in eye state move faster
1737 // than one pixel per tick
1738 static int game_ghost_speedcxx . . $ game_ghost_speed(8bec379df5c2323d).(const ghost_tcxx . . $ ghost_t#* ghost) {
1739 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(ghost);
1740 switch (ghost->statecxx . . $ $anonymous_type_5882ab293b255284_11#state.) {
1741 case GHOSTSTATE_HOUSEcxx . . $ GHOSTSTATE_HOUSE.:
1742 case GHOSTSTATE_LEAVEHOUSEcxx . . $ GHOSTSTATE_LEAVEHOUSE.:
1743 // inside house at half speed (estimated)
1744 return statecxx . . $ state..timingcxx . . $ $anonymous_type_5882ab293b255284_20#timing..tickcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_21#tick. & 1;
1745 case GHOSTSTATE_FRIGHTENEDcxx . . $ GHOSTSTATE_FRIGHTENED.:
1746 // move at 50% speed when frightened
1747 return statecxx . . $ state..timingcxx . . $ $anonymous_type_5882ab293b255284_20#timing..tickcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_21#tick. & 1;
1748 case GHOSTSTATE_EYEScxx . . $ GHOSTSTATE_EYES.:
1749 case GHOSTSTATE_ENTERHOUSEcxx . . $ GHOSTSTATE_ENTERHOUSE.:
1750 // estimated 1.5x when in eye state, Pacman Dossier is silent on this
1751 return (statecxx . . $ state..timingcxx . . $ $anonymous_type_5882ab293b255284_20#timing..tickcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_21#tick. & 1) ? 1 : 2;
1752 default:
1753 if (is_tunnelcxx . . $ is_tunnel(d0e5793988c1450e).(pixel_to_tile_poscxx . . $ pixel_to_tile_pos(b51706a12be1efba).(ghost->actorcxx . . $ $anonymous_type_5882ab293b255284_11#actor..poscxx . . $ $anonymous_type_5882ab293b255284_10#pos.))) {
1754 // move drastically slower when inside tunnel
1755 return ((statecxx . . $ state..timingcxx . . $ $anonymous_type_5882ab293b255284_20#timing..tickcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_21#tick. * 2) % 4) ? 1 : 0;
1756 }
1757 else {
1758 // otherwise move just a bit slower than Pacman
1759 return (statecxx . . $ state..timingcxx . . $ $anonymous_type_5882ab293b255284_20#timing..tickcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_21#tick. % 7) ? 1 : 0;
1760 }
1761 }
1762 }
1763
1764 // return the current global scatter or chase phase
1765 static ghoststate_tcxx . . $ ghoststate_t# game_scatter_chase_phasecxx . . $ game_scatter_chase_phase(c063fbc94e0b8da7).(void) {
1766 uint32_tcxx . . $ uint32_t# t = sincecxx . . $ since(2687634081d878c4).(statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..round_startedcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#round_started.);
1767 if (t < 7*60) return GHOSTSTATE_SCATTERcxx . . $ GHOSTSTATE_SCATTER.;
1768 else if (t < 27*60) return GHOSTSTATE_CHASEcxx . . $ GHOSTSTATE_CHASE.;
1769 else if (t < 34*60) return GHOSTSTATE_SCATTERcxx . . $ GHOSTSTATE_SCATTER.;
1770 else if (t < 54*60) return GHOSTSTATE_CHASEcxx . . $ GHOSTSTATE_CHASE.;
1771 else if (t < 59*60) return GHOSTSTATE_SCATTERcxx . . $ GHOSTSTATE_SCATTER.;
1772 else if (t < 79*60) return GHOSTSTATE_CHASEcxx . . $ GHOSTSTATE_CHASE.;
1773 else if (t < 84*60) return GHOSTSTATE_SCATTERcxx . . $ GHOSTSTATE_SCATTER.;
1774 else return GHOSTSTATE_CHASEcxx . . $ GHOSTSTATE_CHASE.;
1775 }
1776
1777 // this function takes care of switching ghosts into a new state, this is one
1778 // of two important functions of the ghost AI (the other being the target selection
1779 // function below)
1780 static void game_update_ghost_statecxx . . $ game_update_ghost_state(d614ff93e79cb077).(ghost_tcxx . . $ ghost_t#* ghost) {
1781 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(ghost);
1782 ghoststate_tcxx . . $ ghoststate_t# new_state = ghost->statecxx . . $ $anonymous_type_5882ab293b255284_11#state.;
1783 switch (ghost->statecxx . . $ $anonymous_type_5882ab293b255284_11#state.) {
1784 case GHOSTSTATE_EYEScxx . . $ GHOSTSTATE_EYES.:
1785 // When in eye state (heading back to the ghost house), check if the
1786 // target position in front of the ghost house has been reached, then
1787 // switch into ENTERHOUSE state. Since ghosts in eye state move faster
1788 // than one pixel per tick, do a fuzzy comparison with the target pos
1789 if (nearequal_i2cxx . . $ nearequal_i2(cc217e74f287e46c).(ghost->actorcxx . . $ $anonymous_type_5882ab293b255284_11#actor..poscxx . . $ $anonymous_type_5882ab293b255284_10#pos., i2cxx . . $ i2(104fe1df0a7d588d).(ANTEPORTAS_Xcxx . . $ `pacman.c:185:9`!, ANTEPORTAS_Ycxx . . $ `pacman.c:186:9`!), 1)) {
1790 new_state = GHOSTSTATE_ENTERHOUSEcxx . . $ GHOSTSTATE_ENTERHOUSE.;
1791 }
1792 break;
1793 case GHOSTSTATE_ENTERHOUSEcxx . . $ GHOSTSTATE_ENTERHOUSE.:
1794 // Ghosts that enter the ghost house during the gameplay loop immediately
1795 // leave the house again after reaching their target position inside the house.
1796 if (nearequal_i2cxx . . $ nearequal_i2(cc217e74f287e46c).(ghost->actorcxx . . $ $anonymous_type_5882ab293b255284_11#actor..poscxx . . $ $anonymous_type_5882ab293b255284_10#pos., ghost_house_target_poscxx . . $ ghost_house_target_pos.[ghost->typecxx . . $ $anonymous_type_5882ab293b255284_11#type.], 1)) {
1797 new_state = GHOSTSTATE_LEAVEHOUSEcxx . . $ GHOSTSTATE_LEAVEHOUSE.;
1798 }
1799 break;
1800 case GHOSTSTATE_HOUSEcxx . . $ GHOSTSTATE_HOUSE.:
1801 // Ghosts only remain in the "house state" after a new game round
1802 // has been started. The conditions when ghosts leave the house
1803 // are a bit complicated, best to check the Pacman Dossier for the details.
1804 if (after_oncecxx . . $ after_once(83b89002639f1b8c).(statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..force_leave_housecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#force_leave_house., 4*60)) {
1805 // if Pacman hasn't eaten dots for 4 seconds, the next ghost
1806 // is forced out of the house
1807 // FIXME: time is reduced to 3 seconds after round 5
1808 new_state = GHOSTSTATE_LEAVEHOUSEcxx . . $ GHOSTSTATE_LEAVEHOUSE.;
1809 startcxx . . $ start(cb52e61069a1301a).(&statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..force_leave_housecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#force_leave_house.);
1810 }
1811 else if (statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..global_dot_counter_activecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#global_dot_counter_active.) {
1812 // if Pacman has lost a life this round, the global dot counter is used
1813 if ((ghost->typecxx . . $ $anonymous_type_5882ab293b255284_11#type. == GHOSTTYPE_PINKYcxx . . $ GHOSTTYPE_PINKY.) && (statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..global_dot_countercxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#global_dot_counter. == 7)) {
1814 new_state = GHOSTSTATE_LEAVEHOUSEcxx . . $ GHOSTSTATE_LEAVEHOUSE.;
1815 }
1816 else if ((ghost->typecxx . . $ $anonymous_type_5882ab293b255284_11#type. == GHOSTTYPE_INKYcxx . . $ GHOSTTYPE_INKY.) && (statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..global_dot_countercxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#global_dot_counter. == 17)) {
1817 new_state = GHOSTSTATE_LEAVEHOUSEcxx . . $ GHOSTSTATE_LEAVEHOUSE.;
1818 }
1819 else if ((ghost->typecxx . . $ $anonymous_type_5882ab293b255284_11#type. == GHOSTTYPE_CLYDEcxx . . $ GHOSTTYPE_CLYDE.) && (statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..global_dot_countercxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#global_dot_counter. == 32)) {
1820 new_state = GHOSTSTATE_LEAVEHOUSEcxx . . $ GHOSTSTATE_LEAVEHOUSE.;
1821 // NOTE that global dot counter is deactivated if (and only if) Clyde
1822 // is in the house and the dot counter reaches 32
1823 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..global_dot_counter_activecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#global_dot_counter_active. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1824 }
1825 }
1826 else if (ghost->dot_countercxx . . $ $anonymous_type_5882ab293b255284_11#dot_counter. == ghost->dot_limitcxx . . $ $anonymous_type_5882ab293b255284_11#dot_limit.) {
1827 // in the normal case, check the ghost's personal dot counter
1828 new_state = GHOSTSTATE_LEAVEHOUSEcxx . . $ GHOSTSTATE_LEAVEHOUSE.;
1829 }
1830 break;
1831 case GHOSTSTATE_LEAVEHOUSEcxx . . $ GHOSTSTATE_LEAVEHOUSE.:
1832 // ghosts immediately switch to scatter mode after leaving the ghost house
1833 if (ghost->actorcxx . . $ $anonymous_type_5882ab293b255284_11#actor..poscxx . . $ $anonymous_type_5882ab293b255284_10#pos..ycxx . . $ $anonymous_type_5882ab293b255284_9#y. == ANTEPORTAS_Ycxx . . $ `pacman.c:186:9`!) {
1834 new_state = GHOSTSTATE_SCATTERcxx . . $ GHOSTSTATE_SCATTER.;
1835 }
1836 break;
1837 default:
1838 // switch between frightened, scatter and chase mode
1839 if (beforecxx . . $ before(83b89002639f1b8c).(ghost->frightenedcxx . . $ $anonymous_type_5882ab293b255284_11#frightened., levelspeccxx . . $ levelspec(f1bb36f57ae1f872).(statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..roundcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#round.).fright_tickscxx . . $ $anonymous_type_5882ab293b255284_29#fright_ticks.)) {
1840 new_state = GHOSTSTATE_FRIGHTENEDcxx . . $ GHOSTSTATE_FRIGHTENED.;
1841 }
1842 else {
1843 new_state = game_scatter_chase_phasecxx . . $ game_scatter_chase_phase(c063fbc94e0b8da7).();
1844 }
1845 }
1846 // handle state transitions
1847 if (new_state != ghost->statecxx . . $ $anonymous_type_5882ab293b255284_11#state.) {
1848 switch (ghost->statecxx . . $ $anonymous_type_5882ab293b255284_11#state.) {
1849 case GHOSTSTATE_LEAVEHOUSEcxx . . $ GHOSTSTATE_LEAVEHOUSE.:
1850 // after leaving the ghost house, head to the left
1851 ghost->next_dircxx . . $ $anonymous_type_5882ab293b255284_11#next_dir. = ghost->actorcxx . . $ $anonymous_type_5882ab293b255284_11#actor..dircxx . . $ $anonymous_type_5882ab293b255284_10#dir. = DIR_LEFTcxx . . $ DIR_LEFT.;
1852 break;
1853 case GHOSTSTATE_ENTERHOUSEcxx . . $ GHOSTSTATE_ENTERHOUSE.:
1854 // a ghost that was eaten is immune to frighten until Pacman eats enother pill
1855 disablecxx . . $ disable(cb52e61069a1301a).(&ghost->frightenedcxx . . $ $anonymous_type_5882ab293b255284_11#frightened.);
1856 break;
1857 case GHOSTSTATE_FRIGHTENEDcxx . . $ GHOSTSTATE_FRIGHTENED.:
1858 // don't reverse direction when leaving frightened state
1859 break;
1860 case GHOSTSTATE_SCATTERcxx . . $ GHOSTSTATE_SCATTER.:
1861 case GHOSTSTATE_CHASEcxx . . $ GHOSTSTATE_CHASE.:
1862 // any transition from scatter and chase mode causes a reversal of direction
1863 ghost->next_dircxx . . $ $anonymous_type_5882ab293b255284_11#next_dir. = reverse_dircxx . . $ reverse_dir(1bd62f5ae2511854).(ghost->actorcxx . . $ $anonymous_type_5882ab293b255284_11#actor..dircxx . . $ $anonymous_type_5882ab293b255284_10#dir.);
1864 break;
1865 default:
1866 break;
1867 }
1868 ghost->statecxx . . $ $anonymous_type_5882ab293b255284_11#state. = new_state;
1869 }
1870 }
1871
1872 // update the ghost's target position, this is the other important function
1873 // of the ghost's AI
1874 static void game_update_ghost_targetcxx . . $ game_update_ghost_target(d614ff93e79cb077).(ghost_tcxx . . $ ghost_t#* ghost) {
1875 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(ghost);
1876 int2_tcxx . . $ int2_t# pos = ghost->target_poscxx . . $ $anonymous_type_5882ab293b255284_11#target_pos.;
1877 switch (ghost->statecxx . . $ $anonymous_type_5882ab293b255284_11#state.) {
1878 case GHOSTSTATE_SCATTERcxx . . $ GHOSTSTATE_SCATTER.:
1879 // when in scatter mode, each ghost heads to its own scatter
1880 // target position in the playfield corners
1881 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!((ghost->type >= 0) && (ghost->type < NUM_GHOSTS));
1882 pos = ghost_scatter_targetscxx . . $ ghost_scatter_targets.[ghost->typecxx . . $ $anonymous_type_5882ab293b255284_11#type.];
1883 break;
1884 case GHOSTSTATE_CHASEcxx . . $ GHOSTSTATE_CHASE.:
1885 // when in chase mode, each ghost has its own particular
1886 // chase behaviour (see the Pacman Dossier for details)
1887 {
1888 const actor_tcxx . . $ actor_t#* pm = &statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..pacmancxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#pacman..actorcxx . . $ $anonymous_type_5882ab293b255284_12#actor.;
1889 const int2_tcxx . . $ int2_t# pm_pos = pixel_to_tile_poscxx . . $ pixel_to_tile_pos(b51706a12be1efba).(pm->poscxx . . $ $anonymous_type_5882ab293b255284_10#pos.);
1890 const int2_tcxx . . $ int2_t# pm_dir = dir_to_veccxx . . $ dir_to_vec(cff186593fe90fec).(pm->dircxx . . $ $anonymous_type_5882ab293b255284_10#dir.);
1891 switch (ghost->typecxx . . $ $anonymous_type_5882ab293b255284_11#type.) {
1892 case GHOSTTYPE_BLINKYcxx . . $ GHOSTTYPE_BLINKY.:
1893 // Blinky directly chases Pacman
1894 pos = pm_pos;
1895 break;
1896 case GHOSTTYPE_PINKYcxx . . $ GHOSTTYPE_PINKY.:
1897 // Pinky target is 4 tiles ahead of Pacman
1898 // FIXME: does not reproduce 'diagonal overflow'
1899 pos = add_i2cxx . . $ add_i2(ac5d9af22ed1a482).(pm_pos, mul_i2cxx . . $ mul_i2(e90c1e009caacb78).(pm_dir, 4));
1900 break;
1901 case GHOSTTYPE_INKYcxx . . $ GHOSTTYPE_INKY.:
1902 // Inky targets an extrapolated pos along a line two tiles
1903 // ahead of Pacman through Blinky
1904 {
1905 const int2_tcxx . . $ int2_t# blinky_pos = pixel_to_tile_poscxx . . $ pixel_to_tile_pos(b51706a12be1efba).(statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..ghostcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#ghost.[GHOSTTYPE_BLINKYcxx . . $ GHOSTTYPE_BLINKY.].actorcxx . . $ $anonymous_type_5882ab293b255284_11#actor..poscxx . . $ $anonymous_type_5882ab293b255284_10#pos.);
1906 const int2_tcxx . . $ int2_t# p = add_i2cxx . . $ add_i2(ac5d9af22ed1a482).(pm_pos, mul_i2cxx . . $ mul_i2(e90c1e009caacb78).(pm_dir, 2));
1907 const int2_tcxx . . $ int2_t# d = sub_i2cxx . . $ sub_i2(ac5d9af22ed1a482).(p, blinky_pos);
1908 pos = add_i2cxx . . $ add_i2(ac5d9af22ed1a482).(blinky_pos, mul_i2cxx . . $ mul_i2(e90c1e009caacb78).(d, 2));
1909 }
1910 break;
1911 case GHOSTTYPE_CLYDEcxx . . $ GHOSTTYPE_CLYDE.:
1912 // if Clyde is far away from Pacman, he chases Pacman,
1913 // but if close he moves towards the scatter target
1914 if (squared_distance_i2cxx . . $ squared_distance_i2(f2b7c97266b8aad4).(pixel_to_tile_poscxx . . $ pixel_to_tile_pos(b51706a12be1efba).(ghost->actorcxx . . $ $anonymous_type_5882ab293b255284_11#actor..poscxx . . $ $anonymous_type_5882ab293b255284_10#pos.), pm_pos) > 64) {
1915 pos = pm_pos;
1916 }
1917 else {
1918 pos = ghost_scatter_targetscxx . . $ ghost_scatter_targets.[GHOSTTYPE_CLYDEcxx . . $ GHOSTTYPE_CLYDE.];
1919 }
1920 break;
1921 default:
1922 break;
1923 }
1924 }
1925 break;
1926 case GHOSTSTATE_FRIGHTENEDcxx . . $ GHOSTSTATE_FRIGHTENED.:
1927 // in frightened state just select a random target position
1928 // this has the effect that ghosts in frightened state
1929 // move in a random direction at each intersection
1930 pos = i2cxx . . $ i2(104fe1df0a7d588d).(xorshift32cxx . . $ xorshift32(db52760e79bf9054).() % DISPLAY_TILES_Xcxx . . $ `pacman.c:171:9`!, xorshift32cxx . . $ xorshift32(db52760e79bf9054).() % DISPLAY_TILES_Ycxx . . $ `pacman.c:172:9`!);
1931 break;
1932 case GHOSTSTATE_EYEScxx . . $ GHOSTSTATE_EYES.:
1933 // move towards the ghost house door
1934 pos = i2cxx . . $ i2(104fe1df0a7d588d).(13, 14);
1935 break;
1936 default:
1937 break;
1938 }
1939 ghost->target_poscxx . . $ $anonymous_type_5882ab293b255284_11#target_pos. = pos;
1940 }
1941
1942 // compute the next ghost direction, return true if resulting movement
1943 // should always happen regardless of current ghost position or blocking
1944 // tiles (this special case is used for movement inside the ghost house)
1945 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! game_update_ghost_dircxx . . $ game_update_ghost_dir(419ad0d6c5260fff).(ghost_tcxx . . $ ghost_t#* ghost) {
1946 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(ghost);
1947 // inside ghost-house, just move up and down
1948 if (ghost->statecxx . . $ $anonymous_type_5882ab293b255284_11#state. == GHOSTSTATE_HOUSEcxx . . $ GHOSTSTATE_HOUSE.) {
1949 if (ghost->actorcxx . . $ $anonymous_type_5882ab293b255284_11#actor..poscxx . . $ $anonymous_type_5882ab293b255284_10#pos..ycxx . . $ $anonymous_type_5882ab293b255284_9#y. <= 17*TILE_HEIGHTcxx . . $ `pacman.c:168:9`!) {
1950 ghost->next_dircxx . . $ $anonymous_type_5882ab293b255284_11#next_dir. = DIR_DOWNcxx . . $ DIR_DOWN.;
1951 }
1952 else if (ghost->actorcxx . . $ $anonymous_type_5882ab293b255284_11#actor..poscxx . . $ $anonymous_type_5882ab293b255284_10#pos..ycxx . . $ $anonymous_type_5882ab293b255284_9#y. >= 18*TILE_HEIGHTcxx . . $ `pacman.c:168:9`!) {
1953 ghost->next_dircxx . . $ $anonymous_type_5882ab293b255284_11#next_dir. = DIR_UPcxx . . $ DIR_UP.;
1954 }
1955 ghost->actorcxx . . $ $anonymous_type_5882ab293b255284_11#actor..dircxx . . $ $anonymous_type_5882ab293b255284_10#dir. = ghost->next_dircxx . . $ $anonymous_type_5882ab293b255284_11#next_dir.;
1956 // force movement
1957 return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
1958 }
1959 // navigate the ghost out of the ghost house
1960 else if (ghost->statecxx . . $ $anonymous_type_5882ab293b255284_11#state. == GHOSTSTATE_LEAVEHOUSEcxx . . $ GHOSTSTATE_LEAVEHOUSE.) {
1961 const int2_tcxx . . $ int2_t# pos = ghost->actorcxx . . $ $anonymous_type_5882ab293b255284_11#actor..poscxx . . $ $anonymous_type_5882ab293b255284_10#pos.;
1962 if (pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. == ANTEPORTAS_Xcxx . . $ `pacman.c:185:9`!) {
1963 if (pos.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. > ANTEPORTAS_Ycxx . . $ `pacman.c:186:9`!) {
1964 ghost->next_dircxx . . $ $anonymous_type_5882ab293b255284_11#next_dir. = DIR_UPcxx . . $ DIR_UP.;
1965 }
1966 }
1967 else {
1968 const int16_tcxx . . $ int16_t# mid_y = 17*TILE_HEIGHTcxx . . $ `pacman.c:168:9`! + TILE_HEIGHTcxx . . $ `pacman.c:168:9`!/2;
1969 if (pos.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. > mid_y) {
1970 ghost->next_dircxx . . $ $anonymous_type_5882ab293b255284_11#next_dir. = DIR_UPcxx . . $ DIR_UP.;
1971 }
1972 else if (pos.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. < mid_y) {
1973 ghost->next_dircxx . . $ $anonymous_type_5882ab293b255284_11#next_dir. = DIR_DOWNcxx . . $ DIR_DOWN.;
1974 }
1975 else {
1976 ghost->next_dircxx . . $ $anonymous_type_5882ab293b255284_11#next_dir. = (pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. > ANTEPORTAS_Xcxx . . $ `pacman.c:185:9`!) ? DIR_LEFTcxx . . $ DIR_LEFT.:DIR_RIGHTcxx . . $ DIR_RIGHT.;
1977 }
1978 }
1979 ghost->actorcxx . . $ $anonymous_type_5882ab293b255284_11#actor..dircxx . . $ $anonymous_type_5882ab293b255284_10#dir. = ghost->next_dircxx . . $ $anonymous_type_5882ab293b255284_11#next_dir.;
1980 return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
1981 }
1982 // navigate towards the ghost house target pos
1983 else if (ghost->statecxx . . $ $anonymous_type_5882ab293b255284_11#state. == GHOSTSTATE_ENTERHOUSEcxx . . $ GHOSTSTATE_ENTERHOUSE.) {
1984 const int2_tcxx . . $ int2_t# pos = ghost->actorcxx . . $ $anonymous_type_5882ab293b255284_11#actor..poscxx . . $ $anonymous_type_5882ab293b255284_10#pos.;
1985 const int2_tcxx . . $ int2_t# tile_pos = pixel_to_tile_poscxx . . $ pixel_to_tile_pos(b51706a12be1efba).(pos);
1986 const int2_tcxx . . $ int2_t# tgt_pos = ghost_house_target_poscxx . . $ ghost_house_target_pos.[ghost->typecxx . . $ $anonymous_type_5882ab293b255284_11#type.];
1987 if (tile_pos.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. == 14) {
1988 if (pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. != ANTEPORTAS_Xcxx . . $ `pacman.c:185:9`!) {
1989 ghost->next_dircxx . . $ $anonymous_type_5882ab293b255284_11#next_dir. = (pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. < ANTEPORTAS_Xcxx . . $ `pacman.c:185:9`!) ? DIR_RIGHTcxx . . $ DIR_RIGHT.:DIR_LEFTcxx . . $ DIR_LEFT.;
1990 }
1991 else {
1992 ghost->next_dircxx . . $ $anonymous_type_5882ab293b255284_11#next_dir. = DIR_DOWNcxx . . $ DIR_DOWN.;
1993 }
1994 }
1995 else if (pos.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. == tgt_pos.ycxx . . $ $anonymous_type_5882ab293b255284_9#y.) {
1996 ghost->next_dircxx . . $ $anonymous_type_5882ab293b255284_11#next_dir. = (pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. < tgt_pos.xcxx . . $ $anonymous_type_5882ab293b255284_9#x.) ? DIR_RIGHTcxx . . $ DIR_RIGHT.:DIR_LEFTcxx . . $ DIR_LEFT.;
1997 }
1998 ghost->actorcxx . . $ $anonymous_type_5882ab293b255284_11#actor..dircxx . . $ $anonymous_type_5882ab293b255284_10#dir. = ghost->next_dircxx . . $ $anonymous_type_5882ab293b255284_11#next_dir.;
1999 return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
2000 }
2001 // scatter/chase/frightened: just head towards the current target point
2002 else {
2003 // only compute new direction when currently at midpoint of tile
2004 const int2_tcxx . . $ int2_t# dist_to_mid = dist_to_tile_midcxx . . $ dist_to_tile_mid(b51706a12be1efba).(ghost->actorcxx . . $ $anonymous_type_5882ab293b255284_11#actor..poscxx . . $ $anonymous_type_5882ab293b255284_10#pos.);
2005 if ((dist_to_mid.xcxx . . $ $anonymous_type_5882ab293b255284_9#x. == 0) && (dist_to_mid.ycxx . . $ $anonymous_type_5882ab293b255284_9#y. == 0)) {
2006 // new direction is the previously computed next-direction
2007 ghost->actorcxx . . $ $anonymous_type_5882ab293b255284_11#actor..dircxx . . $ $anonymous_type_5882ab293b255284_10#dir. = ghost->next_dircxx . . $ $anonymous_type_5882ab293b255284_11#next_dir.;
2008
2009 // compute new next-direction
2010 const int2_tcxx . . $ int2_t# dir_vec = dir_to_veccxx . . $ dir_to_vec(cff186593fe90fec).(ghost->actorcxx . . $ $anonymous_type_5882ab293b255284_11#actor..dircxx . . $ $anonymous_type_5882ab293b255284_10#dir.);
2011 const int2_tcxx . . $ int2_t# lookahead_pos = add_i2cxx . . $ add_i2(ac5d9af22ed1a482).(pixel_to_tile_poscxx . . $ pixel_to_tile_pos(b51706a12be1efba).(ghost->actorcxx . . $ $anonymous_type_5882ab293b255284_11#actor..poscxx . . $ $anonymous_type_5882ab293b255284_10#pos.), dir_vec);
2012
2013 // try each direction and take the one that moves closest to the target
2014 const dir_tcxx . . $ dir_t# dirs[NUM_DIRScxx . . $ NUM_DIRS.] = { DIR_UPcxx . . $ DIR_UP., DIR_LEFTcxx . . $ DIR_LEFT., DIR_DOWNcxx . . $ DIR_DOWN., DIR_RIGHTcxx . . $ DIR_RIGHT. };
2015 int min_dist = 100000;
2016 int dist = 0;
2017 for (int i = 0; i < NUM_DIRScxx . . $ NUM_DIRS.; i++) {
2018 const dir_tcxx . . $ dir_t# dir = dirs[i];
2019 // if ghost is in one of the two 'red zones', forbid upward movement
2020 // (see Pacman Dossier "Areas To Exploit")
2021 if (is_redzonecxx . . $ is_redzone(d0e5793988c1450e).(lookahead_pos) && (dir == DIR_UPcxx . . $ DIR_UP.) && (ghost->statecxx . . $ $anonymous_type_5882ab293b255284_11#state. != GHOSTSTATE_EYEScxx . . $ GHOSTSTATE_EYES.)) {
2022 continue;
2023 }
2024 const dir_tcxx . . $ dir_t# revdir = reverse_dircxx . . $ reverse_dir(1bd62f5ae2511854).(dir);
2025 const int2_tcxx . . $ int2_t# test_pos = clamped_tile_poscxx . . $ clamped_tile_pos(b51706a12be1efba).(add_i2cxx . . $ add_i2(ac5d9af22ed1a482).(lookahead_pos, dir_to_veccxx . . $ dir_to_vec(cff186593fe90fec).(dir)));
2026 if ((revdir != ghost->actorcxx . . $ $anonymous_type_5882ab293b255284_11#actor..dircxx . . $ $anonymous_type_5882ab293b255284_10#dir.) && !is_blocking_tilecxx . . $ is_blocking_tile(d0e5793988c1450e).(test_pos)) {
2027 if ((dist = squared_distance_i2cxx . . $ squared_distance_i2(f2b7c97266b8aad4).(test_pos, ghost->target_poscxx . . $ $anonymous_type_5882ab293b255284_11#target_pos.)) < min_dist) {
2028 min_dist = dist;
2029 ghost->next_dircxx . . $ $anonymous_type_5882ab293b255284_11#next_dir. = dir;
2030 }
2031 }
2032 }
2033 }
2034 return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
2035 }
2036 }
2037
2038 /* Update the dot counters used to decide whether ghosts must leave the house.
2039
2040 This is called each time Pacman eats a dot.
2041
2042 Each ghost has a dot limit which is reset at the start of a round. Each time
2043 Pacman eats a dot, the highest priority ghost in the ghost house counts
2044 down its dot counter.
2045
2046 When the ghost's dot counter reaches zero the ghost leaves the house
2047 and the next highest-priority dot counter starts counting.
2048
2049 If a life is lost, the personal dot counters are deactivated and instead
2050 a global dot counter is used.
2051
2052 If pacman doesn't eat dots for a while, the next ghost is forced out of the
2053 house using a timer.
2054 */
2055 static void game_update_ghosthouse_dot_counterscxx . . $ game_update_ghosthouse_dot_counters(49f6e7a06ebc5aa8).(void) {
2056 // if the new round was started because Pacman lost a life, use the global
2057 // dot counter (this mode will be deactivated again after all ghosts left the
2058 // house)
2059 if (statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..global_dot_counter_activecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#global_dot_counter_active.) {
2060 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..global_dot_countercxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#global_dot_counter.++;
2061 }
2062 else {
2063 // otherwise each ghost has his own personal dot counter to decide
2064 // when to leave the ghost house
2065 for (int i = 0; i < NUM_GHOSTScxx . . $ NUM_GHOSTS.; i++) {
2066 if (statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..ghostcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#ghost.[i].dot_countercxx . . $ $anonymous_type_5882ab293b255284_11#dot_counter. < statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..ghostcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#ghost.[i].dot_limitcxx . . $ $anonymous_type_5882ab293b255284_11#dot_limit.) {
2067 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..ghostcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#ghost.[i].dot_countercxx . . $ $anonymous_type_5882ab293b255284_11#dot_counter.++;
2068 break;
2069 }
2070 }
2071 }
2072 }
2073
2074 // called when a dot or pill has been eaten, checks if a round has been won
2075 // (all dots and pills eaten), whether to show the bonus fruit, and finally
2076 // plays the dot-eaten sound effect
2077 static void game_update_dots_eatencxx . . $ game_update_dots_eaten(49f6e7a06ebc5aa8).(void) {
2078 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..num_dots_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#num_dots_eaten.++;
2079 if (statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..num_dots_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#num_dots_eaten. == NUM_DOTScxx . . $ `pacman.c:183:9`!) {
2080 // all dots eaten, round won
2081 startcxx . . $ start(cb52e61069a1301a).(&statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..round_woncxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#round_won.);
2082 snd_clearcxx . . $ snd_clear(49f6e7a06ebc5aa8).();
2083 }
2084 else if ((statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..num_dots_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#num_dots_eaten. == 70) || (statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..num_dots_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#num_dots_eaten. == 170)) {
2085 // at 70 and 170 dots, show the bonus fruit
2086 startcxx . . $ start(cb52e61069a1301a).(&statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..fruit_activecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#fruit_active.);
2087 }
2088
2089 // play alternating crunch sound effect when a dot has been eaten
2090 if (statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..num_dots_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#num_dots_eaten. & 1) {
2091 snd_startcxx . . $ snd_start(eb66bf3bee49480).(2, &snd_eatdot1cxx . . $ snd_eatdot1.);
2092 }
2093 else {
2094 snd_startcxx . . $ snd_start(eb66bf3bee49480).(2, &snd_eatdot2cxx . . $ snd_eatdot2.);
2095 }
2096 }
2097
2098 // the central Pacman and ghost behaviour function, called once per game tick
2099 static void game_update_actorscxx . . $ game_update_actors(49f6e7a06ebc5aa8).(void) {
2100 // Pacman "AI"
2101 if (game_pacman_should_movecxx . . $ game_pacman_should_move(c9857a73d68e59ba).()) {
2102 // move Pacman with cornering allowed
2103 actor_tcxx . . $ actor_t#* actor = &statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..pacmancxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#pacman..actorcxx . . $ $anonymous_type_5882ab293b255284_12#actor.;
2104 const dir_tcxx . . $ dir_t# wanted_dir = input_dircxx . . $ input_dir(1bd62f5ae2511854).(actor->dircxx . . $ $anonymous_type_5882ab293b255284_10#dir.);
2105 const boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! allow_cornering = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
2106 // look ahead to check if the wanted direction is blocked
2107 if (can_movecxx . . $ can_move(f7aadfae283f4f5d).(actor->poscxx . . $ $anonymous_type_5882ab293b255284_10#pos., wanted_dir, allow_cornering)) {
2108 actor->dircxx . . $ $anonymous_type_5882ab293b255284_10#dir. = wanted_dir;
2109 }
2110 // move into the selected direction
2111 if (can_movecxx . . $ can_move(f7aadfae283f4f5d).(actor->poscxx . . $ $anonymous_type_5882ab293b255284_10#pos., actor->dircxx . . $ $anonymous_type_5882ab293b255284_10#dir., allow_cornering)) {
2112 actor->poscxx . . $ $anonymous_type_5882ab293b255284_10#pos. = movecxx . . $ move(7ca2b540d4e558c8).(actor->poscxx . . $ $anonymous_type_5882ab293b255284_10#pos., actor->dircxx . . $ $anonymous_type_5882ab293b255284_10#dir., allow_cornering);
2113 actor->anim_tickcxx . . $ $anonymous_type_5882ab293b255284_10#anim_tick.++;
2114 }
2115 // eat dot or energizer pill?
2116 const int2_tcxx . . $ int2_t# tile_pos = pixel_to_tile_poscxx . . $ pixel_to_tile_pos(b51706a12be1efba).(actor->poscxx . . $ $anonymous_type_5882ab293b255284_10#pos.);
2117 if (is_dotcxx . . $ is_dot(d0e5793988c1450e).(tile_pos)) {
2118 vid_tilecxx . . $ vid_tile(d0277b7ce0ae0949).(tile_pos, TILE_SPACEcxx . . $ TILE_SPACE.);
2119 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..scorecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#score. += 1;
2120 startcxx . . $ start(cb52e61069a1301a).(&statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..dot_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#dot_eaten.);
2121 startcxx . . $ start(cb52e61069a1301a).(&statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..force_leave_housecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#force_leave_house.);
2122 game_update_dots_eatencxx . . $ game_update_dots_eaten(49f6e7a06ebc5aa8).();
2123 game_update_ghosthouse_dot_counterscxx . . $ game_update_ghosthouse_dot_counters(49f6e7a06ebc5aa8).();
2124 }
2125 if (is_pillcxx . . $ is_pill(d0e5793988c1450e).(tile_pos)) {
2126 vid_tilecxx . . $ vid_tile(d0277b7ce0ae0949).(tile_pos, TILE_SPACEcxx . . $ TILE_SPACE.);
2127 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..scorecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#score. += 5;
2128 game_update_dots_eatencxx . . $ game_update_dots_eaten(49f6e7a06ebc5aa8).();
2129 startcxx . . $ start(cb52e61069a1301a).(&statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..pill_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#pill_eaten.);
2130 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..num_ghosts_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#num_ghosts_eaten. = 0;
2131 for (int i = 0; i < NUM_GHOSTScxx . . $ NUM_GHOSTS.; i++) {
2132 startcxx . . $ start(cb52e61069a1301a).(&statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..ghostcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#ghost.[i].frightenedcxx . . $ $anonymous_type_5882ab293b255284_11#frightened.);
2133 }
2134 snd_startcxx . . $ snd_start(eb66bf3bee49480).(1, &snd_frightenedcxx . . $ snd_frightened.);
2135 }
2136 // check if Pacman eats the bonus fruit
2137 if (statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..active_fruitcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#active_fruit. != FRUIT_NONEcxx . . $ FRUIT_NONE.) {
2138 const int2_tcxx . . $ int2_t# test_pos = pixel_to_tile_poscxx . . $ pixel_to_tile_pos(b51706a12be1efba).(add_i2cxx . . $ add_i2(ac5d9af22ed1a482).(actor->poscxx . . $ $anonymous_type_5882ab293b255284_10#pos., i2cxx . . $ i2(104fe1df0a7d588d).(TILE_WIDTHcxx . . $ `pacman.c:167:9`!/2, 0)));
2139 if (equal_i2cxx . . $ equal_i2(b023337e602d1a6b).(test_pos, i2cxx . . $ i2(104fe1df0a7d588d).(14, 20))) {
2140 startcxx . . $ start(cb52e61069a1301a).(&statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..fruit_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#fruit_eaten.);
2141 uint32_tcxx . . $ uint32_t# score = levelspeccxx . . $ levelspec(f1bb36f57ae1f872).(statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..roundcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#round.).bonus_scorecxx . . $ $anonymous_type_5882ab293b255284_29#bonus_score.;
2142 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..scorecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#score. += score;
2143 vid_fruit_scorecxx . . $ vid_fruit_score(9b774b9e6e7fe522).(statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..active_fruitcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#active_fruit.);
2144 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..active_fruitcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#active_fruit. = FRUIT_NONEcxx . . $ FRUIT_NONE.;
2145 snd_startcxx . . $ snd_start(eb66bf3bee49480).(2, &snd_eatfruitcxx . . $ snd_eatfruit.);
2146 }
2147 }
2148 // check if Pacman collides with any ghost
2149 for (int i = 0; i < NUM_GHOSTScxx . . $ NUM_GHOSTS.; i++) {
2150 ghost_tcxx . . $ ghost_t#* ghost = &statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..ghostcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#ghost.[i];
2151 const int2_tcxx . . $ int2_t# ghost_tile_pos = pixel_to_tile_poscxx . . $ pixel_to_tile_pos(b51706a12be1efba).(ghost->actorcxx . . $ $anonymous_type_5882ab293b255284_11#actor..poscxx . . $ $anonymous_type_5882ab293b255284_10#pos.);
2152 if (equal_i2cxx . . $ equal_i2(b023337e602d1a6b).(tile_pos, ghost_tile_pos)) {
2153 if (ghost->statecxx . . $ $anonymous_type_5882ab293b255284_11#state. == GHOSTSTATE_FRIGHTENEDcxx . . $ GHOSTSTATE_FRIGHTENED.) {
2154 // Pacman eats a frightened ghost
2155 ghost->statecxx . . $ $anonymous_type_5882ab293b255284_11#state. = GHOSTSTATE_EYEScxx . . $ GHOSTSTATE_EYES.;
2156 startcxx . . $ start(cb52e61069a1301a).(&ghost->eatencxx . . $ $anonymous_type_5882ab293b255284_11#eaten.);
2157 startcxx . . $ start(cb52e61069a1301a).(&statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..ghost_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#ghost_eaten.);
2158 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..num_ghosts_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#num_ghosts_eaten.++;
2159 // increase score by 20, 40, 80, 160
2160 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..scorecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#score. += 10 * (1<<statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..num_ghosts_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#num_ghosts_eaten.);
2161 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..freezecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#freeze. |= FREEZETYPE_EAT_GHOSTcxx . . $ FREEZETYPE_EAT_GHOST.;
2162 snd_startcxx . . $ snd_start(eb66bf3bee49480).(2, &snd_eatghostcxx . . $ snd_eatghost.);
2163 }
2164 else if ((ghost->statecxx . . $ $anonymous_type_5882ab293b255284_11#state. == GHOSTSTATE_CHASEcxx . . $ GHOSTSTATE_CHASE.) || (ghost->statecxx . . $ $anonymous_type_5882ab293b255284_11#state. == GHOSTSTATE_SCATTERcxx . . $ GHOSTSTATE_SCATTER.)) {
2165 // otherwise, ghost eats Pacman, Pacman loses a life
2166 #if !DBG_GODMODEcxx . . $ `pacman.c:150:9`!
2167 snd_clearcxx . . $ snd_clear(49f6e7a06ebc5aa8).();
2168 startcxx . . $ start(cb52e61069a1301a).(&statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..pacman_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#pacman_eaten.);
2169 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..freezecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#freeze. |= FREEZETYPE_DEADcxx . . $ FREEZETYPE_DEAD.;
2170 // if Pacman has any lives left start a new round, otherwise start the game-over sequence
2171 if (statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..num_livescxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#num_lives. > 0) {
2172 start_aftercxx . . $ start_after(ddc23952494785a4).(&statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..ready_startedcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#ready_started., PACMAN_EATEN_TICKScxx . . $ `pacman.c:188:9`!+PACMAN_DEATH_TICKScxx . . $ `pacman.c:189:9`!);
2173 }
2174 else {
2175 start_aftercxx . . $ start_after(ddc23952494785a4).(&statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..game_overcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#game_over., PACMAN_EATEN_TICKScxx . . $ `pacman.c:188:9`!+PACMAN_DEATH_TICKScxx . . $ `pacman.c:189:9`!);
2176 }
2177 #endif
2178 }
2179 }
2180 }
2181 }
2182
2183 // Ghost "AIs"
2184 for (int ghost_index = 0; ghost_index < NUM_GHOSTScxx . . $ NUM_GHOSTS.; ghost_index++) {
2185 ghost_tcxx . . $ ghost_t#* ghost = &statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..ghostcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#ghost.[ghost_index];
2186 // handle ghost-state transitions
2187 game_update_ghost_statecxx . . $ game_update_ghost_state(d614ff93e79cb077).(ghost);
2188 // update the ghost's target position
2189 game_update_ghost_targetcxx . . $ game_update_ghost_target(d614ff93e79cb077).(ghost);
2190 // finally, move the ghost towards the current target position
2191 const int num_move_ticks = game_ghost_speedcxx . . $ game_ghost_speed(8bec379df5c2323d).(ghost);
2192 for (int i = 0; i < num_move_ticks; i++) {
2193 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! force_move = game_update_ghost_dircxx . . $ game_update_ghost_dir(419ad0d6c5260fff).(ghost);
2194 actor_tcxx . . $ actor_t#* actor = &ghost->actorcxx . . $ $anonymous_type_5882ab293b255284_11#actor.;
2195 const boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! allow_cornering = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
2196 if (force_move || can_movecxx . . $ can_move(f7aadfae283f4f5d).(actor->poscxx . . $ $anonymous_type_5882ab293b255284_10#pos., actor->dircxx . . $ $anonymous_type_5882ab293b255284_10#dir., allow_cornering)) {
2197 actor->poscxx . . $ $anonymous_type_5882ab293b255284_10#pos. = movecxx . . $ move(7ca2b540d4e558c8).(actor->poscxx . . $ $anonymous_type_5882ab293b255284_10#pos., actor->dircxx . . $ $anonymous_type_5882ab293b255284_10#dir., allow_cornering);
2198 actor->anim_tickcxx . . $ $anonymous_type_5882ab293b255284_10#anim_tick.++;
2199 }
2200 }
2201 }
2202 }
2203
2204 // the central game tick function, called at 60 Hz
2205 static void game_tickcxx . . $ game_tick(49f6e7a06ebc5aa8).(void) {
2206 // debug: skip prelude
2207 #if DBG_SKIP_PRELUDEcxx . . $ `pacman.c:145:9`!
2208 const int prelude_ticks_per_sec = 1;
2209 #else
2210 const int prelude_ticks_per_sec = 60;
2211 #endif
2212
2213 // initialize game state once
2214 if (nowcxx . . $ now(e8d67d8f61cbb831).(statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..startedcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#started.)) {
2215 startcxx . . $ start(cb52e61069a1301a).(&statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..fadeincxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#fadein.);
2216 start_aftercxx . . $ start_after(ddc23952494785a4).(&statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..ready_startedcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#ready_started., 2*prelude_ticks_per_sec);
2217 snd_startcxx . . $ snd_start(eb66bf3bee49480).(0, &snd_preludecxx . . $ snd_prelude.);
2218 game_initcxx . . $ game_init(49f6e7a06ebc5aa8).();
2219 }
2220 // initialize new round (each time Pacman looses a life), make actors visible, remove "PLAYER ONE", start a new life
2221 if (nowcxx . . $ now(e8d67d8f61cbb831).(statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..ready_startedcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#ready_started.)) {
2222 game_round_initcxx . . $ game_round_init(49f6e7a06ebc5aa8).();
2223 // after 2 seconds start the interactive game loop
2224 start_aftercxx . . $ start_after(ddc23952494785a4).(&statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..round_startedcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#round_started., 2*60+10);
2225 }
2226 if (nowcxx . . $ now(e8d67d8f61cbb831).(statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..round_startedcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#round_started.)) {
2227 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..freezecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#freeze. &= ~FREEZETYPE_READYcxx . . $ FREEZETYPE_READY.;
2228 // clear the 'READY!' message
2229 vid_color_textcxx . . $ vid_color_text(ed5b0a47fa0fc189).(i2cxx . . $ i2(104fe1df0a7d588d).(11,20), 0x10, " ");
2230 snd_startcxx . . $ snd_start(eb66bf3bee49480).(1, &snd_weeoohcxx . . $ snd_weeooh.);
2231 }
2232
2233 // activate/deactivate bonus fruit
2234 if (nowcxx . . $ now(e8d67d8f61cbb831).(statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..fruit_activecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#fruit_active.)) {
2235 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..active_fruitcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#active_fruit. = levelspeccxx . . $ levelspec(f1bb36f57ae1f872).(statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..roundcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#round.).bonus_fruitcxx . . $ $anonymous_type_5882ab293b255284_29#bonus_fruit.;
2236 }
2237 else if (after_oncecxx . . $ after_once(83b89002639f1b8c).(statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..fruit_activecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#fruit_active., FRUITACTIVE_TICKScxx . . $ `pacman.c:192:9`!)) {
2238 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..active_fruitcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#active_fruit. = FRUIT_NONEcxx . . $ FRUIT_NONE.;
2239 }
2240
2241 // stop frightened sound and start weeooh sound
2242 if (after_oncecxx . . $ after_once(83b89002639f1b8c).(statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..pill_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#pill_eaten., levelspeccxx . . $ levelspec(f1bb36f57ae1f872).(statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..roundcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#round.).fright_tickscxx . . $ $anonymous_type_5882ab293b255284_29#fright_ticks.)) {
2243 snd_startcxx . . $ snd_start(eb66bf3bee49480).(1, &snd_weeoohcxx . . $ snd_weeooh.);
2244 }
2245
2246 // if game is frozen because Pacman ate a ghost, unfreeze after a while
2247 if (statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..freezecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#freeze. & FREEZETYPE_EAT_GHOSTcxx . . $ FREEZETYPE_EAT_GHOST.) {
2248 if (after_oncecxx . . $ after_once(83b89002639f1b8c).(statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..ghost_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#ghost_eaten., GHOST_EATEN_FREEZE_TICKScxx . . $ `pacman.c:187:9`!)) {
2249 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..freezecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#freeze. &= ~FREEZETYPE_EAT_GHOSTcxx . . $ FREEZETYPE_EAT_GHOST.;
2250 }
2251 }
2252
2253 // play pacman-death sound
2254 if (after_oncecxx . . $ after_once(83b89002639f1b8c).(statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..pacman_eatencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#pacman_eaten., PACMAN_EATEN_TICKScxx . . $ `pacman.c:188:9`!)) {
2255 snd_startcxx . . $ snd_start(eb66bf3bee49480).(2, &snd_deadcxx . . $ snd_dead.);
2256 }
2257
2258 // the actually important part: update Pacman and ghosts, update dynamic
2259 // background tiles, and update the sprite images
2260 if (!statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..freezecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#freeze.) {
2261 game_update_actorscxx . . $ game_update_actors(49f6e7a06ebc5aa8).();
2262 }
2263 game_update_tilescxx . . $ game_update_tiles(49f6e7a06ebc5aa8).();
2264 game_update_spritescxx . . $ game_update_sprites(49f6e7a06ebc5aa8).();
2265
2266 // update hiscore
2267 if (statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..scorecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#score. > statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..hiscorecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#hiscore.) {
2268 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..hiscorecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#hiscore. = statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..scorecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#score.;
2269 }
2270
2271 // check for end-round condition
2272 if (nowcxx . . $ now(e8d67d8f61cbb831).(statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..round_woncxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#round_won.)) {
2273 statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..freezecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#freeze. |= FREEZETYPE_WONcxx . . $ FREEZETYPE_WON.;
2274 start_aftercxx . . $ start_after(ddc23952494785a4).(&statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..ready_startedcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#ready_started., ROUNDWON_TICKScxx . . $ `pacman.c:191:9`!);
2275 }
2276 if (nowcxx . . $ now(e8d67d8f61cbb831).(statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..game_overcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#game_over.)) {
2277 // display game over string
2278 vid_color_textcxx . . $ vid_color_text(ed5b0a47fa0fc189).(i2cxx . . $ i2(104fe1df0a7d588d).(9,20), 0x01, "GAME OVER");
2279 input_disablecxx . . $ input_disable(49f6e7a06ebc5aa8).();
2280 start_aftercxx . . $ start_after(ddc23952494785a4).(&statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..fadeoutcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#fadeout., GAMEOVER_TICKScxx . . $ `pacman.c:190:9`!);
2281 start_aftercxx . . $ start_after(ddc23952494785a4).(&statecxx . . $ state..introcxx . . $ $anonymous_type_5882ab293b255284_20#intro..startedcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_22#started., GAMEOVER_TICKScxx . . $ `pacman.c:190:9`!+FADE_TICKScxx . . $ `pacman.c:180:9`!);
2282 }
2283
2284 #if DBG_ESCAPEcxx . . $ `pacman.c:148:9`!
2285 if (state.input.esc) {
2286 input_disable();
2287 start(&state.gfx.fadeout);
2288 start_after(&state.intro.started, FADE_TICKS);
2289 }
2290 #endif
2291
2292 #if DBG_MARKERScxx . . $ `pacman.c:147:9`!
2293 // visualize current ghost targets
2294 for (int i = 0; i < NUM_GHOSTS; i++) {
2295 const ghost_t* ghost = &state.game.ghost[i];
2296 uint8_t tile = 'X';
2297 switch (ghost->state) {
2298 case GHOSTSTATE_NONE: tile = 'N'; break;
2299 case GHOSTSTATE_CHASE: tile = 'C'; break;
2300 case GHOSTSTATE_SCATTER: tile = 'S'; break;
2301 case GHOSTSTATE_FRIGHTENED: tile = 'F'; break;
2302 case GHOSTSTATE_EYES: tile = 'E'; break;
2303 case GHOSTSTATE_HOUSE: tile = 'H'; break;
2304 case GHOSTSTATE_LEAVEHOUSE: tile = 'L'; break;
2305 case GHOSTSTATE_ENTERHOUSE: tile = 'E'; break;
2306 }
2307 dbg_marker(i, state.game.ghost[i].target_pos, tile, COLOR_BLINKY+2*i);
2308 }
2309 #endif
2310 }
2311
2312 /*== INTRO GAMESTATE CODE ====================================================*/
2313
2314 static void intro_tickcxx . . $ intro_tick(49f6e7a06ebc5aa8).(void) {
2315
2316 // on intro-state enter, enable input and draw any initial text
2317 if (nowcxx . . $ now(e8d67d8f61cbb831).(statecxx . . $ state..introcxx . . $ $anonymous_type_5882ab293b255284_20#intro..startedcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_22#started.)) {
2318 snd_clearcxx . . $ snd_clear(49f6e7a06ebc5aa8).();
2319 spr_clearcxx . . $ spr_clear(49f6e7a06ebc5aa8).();
2320 startcxx . . $ start(cb52e61069a1301a).(&statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..fadeincxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#fadein.);
2321 input_enablecxx . . $ input_enable(49f6e7a06ebc5aa8).();
2322 vid_clearcxx . . $ vid_clear(8fbe6856f5410d23).(TILE_SPACEcxx . . $ TILE_SPACE., COLOR_DEFAULTcxx . . $ COLOR_DEFAULT.);
2323 vid_textcxx . . $ vid_text(d655b391316be79a).(i2cxx . . $ i2(104fe1df0a7d588d).(3,0), "1UP HIGH SCORE 2UP");
2324 vid_color_scorecxx . . $ vid_color_score(117c4a0e4f628d0f).(i2cxx . . $ i2(104fe1df0a7d588d).(6,1), COLOR_DEFAULTcxx . . $ COLOR_DEFAULT., 0);
2325 if (statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..hiscorecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#hiscore. > 0) {
2326 vid_color_scorecxx . . $ vid_color_score(117c4a0e4f628d0f).(i2cxx . . $ i2(104fe1df0a7d588d).(16,1), COLOR_DEFAULTcxx . . $ COLOR_DEFAULT., statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..hiscorecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#hiscore.);
2327 }
2328 vid_textcxx . . $ vid_text(d655b391316be79a).(i2cxx . . $ i2(104fe1df0a7d588d).(7,5), "CHARACTER / NICKNAME");
2329 vid_textcxx . . $ vid_text(d655b391316be79a).(i2cxx . . $ i2(104fe1df0a7d588d).(3,35), "CREDIT 0");
2330 }
2331
2332 // draw the animated 'ghost image.. name.. nickname' lines
2333 uint32_tcxx . . $ uint32_t# delay = 30;
2334 const char* names[] = { "-SHADOW", "-SPEEDY", "-BASHFUL", "-POKEY" };
2335 const char* nicknames[] = { "BLINKY", "PINKY", "INKY", "CLYDE" };
2336 for (int i = 0; i < 4; i++) {
2337 const uint8_tcxx . . $ uint8_t# color = 2*i + 1;
2338 const uint8_tcxx . . $ uint8_t# y = 3*i + 6;
2339 // 2*3 ghost image created from tiles (no sprite!)
2340 delay += 30;
2341 if (after_oncecxx . . $ after_once(83b89002639f1b8c).(statecxx . . $ state..introcxx . . $ $anonymous_type_5882ab293b255284_20#intro..startedcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_22#started., delay)) {
2342 vid_color_tilecxx . . $ vid_color_tile(4a7eff1d41ff13be).(i2cxx . . $ i2(104fe1df0a7d588d).(4,y+0), color, TILE_GHOSTcxx . . $ TILE_GHOST.+0); vid_color_tilecxx . . $ vid_color_tile(4a7eff1d41ff13be).(i2cxx . . $ i2(104fe1df0a7d588d).(5,y+0), color, TILE_GHOSTcxx . . $ TILE_GHOST.+1);
2343 vid_color_tilecxx . . $ vid_color_tile(4a7eff1d41ff13be).(i2cxx . . $ i2(104fe1df0a7d588d).(4,y+1), color, TILE_GHOSTcxx . . $ TILE_GHOST.+2); vid_color_tilecxx . . $ vid_color_tile(4a7eff1d41ff13be).(i2cxx . . $ i2(104fe1df0a7d588d).(5,y+1), color, TILE_GHOSTcxx . . $ TILE_GHOST.+3);
2344 vid_color_tilecxx . . $ vid_color_tile(4a7eff1d41ff13be).(i2cxx . . $ i2(104fe1df0a7d588d).(4,y+2), color, TILE_GHOSTcxx . . $ TILE_GHOST.+4); vid_color_tilecxx . . $ vid_color_tile(4a7eff1d41ff13be).(i2cxx . . $ i2(104fe1df0a7d588d).(5,y+2), color, TILE_GHOSTcxx . . $ TILE_GHOST.+5);
2345 }
2346 // after 1 second, the name of the ghost
2347 delay += 60;
2348 if (after_oncecxx . . $ after_once(83b89002639f1b8c).(statecxx . . $ state..introcxx . . $ $anonymous_type_5882ab293b255284_20#intro..startedcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_22#started., delay)) {
2349 vid_color_textcxx . . $ vid_color_text(ed5b0a47fa0fc189).(i2cxx . . $ i2(104fe1df0a7d588d).(7,y+1), color, names[i]);
2350 }
2351 // after 0.5 seconds, the nickname of the ghost
2352 delay += 30;
2353 if (after_oncecxx . . $ after_once(83b89002639f1b8c).(statecxx . . $ state..introcxx . . $ $anonymous_type_5882ab293b255284_20#intro..startedcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_22#started., delay)) {
2354 vid_color_textcxx . . $ vid_color_text(ed5b0a47fa0fc189).(i2cxx . . $ i2(104fe1df0a7d588d).(17,y+1), color, nicknames[i]);
2355 }
2356 }
2357
2358 // . 10 PTS
2359 // O 50 PTS
2360 delay += 60;
2361 if (after_oncecxx . . $ after_once(83b89002639f1b8c).(statecxx . . $ state..introcxx . . $ $anonymous_type_5882ab293b255284_20#intro..startedcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_22#started., delay)) {
2362 vid_color_tilecxx . . $ vid_color_tile(4a7eff1d41ff13be).(i2cxx . . $ i2(104fe1df0a7d588d).(10,24), COLOR_DOTcxx . . $ COLOR_DOT., TILE_DOTcxx . . $ TILE_DOT.);
2363 vid_textcxx . . $ vid_text(d655b391316be79a).(i2cxx . . $ i2(104fe1df0a7d588d).(12,24), "10 \x5D\x5E\x5F");
2364 vid_color_tilecxx . . $ vid_color_tile(4a7eff1d41ff13be).(i2cxx . . $ i2(104fe1df0a7d588d).(10,26), COLOR_DOTcxx . . $ COLOR_DOT., TILE_PILLcxx . . $ TILE_PILL.);
2365 vid_textcxx . . $ vid_text(d655b391316be79a).(i2cxx . . $ i2(104fe1df0a7d588d).(12,26), "50 \x5D\x5E\x5F");
2366 }
2367
2368 // blinking "press any key" text
2369 delay += 60;
2370 if (aftercxx . . $ after(83b89002639f1b8c).(statecxx . . $ state..introcxx . . $ $anonymous_type_5882ab293b255284_20#intro..startedcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_22#started., delay)) {
2371 if (sincecxx . . $ since(2687634081d878c4).(statecxx . . $ state..introcxx . . $ $anonymous_type_5882ab293b255284_20#intro..startedcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_22#started.) & 0x20) {
2372 vid_color_textcxx . . $ vid_color_text(ed5b0a47fa0fc189).(i2cxx . . $ i2(104fe1df0a7d588d).(3,31), 3, " ");
2373 }
2374 else {
2375 vid_color_textcxx . . $ vid_color_text(ed5b0a47fa0fc189).(i2cxx . . $ i2(104fe1df0a7d588d).(3,31), 3, "PRESS ANY KEY TO START!");
2376 }
2377 }
2378
2379 // FIXME: animated chase sequence
2380
2381 // if a key is pressed, advance to game state
2382 if (statecxx . . $ state..inputcxx . . $ $anonymous_type_5882ab293b255284_20#input..anykeycxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_24#anykey.) {
2383 input_disablecxx . . $ input_disable(49f6e7a06ebc5aa8).();
2384 startcxx . . $ start(cb52e61069a1301a).(&statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..fadeoutcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#fadeout.);
2385 start_aftercxx . . $ start_after(ddc23952494785a4).(&statecxx . . $ state..gamecxx . . $ $anonymous_type_5882ab293b255284_20#game..startedcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_23#started., FADE_TICKScxx . . $ `pacman.c:180:9`!);
2386 }
2387 }
2388
2389 /*== GFX SUBSYSTEM ===========================================================*/
2390
2391 /* create all sokol-gfx resources */
2392 static void gfx_create_resourcescxx . . $ gfx_create_resources(49f6e7a06ebc5aa8).(void) {
2393 // pass action for clearing the background to black
2394 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..pass_actioncxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#pass_action. = (sg_pass_actioncxx . . $ sg_pass_action#) {
2395 .colors[0] = { .load_action = SG_LOADACTION_CLEARcxx . . $ SG_LOADACTION_CLEAR., .clear_value = { 0.0f, 0.0f, 0.0f, 1.0f } }
2396 };
2397
2398 // create a dynamic vertex buffer for the tile and sprite quads
2399 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..offscreencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#offscreen..vbufcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_27#vbuf. = sg_make_buffercxx . . $ sg_make_buffer(5efb77b03fd1b393).(&(sg_buffer_desccxx . . $ sg_buffer_desc#){
2400 .type = SG_BUFFERTYPE_VERTEXBUFFERcxx . . $ SG_BUFFERTYPE_VERTEXBUFFER.,
2401 .usage = SG_USAGE_STREAMcxx . . $ SG_USAGE_STREAM.,
2402 .size = sizeof(statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..verticescxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#vertices.),
2403 });
2404
2405 // create a simple quad vertex buffer for rendering the offscreen render target to the display
2406 float quad_verts[]= { 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f };
2407 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..displaycxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#display..quad_vbufcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_28#quad_vbuf. = sg_make_buffercxx . . $ sg_make_buffer(5efb77b03fd1b393).(&(sg_buffer_desccxx . . $ sg_buffer_desc#){
2408 .data = SG_RANGEcxx . . $ `sokol/sokol_gfx.h:1634:9`!(quad_verts)
2409 });
2410
2411 // shader sources for all platforms (FIXME: should we use precompiled shader blobs instead?)
2412 const char* offscreen_vs_src = 0;
2413 const char* offscreen_fs_src = 0;
2414 const char* display_vs_src = 0;
2415 const char* display_fs_src = 0;
2416 switch (sg_query_backendcxx . . $ sg_query_backend(4679d869a1a56231).()) {
2417 case SG_BACKEND_METAL_MACOScxx . . $ SG_BACKEND_METAL_MACOS.:
2418 offscreen_vs_src =
2419 "#include <metal_stdlib>\n"
2420 "using namespace metal;\n"
2421 "struct vs_in {\n"
2422 " float4 pos [[attribute(0)]];\n"
2423 " float2 uv [[attribute(1)]];\n"
2424 " float4 data [[attribute(2)]];\n"
2425 "};\n"
2426 "struct vs_out {\n"
2427 " float4 pos [[position]];\n"
2428 " float2 uv;\n"
2429 " float4 data;\n"
2430 "};\n"
2431 "vertex vs_out _main(vs_in in [[stage_in]]) {\n"
2432 " vs_out out;\n"
2433 " out.pos = float4((in.pos.xy - 0.5) * float2(2.0, -2.0), 0.5, 1.0);\n"
2434 " out.uv = in.uv;"
2435 " out.data = in.data;\n"
2436 " return out;\n"
2437 "}\n";
2438 offscreen_fs_src =
2439 "#include <metal_stdlib>\n"
2440 "using namespace metal;\n"
2441 "struct ps_in {\n"
2442 " float2 uv;\n"
2443 " float4 data;\n"
2444 "};\n"
2445 "fragment float4 _main(ps_in in [[stage_in]],\n"
2446 " texture2d<float> tile_tex [[texture(0)]],\n"
2447 " texture2d<float> pal_tex [[texture(1)]],\n"
2448 " sampler tile_smp [[sampler(0)]],\n"
2449 " sampler pal_smp [[sampler(1)]])\n"
2450 "{\n"
2451 " float color_code = in.data.x;\n" // (0..31) / 255
2452 " float tile_color = tile_tex.sample(tile_smp, in.uv).x;\n" // (0..3) / 255
2453 " float2 pal_uv = float2(color_code * 4 + tile_color, 0);\n"
2454 " float4 color = pal_tex.sample(pal_smp, pal_uv) * float4(1, 1, 1, in.data.y);\n"
2455 " return color;\n"
2456 "}\n";
2457 display_vs_src =
2458 "#include <metal_stdlib>\n"
2459 "using namespace metal;\n"
2460 "struct vs_in {\n"
2461 " float4 pos [[attribute(0)]];\n"
2462 "};\n"
2463 "struct vs_out {\n"
2464 " float4 pos [[position]];\n"
2465 " float2 uv;\n"
2466 "};\n"
2467 "vertex vs_out _main(vs_in in[[stage_in]]) {\n"
2468 " vs_out out;\n"
2469 " out.pos = float4((in.pos.xy - 0.5) * float2(2.0, -2.0), 0.0, 1.0);\n"
2470 " out.uv = in.pos.xy;\n"
2471 " return out;\n"
2472 "}\n";
2473 display_fs_src =
2474 "#include <metal_stdlib>\n"
2475 "using namespace metal;\n"
2476 "struct ps_in {\n"
2477 " float2 uv;\n"
2478 "};\n"
2479 "fragment float4 _main(ps_in in [[stage_in]],\n"
2480 " texture2d<float> tex [[texture(0)]],\n"
2481 " sampler smp [[sampler(0)]])\n"
2482 "{\n"
2483 " return tex.sample(smp, in.uv);\n"
2484 "}\n";
2485 break;
2486 case SG_BACKEND_D3D11cxx . . $ SG_BACKEND_D3D11.:
2487 offscreen_vs_src =
2488 "struct vs_in {\n"
2489 " float4 pos: POSITION;\n"
2490 " float2 uv: TEXCOORD0;\n"
2491 " float4 data: TEXCOORD1;\n"
2492 "};\n"
2493 "struct vs_out {\n"
2494 " float2 uv: UV;\n"
2495 " float4 data: DATA;\n"
2496 " float4 pos: SV_Position;\n"
2497 "};\n"
2498 "vs_out main(vs_in inp) {\n"
2499 " vs_out outp;"
2500 " outp.pos = float4(inp.pos.xy * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);\n"
2501 " outp.uv = inp.uv;"
2502 " outp.data = inp.data;\n"
2503 " return outp;\n"
2504 "}\n";
2505 offscreen_fs_src =
2506 "Texture2D<float4> tile_tex: register(t0);\n"
2507 "Texture2D<float4> pal_tex: register(t1);\n"
2508 "sampler tile_smp: register(s0);\n"
2509 "sampler pal_smp: register(s1);\n"
2510 "float4 main(float2 uv: UV, float4 data: DATA): SV_Target0 {\n"
2511 " float color_code = data.x;\n"
2512 " float tile_color = tile_tex.Sample(tile_smp, uv).x;\n"
2513 " float2 pal_uv = float2(color_code * 4 + tile_color, 0);\n"
2514 " float4 color = pal_tex.Sample(pal_smp, pal_uv) * float4(1, 1, 1, data.y);\n"
2515 " return color;\n"
2516 "}\n";
2517 display_vs_src =
2518 "struct vs_out {\n"
2519 " float2 uv: UV;\n"
2520 " float4 pos: SV_Position;\n"
2521 "};\n"
2522 "vs_out main(float4 pos: POSITION) {\n"
2523 " vs_out outp;\n"
2524 " outp.pos = float4((pos.xy - 0.5) * float2(2.0, -2.0), 0.0, 1.0);\n"
2525 " outp.uv = pos.xy;\n"
2526 " return outp;\n"
2527 "}\n";
2528 display_fs_src =
2529 "Texture2D<float4> tex: register(t0);\n"
2530 "sampler smp: register(s0);\n"
2531 "float4 main(float2 uv: UV): SV_Target0 {\n"
2532 " return tex.Sample(smp, uv);\n"
2533 "}\n";
2534 break;
2535 case SG_BACKEND_GLCOREcxx . . $ SG_BACKEND_GLCORE.:
2536 offscreen_vs_src =
2537 "#version 410\n"
2538 "layout(location=0) in vec4 pos;\n"
2539 "layout(location=1) in vec2 uv_in;\n"
2540 "layout(location=2) in vec4 data_in;\n"
2541 "out vec2 uv;\n"
2542 "out vec4 data;\n"
2543 "void main() {\n"
2544 " gl_Position = vec4((pos.xy - 0.5) * vec2(2.0, -2.0), 0.5, 1.0);\n"
2545 " uv = uv_in;"
2546 " data = data_in;\n"
2547 "}\n";
2548 offscreen_fs_src =
2549 "#version 410\n"
2550 "uniform sampler2D tile_tex;\n"
2551 "uniform sampler2D pal_tex;\n"
2552 "in vec2 uv;\n"
2553 "in vec4 data;\n"
2554 "out vec4 frag_color;\n"
2555 "void main() {\n"
2556 " float color_code = data.x;\n"
2557 " float tile_color = texture(tile_tex, uv).x;\n"
2558 " vec2 pal_uv = vec2(color_code * 4 + tile_color, 0);\n"
2559 " frag_color = texture(pal_tex, pal_uv) * vec4(1, 1, 1, data.y);\n"
2560 "}\n";
2561 display_vs_src =
2562 "#version 410\n"
2563 "layout(location=0) in vec4 pos;\n"
2564 "out vec2 uv;\n"
2565 "void main() {\n"
2566 " gl_Position = vec4((pos.xy - 0.5) * 2.0, 0.0, 1.0);\n"
2567 " uv = pos.xy;\n"
2568 "}\n";
2569 display_fs_src =
2570 "#version 410\n"
2571 "uniform sampler2D tex;\n"
2572 "in vec2 uv;\n"
2573 "out vec4 frag_color;\n"
2574 "void main() {\n"
2575 " frag_color = texture(tex, uv);\n"
2576 "}\n";
2577 break;
2578 case SG_BACKEND_GLES3cxx . . $ SG_BACKEND_GLES3.:
2579 offscreen_vs_src =
2580 "attribute vec4 pos;\n"
2581 "attribute vec2 uv_in;\n"
2582 "attribute vec4 data_in;\n"
2583 "varying vec2 uv;\n"
2584 "varying vec4 data;\n"
2585 "void main() {\n"
2586 " gl_Position = vec4((pos.xy - 0.5) * vec2(2.0, -2.0), 0.5, 1.0);\n"
2587 " uv = uv_in;"
2588 " data = data_in;\n"
2589 "}\n";
2590 offscreen_fs_src =
2591 "precision mediump float;\n"
2592 "uniform sampler2D tile_tex;\n"
2593 "uniform sampler2D pal_tex;\n"
2594 "varying vec2 uv;\n"
2595 "varying vec4 data;\n"
2596 "void main() {\n"
2597 " float color_code = data.x;\n"
2598 " float tile_color = texture2D(tile_tex, uv).x;\n"
2599 " vec2 pal_uv = vec2(color_code * 4.0 + tile_color, 0.0);\n"
2600 " gl_FragColor = texture2D(pal_tex, pal_uv) * vec4(1.0, 1.0, 1.0, data.y);\n"
2601 "}\n";
2602 display_vs_src =
2603 "attribute vec4 pos;\n"
2604 "varying vec2 uv;\n"
2605 "void main() {\n"
2606 " gl_Position = vec4((pos.xy - 0.5) * 2.0, 0.0, 1.0);\n"
2607 " uv = pos.xy;\n"
2608 "}\n";
2609 display_fs_src =
2610 "precision mediump float;\n"
2611 "uniform sampler2D tex;\n"
2612 "varying vec2 uv;\n"
2613 "void main() {\n"
2614 " gl_FragColor = texture2D(tex, uv);\n"
2615 "}\n";
2616 break;
2617 default:
2618 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!);
2619 }
2620
2621 // create pipeline and shader object for rendering into offscreen render target
2622 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..offscreencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#offscreen..pipcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_27#pip. = sg_make_pipelinecxx . . $ sg_make_pipeline(6e5e446a35687b83).(&(sg_pipeline_desccxx . . $ sg_pipeline_desc#){
2623 .shader = sg_make_shadercxx . . $ sg_make_shader(ab0d6bdcaa5aceeb).(&(sg_shader_desccxx . . $ sg_shader_desc#){
2624 .attrs = {
2625 [0] = { .name="pos", .sem_name="POSITION" },
2626 [1] = { .name="uv_in", .sem_name="TEXCOORD", .sem_index=0 },
2627 [2] = { .name="data_in", .sem_name="TEXCOORD", .sem_index=1 },
2628 },
2629 .vs.source = offscreen_vs_src,
2630 .fs = {
2631 .images = {
2632 [0] = { .used = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`! },
2633 [1] = { .used = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`! },
2634 },
2635 .samplers = {
2636 [0] = { .used = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`! },
2637 [1] = { .used = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`! },
2638 },
2639 .image_sampler_pairs = {
2640 [0] = { .used = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, .image_slot = 0, .sampler_slot = 0, .glsl_name = "tile_tex" },
2641 [1] = { .used = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, .image_slot = 1, .sampler_slot = 1, .glsl_name = "pal_tex" },
2642 },
2643 .source = offscreen_fs_src
2644 }
2645 }),
2646 .layout = {
2647 .attrs = {
2648 [0].format = SG_VERTEXFORMAT_FLOAT2cxx . . $ SG_VERTEXFORMAT_FLOAT2.,
2649 [1].format = SG_VERTEXFORMAT_FLOAT2cxx . . $ SG_VERTEXFORMAT_FLOAT2.,
2650 [2].format = SG_VERTEXFORMAT_UBYTE4Ncxx . . $ SG_VERTEXFORMAT_UBYTE4N.,
2651 }
2652 },
2653 .depth.pixel_format = SG_PIXELFORMAT_NONEcxx . . $ SG_PIXELFORMAT_NONE.,
2654 .colors[0] = {
2655 .pixel_format = SG_PIXELFORMAT_RGBA8cxx . . $ SG_PIXELFORMAT_RGBA8.,
2656 .blend = {
2657 .enabled = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!,
2658 .src_factor_rgb = SG_BLENDFACTOR_SRC_ALPHAcxx . . $ SG_BLENDFACTOR_SRC_ALPHA.,
2659 .dst_factor_rgb = SG_BLENDFACTOR_ONE_MINUS_SRC_ALPHAcxx . . $ SG_BLENDFACTOR_ONE_MINUS_SRC_ALPHA.,
2660 }
2661 }
2662 });
2663
2664 // create pipeline and shader for rendering into display
2665 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..displaycxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#display..pipcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_28#pip. = sg_make_pipelinecxx . . $ sg_make_pipeline(6e5e446a35687b83).(&(sg_pipeline_desccxx . . $ sg_pipeline_desc#){
2666 .shader = sg_make_shadercxx . . $ sg_make_shader(ab0d6bdcaa5aceeb).(&(sg_shader_desccxx . . $ sg_shader_desc#){
2667 .attrs[0] = { .name="pos", .sem_name="POSITION" },
2668 .vs.source = display_vs_src,
2669 .fs = {
2670 .images[0].used = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!,
2671 .samplers[0].used = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!,
2672 .image_sampler_pairs[0] = { .used = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, .image_slot = 0, .sampler_slot = 0, .glsl_name = "tex" },
2673 .source = display_fs_src
2674 }
2675 }),
2676 .layout.attrs[0].format = SG_VERTEXFORMAT_FLOAT2cxx . . $ SG_VERTEXFORMAT_FLOAT2.,
2677 .primitive_type = SG_PRIMITIVETYPE_TRIANGLE_STRIPcxx . . $ SG_PRIMITIVETYPE_TRIANGLE_STRIP.
2678 });
2679
2680 // create a render target image with a fixed upscale ratio
2681 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..offscreencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#offscreen..render_targetcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_27#render_target. = sg_make_imagecxx . . $ sg_make_image(50a18bf9177d92a4).(&(sg_image_desccxx . . $ sg_image_desc#){
2682 .render_target = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!,
2683 .width = DISPLAY_PIXELS_Xcxx . . $ `pacman.c:173:9`! * 2,
2684 .height = DISPLAY_PIXELS_Ycxx . . $ `pacman.c:174:9`! * 2,
2685 .pixel_format = SG_PIXELFORMAT_RGBA8cxx . . $ SG_PIXELFORMAT_RGBA8.,
2686 });
2687
2688 // create an sampler to render the offscreen render target with linear upscale filtering
2689 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..displaycxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#display..samplercxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_28#sampler. = sg_make_samplercxx . . $ sg_make_sampler(931ae23b91cfef15).(&(sg_sampler_desccxx . . $ sg_sampler_desc#){
2690 .min_filter = SG_FILTER_LINEARcxx . . $ SG_FILTER_LINEAR.,
2691 .mag_filter = SG_FILTER_LINEARcxx . . $ SG_FILTER_LINEAR.,
2692 .wrap_u = SG_WRAP_CLAMP_TO_EDGEcxx . . $ SG_WRAP_CLAMP_TO_EDGE.,
2693 .wrap_v = SG_WRAP_CLAMP_TO_EDGEcxx . . $ SG_WRAP_CLAMP_TO_EDGE.,
2694 });
2695
2696 // pass object for rendering into the offscreen render target
2697 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..offscreencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#offscreen..attachmentscxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_27#attachments. = sg_make_attachmentscxx . . $ sg_make_attachments(e3484a78443bf16d).(&(sg_attachments_desccxx . . $ sg_attachments_desc#){
2698 .colors[0].image = statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..offscreencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#offscreen..render_targetcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_27#render_target.
2699 });
2700
2701 // create the 'tile-ROM-texture'
2702 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..offscreencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#offscreen..tile_imgcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_27#tile_img. = sg_make_imagecxx . . $ sg_make_image(50a18bf9177d92a4).(&(sg_image_desccxx . . $ sg_image_desc#){
2703 .width = TILE_TEXTURE_WIDTHcxx . . $ `pacman.c:177:9`!,
2704 .height = TILE_TEXTURE_HEIGHTcxx . . $ `pacman.c:178:9`!,
2705 .pixel_format = SG_PIXELFORMAT_R8cxx . . $ SG_PIXELFORMAT_R8.,
2706 .data.subimage[0][0] = SG_RANGEcxx . . $ `sokol/sokol_gfx.h:1634:9`!(state.gfx.tile_pixels)
2707 });
2708
2709 // create the palette texture
2710 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..offscreencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#offscreen..palette_imgcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_27#palette_img. = sg_make_imagecxx . . $ sg_make_image(50a18bf9177d92a4).(&(sg_image_desccxx . . $ sg_image_desc#){
2711 .width = 256,
2712 .height = 1,
2713 .pixel_format = SG_PIXELFORMAT_RGBA8cxx . . $ SG_PIXELFORMAT_RGBA8.,
2714 .data.subimage[0][0] = SG_RANGEcxx . . $ `sokol/sokol_gfx.h:1634:9`!(state.gfx.color_palette)
2715 });
2716
2717 // create a sampler with nearest filtering for the offscreen pass
2718 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..offscreencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#offscreen..samplercxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_27#sampler. = sg_make_samplercxx . . $ sg_make_sampler(931ae23b91cfef15).(&(sg_sampler_desccxx . . $ sg_sampler_desc#){
2719 .min_filter = SG_FILTER_NEARESTcxx . . $ SG_FILTER_NEAREST.,
2720 .mag_filter = SG_FILTER_NEARESTcxx . . $ SG_FILTER_NEAREST.,
2721 .wrap_u = SG_WRAP_CLAMP_TO_EDGEcxx . . $ SG_WRAP_CLAMP_TO_EDGE.,
2722 .wrap_v = SG_WRAP_CLAMP_TO_EDGEcxx . . $ SG_WRAP_CLAMP_TO_EDGE.,
2723 });
2724 }
2725
2726 /*
2727 8x4 tile decoder (taken from: https://github.com/floooh/chips/blob/master/systems/namco.h)
2728
2729 This decodes 2-bit-per-pixel tile data from Pacman ROM dumps into
2730 8-bit-per-pixel texture data (without doing the RGB palette lookup,
2731 this happens during rendering in the pixel shader).
2732
2733 The Pacman ROM tile layout isn't exactly strightforward, both 8x8 tiles
2734 and 16x16 sprites are built from 8x4 pixel blocks layed out linearly
2735 in memory, and to add to the confusion, since Pacman is an arcade machine
2736 with the display 90 degree rotated, all the ROM tile data is counter-rotated.
2737
2738 Tile decoding only happens once at startup from ROM dumps into a texture.
2739 */
2740 static inline void gfx_decode_tile_8x4cxx . . $ gfx_decode_tile_8x4(c08affd6d64417ed).(
2741 uint32_tcxx . . $ uint32_t# tex_x,
2742 uint32_tcxx . . $ uint32_t# tex_y,
2743 const uint8_tcxx . . $ uint8_t#* tile_base,
2744 uint32_tcxx . . $ uint32_t# tile_stride,
2745 uint32_tcxx . . $ uint32_t# tile_offset,
2746 uint8_tcxx . . $ uint8_t# tile_code)
2747 {
2748 for (uint32_tcxx . . $ uint32_t# tx = 0; tx < TILE_WIDTHcxx . . $ `pacman.c:167:9`!; tx++) {
2749 uint32_tcxx . . $ uint32_t# ti = tile_code * tile_stride + tile_offset + (7 - tx);
2750 for (uint32_tcxx . . $ uint32_t# ty = 0; ty < (TILE_HEIGHTcxx . . $ `pacman.c:168:9`!/2); ty++) {
2751 uint8_tcxx . . $ uint8_t# p_hi = (tile_base[ti] >> (7 - ty)) & 1;
2752 uint8_tcxx . . $ uint8_t# p_lo = (tile_base[ti] >> (3 - ty)) & 1;
2753 uint8_tcxx . . $ uint8_t# p = (p_hi << 1) | p_lo;
2754 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..tile_pixelscxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#tile_pixels.[tex_y + ty][tex_x + tx] = p;
2755 }
2756 }
2757 }
2758
2759 // decode an 8x8 tile into the tile texture's upper half
2760 static inline void gfx_decode_tilecxx . . $ gfx_decode_tile(ac50b47256ae7414).(uint8_tcxx . . $ uint8_t# tile_code) {
2761 uint32_tcxx . . $ uint32_t# x = tile_code * TILE_WIDTHcxx . . $ `pacman.c:167:9`!;
2762 uint32_tcxx . . $ uint32_t# y0 = 0;
2763 uint32_tcxx . . $ uint32_t# y1 = y0 + (TILE_HEIGHTcxx . . $ `pacman.c:168:9`! / 2);
2764 gfx_decode_tile_8x4cxx . . $ gfx_decode_tile_8x4(c08affd6d64417ed).(x, y0, rom_tilescxx . . $ rom_tiles., 16, 8, tile_code);
2765 gfx_decode_tile_8x4cxx . . $ gfx_decode_tile_8x4(c08affd6d64417ed).(x, y1, rom_tilescxx . . $ rom_tiles., 16, 0, tile_code);
2766 }
2767
2768 // decode a 16x16 sprite into the tile texture's lower half
2769 static inline void gfx_decode_spritecxx . . $ gfx_decode_sprite(ac50b47256ae7414).(uint8_tcxx . . $ uint8_t# sprite_code) {
2770 uint32_tcxx . . $ uint32_t# x0 = sprite_code * SPRITE_WIDTHcxx . . $ `pacman.c:169:9`!;
2771 uint32_tcxx . . $ uint32_t# x1 = x0 + TILE_WIDTHcxx . . $ `pacman.c:167:9`!;
2772 uint32_tcxx . . $ uint32_t# y0 = TILE_HEIGHTcxx . . $ `pacman.c:168:9`!;
2773 uint32_tcxx . . $ uint32_t# y1 = y0 + (TILE_HEIGHTcxx . . $ `pacman.c:168:9`! / 2);
2774 uint32_tcxx . . $ uint32_t# y2 = y1 + (TILE_HEIGHTcxx . . $ `pacman.c:168:9`! / 2);
2775 uint32_tcxx . . $ uint32_t# y3 = y2 + (TILE_HEIGHTcxx . . $ `pacman.c:168:9`! / 2);
2776 gfx_decode_tile_8x4cxx . . $ gfx_decode_tile_8x4(c08affd6d64417ed).(x0, y0, rom_spritescxx . . $ rom_sprites., 64, 40, sprite_code);
2777 gfx_decode_tile_8x4cxx . . $ gfx_decode_tile_8x4(c08affd6d64417ed).(x1, y0, rom_spritescxx . . $ rom_sprites., 64, 8, sprite_code);
2778 gfx_decode_tile_8x4cxx . . $ gfx_decode_tile_8x4(c08affd6d64417ed).(x0, y1, rom_spritescxx . . $ rom_sprites., 64, 48, sprite_code);
2779 gfx_decode_tile_8x4cxx . . $ gfx_decode_tile_8x4(c08affd6d64417ed).(x1, y1, rom_spritescxx . . $ rom_sprites., 64, 16, sprite_code);
2780 gfx_decode_tile_8x4cxx . . $ gfx_decode_tile_8x4(c08affd6d64417ed).(x0, y2, rom_spritescxx . . $ rom_sprites., 64, 56, sprite_code);
2781 gfx_decode_tile_8x4cxx . . $ gfx_decode_tile_8x4(c08affd6d64417ed).(x1, y2, rom_spritescxx . . $ rom_sprites., 64, 24, sprite_code);
2782 gfx_decode_tile_8x4cxx . . $ gfx_decode_tile_8x4(c08affd6d64417ed).(x0, y3, rom_spritescxx . . $ rom_sprites., 64, 32, sprite_code);
2783 gfx_decode_tile_8x4cxx . . $ gfx_decode_tile_8x4(c08affd6d64417ed).(x1, y3, rom_spritescxx . . $ rom_sprites., 64, 0, sprite_code);
2784 }
2785
2786 // decode the Pacman tile- and sprite-ROM-dumps into a 8bpp texture
2787 static void gfx_decode_tilescxx . . $ gfx_decode_tiles(49f6e7a06ebc5aa8).(void) {
2788 for (uint32_tcxx . . $ uint32_t# tile_code = 0; tile_code < 256; tile_code++) {
2789 gfx_decode_tilecxx . . $ gfx_decode_tile(ac50b47256ae7414).(tile_code);
2790 }
2791 for (uint32_tcxx . . $ uint32_t# sprite_code = 0; sprite_code < 64; sprite_code++) {
2792 gfx_decode_spritecxx . . $ gfx_decode_sprite(ac50b47256ae7414).(sprite_code);
2793 }
2794 // write a special opaque 16x16 block which will be used for the fade-effect
2795 for (uint32_tcxx . . $ uint32_t# y = TILE_HEIGHTcxx . . $ `pacman.c:168:9`!; y < TILE_TEXTURE_HEIGHTcxx . . $ `pacman.c:178:9`!; y++) {
2796 for (uint32_tcxx . . $ uint32_t# x = 64*SPRITE_WIDTHcxx . . $ `pacman.c:169:9`!; x < 65*SPRITE_WIDTHcxx . . $ `pacman.c:169:9`!; x++) {
2797 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..tile_pixelscxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#tile_pixels.[y][x] = 1;
2798 }
2799 }
2800 }
2801
2802 /* decode the Pacman color palette into a palette texture, on the original
2803 hardware, color lookup happens in two steps, first through 256-entry
2804 palette which indirects into a 32-entry hardware-color palette
2805 (of which only 16 entries are used on the Pacman hardware)
2806 */
2807 static void gfx_decode_color_palettecxx . . $ gfx_decode_color_palette(49f6e7a06ebc5aa8).(void) {
2808 uint32_tcxx . . $ uint32_t# hw_colors[32];
2809 for (int i = 0; i < 32; i++) {
2810 /*
2811 Each color ROM entry describes an RGB color in 1 byte:
2812
2813 | 7| 6| 5| 4| 3| 2| 1| 0|
2814 |B1|B0|G2|G1|G0|R2|R1|R0|
2815
2816 Intensities are: 0x97 + 0x47 + 0x21
2817 */
2818 uint8_tcxx . . $ uint8_t# rgb = rom_hwcolorscxx . . $ rom_hwcolors.[i];
2819 uint8_tcxx . . $ uint8_t# r = ((rgb>>0)&1) * 0x21 + ((rgb>>1)&1) * 0x47 + ((rgb>>2)&1) * 0x97;
2820 uint8_tcxx . . $ uint8_t# g = ((rgb>>3)&1) * 0x21 + ((rgb>>4)&1) * 0x47 + ((rgb>>5)&1) * 0x97;
2821 uint8_tcxx . . $ uint8_t# b = ((rgb>>6)&1) * 0x47 + ((rgb>>7)&1) * 0x97;
2822 hw_colors[i] = 0xFF000000 | (b<<16) | (g<<8) | r;
2823 }
2824 for (int i = 0; i < 256; i++) {
2825 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..color_palettecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#color_palette.[i] = hw_colors[rom_palettecxx . . $ rom_palette.[i] & 0xF];
2826 // first color in each color block is transparent
2827 if ((i & 3) == 0) {
2828 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..color_palettecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#color_palette.[i] &= 0x00FFFFFF;
2829 }
2830 }
2831 }
2832
2833 static void gfx_initcxx . . $ gfx_init(49f6e7a06ebc5aa8).(void) {
2834 sg_setupcxx . . $ sg_setup(14daf3ac2a73e58e).(&(sg_desccxx . . $ sg_desc#){
2835 // reduce pool allocation size to what's actually needed
2836 .buffer_pool_size = 2,
2837 .image_pool_size = 3,
2838 .shader_pool_size = 2,
2839 .pipeline_pool_size = 2,
2840 .attachments_pool_size = 1,
2841 .environment = sglue_environmentcxx . . $ sglue_environment(48fc0d43165a65f).(),
2842 .logger.func = slog_funccxx . . $ slog_func(8f8bcdb52caccc4c).,
2843 });
2844 disablecxx . . $ disable(cb52e61069a1301a).(&statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..fadeincxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#fadein.);
2845 disablecxx . . $ disable(cb52e61069a1301a).(&statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..fadeoutcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#fadeout.);
2846 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..fadecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#fade. = 0xFF;
2847 spr_clearcxx . . $ spr_clear(49f6e7a06ebc5aa8).();
2848 gfx_decode_tilescxx . . $ gfx_decode_tiles(49f6e7a06ebc5aa8).();
2849 gfx_decode_color_palettecxx . . $ gfx_decode_color_palette(49f6e7a06ebc5aa8).();
2850 gfx_create_resourcescxx . . $ gfx_create_resources(49f6e7a06ebc5aa8).();
2851 }
2852
2853 static void gfx_shutdowncxx . . $ gfx_shutdown(49f6e7a06ebc5aa8).(void) {
2854 sg_shutdowncxx . . $ sg_shutdown(49f6e7a06ebc5aa8).();
2855 }
2856
2857 static void gfx_add_vertexcxx . . $ gfx_add_vertex(bb4086b5941b357c).(float x, float y, float u, float v, uint8_tcxx . . $ uint8_t# color_code, uint8_tcxx . . $ uint8_t# opacity) {
2858 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(state.gfx.num_vertices < MAX_VERTICEScxx . . $ `pacman.c:179:9`!);
2859 vertex_tcxx . . $ vertex_t#* vtx = &statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..verticescxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#vertices.[statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..num_verticescxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#num_vertices.++];
2860 vtx->xcxx . . $ $anonymous_type_5882ab293b255284_13#x. = x;
2861 vtx->ycxx . . $ $anonymous_type_5882ab293b255284_13#y. = y;
2862 vtx->ucxx . . $ $anonymous_type_5882ab293b255284_13#u. = u;
2863 vtx->vcxx . . $ $anonymous_type_5882ab293b255284_13#v. = v;
2864 vtx->attrcxx . . $ $anonymous_type_5882ab293b255284_13#attr. = (opacity<<8) | color_code;
2865 }
2866
2867 static void gfx_add_tile_verticescxx . . $ gfx_add_tile_vertices(c0f0bb97aa0b199).(uint32_tcxx . . $ uint32_t# tx, uint32_tcxx . . $ uint32_t# ty, uint8_tcxx . . $ uint8_t# tile_code, uint8_tcxx . . $ uint8_t# color_code) {
2868 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!((tx < DISPLAY_TILES_Xcxx . . $ `pacman.c:171:9`!) && (ty < DISPLAY_TILES_Ycxx . . $ `pacman.c:172:9`!));
2869 const float dx = 1.0f / DISPLAY_TILES_Xcxx . . $ `pacman.c:171:9`!;
2870 const float dy = 1.0f / DISPLAY_TILES_Ycxx . . $ `pacman.c:172:9`!;
2871 const float du = (float)TILE_WIDTHcxx . . $ `pacman.c:167:9`! / TILE_TEXTURE_WIDTHcxx . . $ `pacman.c:177:9`!;
2872 const float dv = (float)TILE_HEIGHTcxx . . $ `pacman.c:168:9`! / TILE_TEXTURE_HEIGHTcxx . . $ `pacman.c:178:9`!;
2873
2874 const float x0 = tx * dx;
2875 const float x1 = x0 + dx;
2876 const float y0 = ty * dy;
2877 const float y1 = y0 + dy;
2878 const float u0 = tile_code * du;
2879 const float u1 = u0 + du;
2880 const float v0 = 0.0f;
2881 const float v1 = dv;
2882 /*
2883 x0,y0
2884 +-----+
2885 | * |
2886 | * |
2887 +-----+
2888 x1,y1
2889 */
2890 gfx_add_vertexcxx . . $ gfx_add_vertex(bb4086b5941b357c).(x0, y0, u0, v0, color_code, 0xFF);
2891 gfx_add_vertexcxx . . $ gfx_add_vertex(bb4086b5941b357c).(x1, y0, u1, v0, color_code, 0xFF);
2892 gfx_add_vertexcxx . . $ gfx_add_vertex(bb4086b5941b357c).(x1, y1, u1, v1, color_code, 0xFF);
2893 gfx_add_vertexcxx . . $ gfx_add_vertex(bb4086b5941b357c).(x0, y0, u0, v0, color_code, 0xFF);
2894 gfx_add_vertexcxx . . $ gfx_add_vertex(bb4086b5941b357c).(x1, y1, u1, v1, color_code, 0xFF);
2895 gfx_add_vertexcxx . . $ gfx_add_vertex(bb4086b5941b357c).(x0, y1, u0, v1, color_code, 0xFF);
2896 }
2897
2898 static void gfx_add_playfield_verticescxx . . $ gfx_add_playfield_vertices(49f6e7a06ebc5aa8).(void) {
2899 for (uint32_tcxx . . $ uint32_t# ty = 0; ty < DISPLAY_TILES_Ycxx . . $ `pacman.c:172:9`!; ty++) {
2900 for (uint32_tcxx . . $ uint32_t# tx = 0; tx < DISPLAY_TILES_Xcxx . . $ `pacman.c:171:9`!; tx++) {
2901 const uint8_tcxx . . $ uint8_t# tile_code = statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..video_ramcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#video_ram.[ty][tx];
2902 const uint8_tcxx . . $ uint8_t# color_code = statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..color_ramcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#color_ram.[ty][tx] & 0x1F;
2903 gfx_add_tile_verticescxx . . $ gfx_add_tile_vertices(c0f0bb97aa0b199).(tx, ty, tile_code, color_code);
2904 }
2905 }
2906 }
2907
2908 static void gfx_add_debugmarker_verticescxx . . $ gfx_add_debugmarker_vertices(49f6e7a06ebc5aa8).(void) {
2909 for (int i = 0; i < NUM_DEBUG_MARKERScxx . . $ `pacman.c:176:9`!; i++) {
2910 const debugmarker_tcxx . . $ debugmarker_t#* dbg = &statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..debug_markercxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#debug_marker.[i];
2911 if (dbg->enabledcxx . . $ $anonymous_type_5882ab293b255284_15#enabled.) {
2912 gfx_add_tile_verticescxx . . $ gfx_add_tile_vertices(c0f0bb97aa0b199).(dbg->tile_poscxx . . $ $anonymous_type_5882ab293b255284_15#tile_pos..xcxx . . $ $anonymous_type_5882ab293b255284_9#x., dbg->tile_poscxx . . $ $anonymous_type_5882ab293b255284_15#tile_pos..ycxx . . $ $anonymous_type_5882ab293b255284_9#y., dbg->tilecxx . . $ $anonymous_type_5882ab293b255284_15#tile., dbg->colorcxx . . $ $anonymous_type_5882ab293b255284_15#color.);
2913 }
2914 }
2915 }
2916
2917 static void gfx_add_sprite_verticescxx . . $ gfx_add_sprite_vertices(49f6e7a06ebc5aa8).(void) {
2918 const float dx = 1.0f / DISPLAY_PIXELS_Xcxx . . $ `pacman.c:173:9`!;
2919 const float dy = 1.0f / DISPLAY_PIXELS_Ycxx . . $ `pacman.c:174:9`!;
2920 const float du = (float)SPRITE_WIDTHcxx . . $ `pacman.c:169:9`! / TILE_TEXTURE_WIDTHcxx . . $ `pacman.c:177:9`!;
2921 const float dv = (float)SPRITE_HEIGHTcxx . . $ `pacman.c:170:9`! / TILE_TEXTURE_HEIGHTcxx . . $ `pacman.c:178:9`!;
2922 for (int i = 0; i < NUM_SPRITEScxx . . $ `pacman.c:175:9`!; i++) {
2923 const sprite_tcxx . . $ sprite_t#* spr = &statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..spritecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#sprite.[i];
2924 if (spr->enabledcxx . . $ $anonymous_type_5882ab293b255284_14#enabled.) {
2925 float x0, x1, y0, y1;
2926 if (spr->flipxcxx . . $ $anonymous_type_5882ab293b255284_14#flipx.) {
2927 x1 = spr->poscxx . . $ $anonymous_type_5882ab293b255284_14#pos..xcxx . . $ $anonymous_type_5882ab293b255284_9#x. * dx;
2928 x0 = x1 + dx * SPRITE_WIDTHcxx . . $ `pacman.c:169:9`!;
2929 }
2930 else {
2931 x0 = spr->poscxx . . $ $anonymous_type_5882ab293b255284_14#pos..xcxx . . $ $anonymous_type_5882ab293b255284_9#x. * dx;
2932 x1 = x0 + dx * SPRITE_WIDTHcxx . . $ `pacman.c:169:9`!;
2933 }
2934 if (spr->flipycxx . . $ $anonymous_type_5882ab293b255284_14#flipy.) {
2935 y1 = spr->poscxx . . $ $anonymous_type_5882ab293b255284_14#pos..ycxx . . $ $anonymous_type_5882ab293b255284_9#y. * dy;
2936 y0 = y1 + dy * SPRITE_HEIGHTcxx . . $ `pacman.c:170:9`!;
2937 }
2938 else {
2939 y0 = spr->poscxx . . $ $anonymous_type_5882ab293b255284_14#pos..ycxx . . $ $anonymous_type_5882ab293b255284_9#y. * dy;
2940 y1 = y0 + dy * SPRITE_HEIGHTcxx . . $ `pacman.c:170:9`!;
2941 }
2942 const float u0 = spr->tilecxx . . $ $anonymous_type_5882ab293b255284_14#tile. * du;
2943 const float u1 = u0 + du;
2944 const float v0 = ((float)TILE_HEIGHTcxx . . $ `pacman.c:168:9`! / TILE_TEXTURE_HEIGHTcxx . . $ `pacman.c:178:9`!);
2945 const float v1 = v0 + dv;
2946 const uint8_tcxx . . $ uint8_t# color = spr->colorcxx . . $ $anonymous_type_5882ab293b255284_14#color.;
2947 gfx_add_vertexcxx . . $ gfx_add_vertex(bb4086b5941b357c).(x0, y0, u0, v0, color, 0xFF);
2948 gfx_add_vertexcxx . . $ gfx_add_vertex(bb4086b5941b357c).(x1, y0, u1, v0, color, 0xFF);
2949 gfx_add_vertexcxx . . $ gfx_add_vertex(bb4086b5941b357c).(x1, y1, u1, v1, color, 0xFF);
2950 gfx_add_vertexcxx . . $ gfx_add_vertex(bb4086b5941b357c).(x0, y0, u0, v0, color, 0xFF);
2951 gfx_add_vertexcxx . . $ gfx_add_vertex(bb4086b5941b357c).(x1, y1, u1, v1, color, 0xFF);
2952 gfx_add_vertexcxx . . $ gfx_add_vertex(bb4086b5941b357c).(x0, y1, u0, v1, color, 0xFF);
2953 }
2954 }
2955 }
2956
2957 static void gfx_add_fade_verticescxx . . $ gfx_add_fade_vertices(49f6e7a06ebc5aa8).(void) {
2958 // sprite tile 64 is a special 16x16 opaque block
2959 const float du = (float)SPRITE_WIDTHcxx . . $ `pacman.c:169:9`! / TILE_TEXTURE_WIDTHcxx . . $ `pacman.c:177:9`!;
2960 const float dv = (float)SPRITE_HEIGHTcxx . . $ `pacman.c:170:9`! / TILE_TEXTURE_HEIGHTcxx . . $ `pacman.c:178:9`!;
2961 const float u0 = 64 * du;
2962 const float u1 = u0 + du;
2963 const float v0 = (float)TILE_HEIGHTcxx . . $ `pacman.c:168:9`! / TILE_TEXTURE_HEIGHTcxx . . $ `pacman.c:178:9`!;
2964 const float v1 = v0 + dv;
2965
2966 const uint8_tcxx . . $ uint8_t# fade = statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..fadecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#fade.;
2967 gfx_add_vertexcxx . . $ gfx_add_vertex(bb4086b5941b357c).(0.0f, 0.0f, u0, v0, 0, fade);
2968 gfx_add_vertexcxx . . $ gfx_add_vertex(bb4086b5941b357c).(1.0f, 0.0f, u1, v0, 0, fade);
2969 gfx_add_vertexcxx . . $ gfx_add_vertex(bb4086b5941b357c).(1.0f, 1.0f, u1, v1, 0, fade);
2970 gfx_add_vertexcxx . . $ gfx_add_vertex(bb4086b5941b357c).(0.0f, 0.0f, u0, v0, 0, fade);
2971 gfx_add_vertexcxx . . $ gfx_add_vertex(bb4086b5941b357c).(1.0f, 1.0f, u1, v1, 0, fade);
2972 gfx_add_vertexcxx . . $ gfx_add_vertex(bb4086b5941b357c).(0.0f, 1.0f, u0, v1, 0, fade);
2973 }
2974
2975 // adjust the viewport so that the aspect ratio is always correct
2976 static void gfx_adjust_viewportcxx . . $ gfx_adjust_viewport(3e454b8ccf442868).(int canvas_width, int canvas_height) {
2977 const float canvas_aspect = (float)canvas_width / (float)canvas_height;
2978 const float playfield_aspect = (float)DISPLAY_TILES_Xcxx . . $ `pacman.c:171:9`! / (float)DISPLAY_TILES_Ycxx . . $ `pacman.c:172:9`!;
2979 int vp_x, vp_y, vp_w, vp_h;
2980 const int border = 10;
2981 if (playfield_aspect < canvas_aspect) {
2982 vp_y = border;
2983 vp_h = canvas_height - 2*border;
2984 vp_w = (int)(canvas_height * playfield_aspect - 2*border);
2985 vp_x = (canvas_width - vp_w) / 2;
2986 }
2987 else {
2988 vp_x = border;
2989 vp_w = canvas_width - 2*border;
2990 vp_h = (int)(canvas_width / playfield_aspect - 2*border);
2991 vp_y = (canvas_height - vp_h) / 2;
2992 }
2993 sg_apply_viewportcxx . . $ sg_apply_viewport(d7a7761809021567).(vp_x, vp_y, vp_w, vp_h, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!);
2994 }
2995
2996 // handle fadein/fadeout
2997 static void gfx_fadecxx . . $ gfx_fade(49f6e7a06ebc5aa8).(void) {
2998 if (betweencxx . . $ between(4c7ecff5836b4e3d).(statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..fadeincxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#fadein., 0, FADE_TICKScxx . . $ `pacman.c:180:9`!)) {
2999 float t = (float)sincecxx . . $ since(2687634081d878c4).(statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..fadeincxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#fadein.) / FADE_TICKScxx . . $ `pacman.c:180:9`!;
3000 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..fadecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#fade. = (uint8_tcxx . . $ uint8_t#) (255.0f * (1.0f - t));
3001 }
3002 if (after_oncecxx . . $ after_once(83b89002639f1b8c).(statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..fadeincxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#fadein., FADE_TICKScxx . . $ `pacman.c:180:9`!)) {
3003 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..fadecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#fade. = 0;
3004 }
3005 if (betweencxx . . $ between(4c7ecff5836b4e3d).(statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..fadeoutcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#fadeout., 0, FADE_TICKScxx . . $ `pacman.c:180:9`!)) {
3006 float t = (float)sincecxx . . $ since(2687634081d878c4).(statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..fadeoutcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#fadeout.) / FADE_TICKScxx . . $ `pacman.c:180:9`!;
3007 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..fadecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#fade. = (uint8_tcxx . . $ uint8_t#) (255.0f * t);
3008 }
3009 if (after_oncecxx . . $ after_once(83b89002639f1b8c).(statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..fadeoutcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#fadeout., FADE_TICKScxx . . $ `pacman.c:180:9`!)) {
3010 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..fadecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#fade. = 255;
3011 }
3012 }
3013
3014 static void gfx_drawcxx . . $ gfx_draw(49f6e7a06ebc5aa8).(void) {
3015 // handle fade in/out
3016 gfx_fadecxx . . $ gfx_fade(49f6e7a06ebc5aa8).();
3017
3018 // update the playfield and sprite vertex buffer
3019 statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..num_verticescxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#num_vertices. = 0;
3020 gfx_add_playfield_verticescxx . . $ gfx_add_playfield_vertices(49f6e7a06ebc5aa8).();
3021 gfx_add_sprite_verticescxx . . $ gfx_add_sprite_vertices(49f6e7a06ebc5aa8).();
3022 gfx_add_debugmarker_verticescxx . . $ gfx_add_debugmarker_vertices(49f6e7a06ebc5aa8).();
3023 if (statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..fadecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#fade. > 0) {
3024 gfx_add_fade_verticescxx . . $ gfx_add_fade_vertices(49f6e7a06ebc5aa8).();
3025 }
3026 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(state.gfx.num_vertices <= MAX_VERTICEScxx . . $ `pacman.c:179:9`!);
3027 sg_update_buffercxx . . $ sg_update_buffer(1a793da43b96134e).(statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..offscreencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#offscreen..vbufcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_27#vbuf., &(sg_rangecxx . . $ sg_range#){ .ptr=statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..verticescxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#vertices., .size=statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..num_verticescxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#num_vertices. * sizeof(vertex_tcxx . . $ vertex_t#) });
3028
3029 // render tiles and sprites into offscreen render target
3030 sg_begin_passcxx . . $ sg_begin_pass(4f839812e29750dc).(&(sg_passcxx . . $ sg_pass#){ .action = statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..pass_actioncxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#pass_action., .attachments = statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..offscreencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#offscreen..attachmentscxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_27#attachments. });
3031 sg_apply_pipelinecxx . . $ sg_apply_pipeline(fa06e78c216ede9c).(statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..offscreencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#offscreen..pipcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_27#pip.);
3032 sg_apply_bindingscxx . . $ sg_apply_bindings(5f6aac639b109626).(&(sg_bindingscxx . . $ sg_bindings#){
3033 .vertex_buffers[0] = statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..offscreencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#offscreen..vbufcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_27#vbuf.,
3034 .fs = {
3035 .images = {
3036 [0] = statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..offscreencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#offscreen..tile_imgcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_27#tile_img.,
3037 [1] = statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..offscreencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#offscreen..palette_imgcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_27#palette_img.,
3038 },
3039 .samplers[0] = statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..offscreencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#offscreen..samplercxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_27#sampler.,
3040 .samplers[1] = statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..offscreencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#offscreen..samplercxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_27#sampler.,
3041 }
3042 });
3043 sg_drawcxx . . $ sg_draw(b1146eedae1e1d0b).(0, statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..num_verticescxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#num_vertices., 1);
3044 sg_end_passcxx . . $ sg_end_pass(49f6e7a06ebc5aa8).();
3045
3046 // upscale-render the offscreen render target into the display framebuffer
3047 const int canvas_width = sapp_widthcxx . . $ sapp_width(b126dc7c1de90089).();
3048 const int canvas_height = sapp_heightcxx . . $ sapp_height(b126dc7c1de90089).();
3049 sg_begin_passcxx . . $ sg_begin_pass(4f839812e29750dc).(&(sg_passcxx . . $ sg_pass#){ .action = statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..pass_actioncxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#pass_action., .swapchain = sglue_swapchaincxx . . $ sglue_swapchain(ce39f20aa6c4b29f).() });
3050 gfx_adjust_viewportcxx . . $ gfx_adjust_viewport(3e454b8ccf442868).(canvas_width, canvas_height);
3051 sg_apply_pipelinecxx . . $ sg_apply_pipeline(fa06e78c216ede9c).(statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..displaycxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#display..pipcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_28#pip.);
3052 sg_apply_bindingscxx . . $ sg_apply_bindings(5f6aac639b109626).(&(sg_bindingscxx . . $ sg_bindings#){
3053 .vertex_buffers[0] = statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..displaycxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#display..quad_vbufcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_28#quad_vbuf.,
3054 .fs = {
3055 .images[0] = statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..offscreencxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#offscreen..render_targetcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_27#render_target.,
3056 .samplers[0] = statecxx . . $ state..gfxcxx . . $ $anonymous_type_5882ab293b255284_20#gfx..displaycxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#display..samplercxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_26#$anonymous_type_28#sampler.,
3057 }
3058 });
3059 sg_drawcxx . . $ sg_draw(b1146eedae1e1d0b).(0, 4, 1);
3060 sg_end_passcxx . . $ sg_end_pass(49f6e7a06ebc5aa8).();
3061 sg_commitcxx . . $ sg_commit(49f6e7a06ebc5aa8).();
3062 }
3063
3064 /*== AUDIO SUBSYSTEM =========================================================*/
3065 static void snd_initcxx . . $ snd_init(49f6e7a06ebc5aa8).(void) {
3066 saudio_setupcxx . . $ saudio_setup(439a5fcbbb85e9cc).(&(saudio_desccxx . . $ saudio_desc#){
3067 .logger.func = slog_funccxx . . $ slog_func(8f8bcdb52caccc4c).,
3068 });
3069
3070 // compute sample duration in nanoseconds
3071 int32_tcxx . . $ int32_t# samples_per_sec = saudio_sample_ratecxx . . $ saudio_sample_rate(b126dc7c1de90089).();
3072 statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..sample_duration_nscxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#sample_duration_ns. = 1000000000 / samples_per_sec;
3073
3074 /* compute number of 96kHz ticks per sample tick (the Namco sound generator
3075 runs at 96kHz), times 1000 for increased precision
3076 */
3077 statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..voice_tick_periodcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#voice_tick_period. = 96000000 / samples_per_sec;
3078 }
3079
3080 static void snd_shutdowncxx . . $ snd_shutdown(49f6e7a06ebc5aa8).(void) {
3081 saudio_shutdowncxx . . $ saudio_shutdown(49f6e7a06ebc5aa8).();
3082 }
3083
3084 // the snd_voice_tick() function updates the Namco sound generator and must be called with 96 kHz
3085 static void snd_voice_tickcxx . . $ snd_voice_tick(49f6e7a06ebc5aa8).(void) {
3086 for (int i = 0; i < NUM_VOICEScxx . . $ `pacman.c:163:9`!; i++) {
3087 voice_tcxx . . $ voice_t#* voice = &statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..voicecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#voice.[i];
3088 voice->countercxx . . $ $anonymous_type_5882ab293b255284_17#counter. += voice->frequencycxx . . $ $anonymous_type_5882ab293b255284_17#frequency.;
3089 /* lookup current 4-bit sample from the waveform number and the
3090 topmost 5 bits of the 20-bit sample counter
3091 */
3092 uint32_tcxx . . $ uint32_t# wave_index = ((voice->waveformcxx . . $ $anonymous_type_5882ab293b255284_17#waveform.<<5) | ((voice->countercxx . . $ $anonymous_type_5882ab293b255284_17#counter.>>15) & 0x1F)) & 0xFF;
3093 int sample = (((int)(rom_wavetablecxx . . $ rom_wavetable.[wave_index] & 0xF)) - 8) * voice->volumecxx . . $ $anonymous_type_5882ab293b255284_17#volume.;
3094 voice->sample_acccxx . . $ $anonymous_type_5882ab293b255284_17#sample_acc. += (float)sample; // sample is (-8..+7 wavetable value) * 16 (volume)
3095 voice->sample_divcxx . . $ $anonymous_type_5882ab293b255284_17#sample_div. += 128.0f;
3096 }
3097 }
3098
3099 // the snd_sample_tick() function must be called with sample frequency (e.g. 44.1kHz)
3100 static void snd_sample_tickcxx . . $ snd_sample_tick(49f6e7a06ebc5aa8).(void) {
3101 float sm = 0.0f;
3102 for (int i = 0; i < NUM_VOICEScxx . . $ `pacman.c:163:9`!; i++) {
3103 voice_tcxx . . $ voice_t#* voice = &statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..voicecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#voice.[i];
3104 if (voice->sample_divcxx . . $ $anonymous_type_5882ab293b255284_17#sample_div. > 0.0f) {
3105 sm += voice->sample_acccxx . . $ $anonymous_type_5882ab293b255284_17#sample_acc. / voice->sample_divcxx . . $ $anonymous_type_5882ab293b255284_17#sample_div.;
3106 voice->sample_acccxx . . $ $anonymous_type_5882ab293b255284_17#sample_acc. = voice->sample_divcxx . . $ $anonymous_type_5882ab293b255284_17#sample_div. = 0.0f;
3107 }
3108 }
3109 statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..sample_buffercxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#sample_buffer.[statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..num_samplescxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#num_samples.++] = sm * 0.333333f * AUDIO_VOLUMEcxx . . $ `pacman.c:143:9`!;
3110 if (statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..num_samplescxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#num_samples. == NUM_SAMPLEScxx . . $ `pacman.c:165:9`!) {
3111 saudio_pushcxx . . $ saudio_push(58d4fdd276b11965).(statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..sample_buffercxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#sample_buffer., statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..num_samplescxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#num_samples.);
3112 statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..num_samplescxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#num_samples. = 0;
3113 }
3114 }
3115
3116 // the sound subsystem's per-frame function
3117 static void snd_framecxx . . $ snd_frame(d4f767463ce0a6b3).(int32_tcxx . . $ int32_t# frame_time_ns) {
3118 // for each sample to generate...
3119 statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..sample_accumcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#sample_accum. -= frame_time_ns;
3120 while (statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..sample_accumcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#sample_accum. < 0) {
3121 statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..sample_accumcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#sample_accum. += statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..sample_duration_nscxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#sample_duration_ns.;
3122 // tick the sound generator at 96 KHz
3123 statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..voice_tick_accumcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#voice_tick_accum. -= statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..voice_tick_periodcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#voice_tick_period.;
3124 while (statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..voice_tick_accumcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#voice_tick_accum. < 0) {
3125 statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..voice_tick_accumcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#voice_tick_accum. += 1000;
3126 snd_voice_tickcxx . . $ snd_voice_tick(49f6e7a06ebc5aa8).();
3127 }
3128 // generate a new sample, and push out to sokol-audio when local sample buffer full
3129 snd_sample_tickcxx . . $ snd_sample_tick(49f6e7a06ebc5aa8).();
3130 }
3131 }
3132
3133 /* The sound system's 60 Hz tick function (called from game tick).
3134 Updates the sound 'hardware registers' for all active sound effects.
3135 */
3136 static void snd_tickcxx . . $ snd_tick(49f6e7a06ebc5aa8).(void) {
3137 // for each active sound effect...
3138 for (int sound_slot = 0; sound_slot < NUM_SOUNDScxx . . $ `pacman.c:164:9`!; sound_slot++) {
3139 sound_tcxx . . $ sound_t#* snd = &statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..soundcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#sound.[sound_slot];
3140 if (snd->funccxx . . $ $anonymous_type_5882ab293b255284_19#func.) {
3141 // procedural sound effect
3142 snd->funccxx . . $ $anonymous_type_5882ab293b255284_19#func.(sound_slot);
3143 }
3144 else if (snd->flagscxx . . $ $anonymous_type_5882ab293b255284_19#flags. & SOUNDFLAG_ALL_VOICEScxx . . $ SOUNDFLAG_ALL_VOICES.) {
3145 // register-dump sound effect
3146 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(snd->data);
3147 if (snd->cur_tickcxx . . $ $anonymous_type_5882ab293b255284_19#cur_tick. == snd->num_tickscxx . . $ $anonymous_type_5882ab293b255284_19#num_ticks.) {
3148 snd_stopcxx . . $ snd_stop(d4f767463ce0a6b3).(sound_slot);
3149 continue;
3150 }
3151
3152 // decode register dump values into voice 'registers'
3153 const uint32_tcxx . . $ uint32_t#* cur_ptr = &snd->datacxx . . $ $anonymous_type_5882ab293b255284_19#data.[snd->cur_tickcxx . . $ $anonymous_type_5882ab293b255284_19#cur_tick. * snd->stridecxx . . $ $anonymous_type_5882ab293b255284_19#stride.];
3154 for (int i = 0; i < NUM_VOICEScxx . . $ `pacman.c:163:9`!; i++) {
3155 if (snd->flagscxx . . $ $anonymous_type_5882ab293b255284_19#flags. & (1<<i)) {
3156 voice_tcxx . . $ voice_t#* voice = &statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..voicecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#voice.[i];
3157 uint32_tcxx . . $ uint32_t# val = *cur_ptr++;
3158 // 20 bits frequency
3159 voice->frequencycxx . . $ $anonymous_type_5882ab293b255284_17#frequency. = val & ((1<<20)-1);
3160 // 3 bits waveform
3161 voice->waveformcxx . . $ $anonymous_type_5882ab293b255284_17#waveform. = (val>>24) & 7;
3162 // 4 bits volume
3163 voice->volumecxx . . $ $anonymous_type_5882ab293b255284_17#volume. = (val>>28) & 0xF;
3164 }
3165 }
3166 }
3167 snd->cur_tickcxx . . $ $anonymous_type_5882ab293b255284_19#cur_tick.++;
3168 }
3169 }
3170
3171 // clear all active sound effects and start outputting silence
3172 static void snd_clearcxx . . $ snd_clear(49f6e7a06ebc5aa8).(void) {
3173 memsetcxx . . $ memset(d1de1e4fb215f1c6).(&statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..voicecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#voice., 0, sizeof(statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..voicecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#voice.));
3174 memsetcxx . . $ memset(d1de1e4fb215f1c6).(&statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..soundcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#sound., 0, sizeof(statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..soundcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#sound.));
3175 }
3176
3177 // start a sound effect
3178 static void snd_startcxx . . $ snd_start(eb66bf3bee49480).(int slot, const sound_desc_tcxx . . $ sound_desc_t#* desc) {
3179 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!((slot >= 0) && (slot < NUM_SOUNDScxx . . $ `pacman.c:164:9`!));
3180 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(desc);
3181 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!((desc->ptr && desc->size) || desc->func);
3182
3183 sound_tcxx . . $ sound_t#* snd = &statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..soundcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#sound.[slot];
3184 *snd = (sound_tcxx . . $ sound_t#) { 0 };
3185 int num_voices = 0;
3186 for (int i = 0; i < NUM_VOICEScxx . . $ `pacman.c:163:9`!; i++) {
3187 if (desc->voicecxx . . $ $anonymous_type_5882ab293b255284_16#voice.[i]) {
3188 snd->flagscxx . . $ $anonymous_type_5882ab293b255284_19#flags. |= (1<<i);
3189 num_voices++;
3190 }
3191 }
3192 if (desc->funccxx . . $ $anonymous_type_5882ab293b255284_16#func.) {
3193 // procedural sounds only need a callback function
3194 snd->funccxx . . $ $anonymous_type_5882ab293b255284_19#func. = desc->funccxx . . $ $anonymous_type_5882ab293b255284_16#func.;
3195 }
3196 else {
3197 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(num_voices > 0);
3198 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!((desc->size % (num_voices*sizeof(uint32_t))) == 0);
3199 snd->stridecxx . . $ $anonymous_type_5882ab293b255284_19#stride. = num_voices;
3200 snd->num_tickscxx . . $ $anonymous_type_5882ab293b255284_19#num_ticks. = desc->sizecxx . . $ $anonymous_type_5882ab293b255284_16#size. / (snd->stridecxx . . $ $anonymous_type_5882ab293b255284_19#stride.*sizeof(uint32_tcxx . . $ uint32_t#));
3201 snd->datacxx . . $ $anonymous_type_5882ab293b255284_19#data. = desc->ptrcxx . . $ $anonymous_type_5882ab293b255284_16#ptr.;
3202 }
3203 }
3204
3205 // stop a sound effect
3206 static void snd_stopcxx . . $ snd_stop(d4f767463ce0a6b3).(int slot) {
3207 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!((slot >= 0) && (slot < NUM_SOUNDScxx . . $ `pacman.c:164:9`!));
3208
3209 // silence the sound's output voices
3210 for (int i = 0; i < NUM_VOICEScxx . . $ `pacman.c:163:9`!; i++) {
3211 if (statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..soundcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#sound.[slot].flagscxx . . $ $anonymous_type_5882ab293b255284_19#flags. & (1<<i)) {
3212 statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..voicecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#voice.[i] = (voice_tcxx . . $ voice_t#) { 0 };
3213 }
3214 }
3215
3216 // clear the sound slot
3217 statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..soundcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#sound.[slot] = (sound_tcxx . . $ sound_t#) { 0 };
3218 }
3219
3220 // procedural sound effects
3221 static void snd_func_eatdot1cxx . . $ snd_func_eatdot1(d4f767463ce0a6b3).(int slot) {
3222 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!((slot >= 0) && (slot < NUM_SOUNDScxx . . $ `pacman.c:164:9`!));
3223 const sound_tcxx . . $ sound_t#* snd = &statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..soundcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#sound.[slot];
3224 voice_tcxx . . $ voice_t#* voice = &statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..voicecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#voice.[2];
3225 if (snd->cur_tickcxx . . $ $anonymous_type_5882ab293b255284_19#cur_tick. == 0) {
3226 voice->volumecxx . . $ $anonymous_type_5882ab293b255284_17#volume. = 12;
3227 voice->waveformcxx . . $ $anonymous_type_5882ab293b255284_17#waveform. = 2;
3228 voice->frequencycxx . . $ $anonymous_type_5882ab293b255284_17#frequency. = 0x1500;
3229 }
3230 else if (snd->cur_tickcxx . . $ $anonymous_type_5882ab293b255284_19#cur_tick. == 5) {
3231 snd_stopcxx . . $ snd_stop(d4f767463ce0a6b3).(slot);
3232 }
3233 else {
3234 voice->frequencycxx . . $ $anonymous_type_5882ab293b255284_17#frequency. -= 0x0300;
3235 }
3236 }
3237
3238 static void snd_func_eatdot2cxx . . $ snd_func_eatdot2(d4f767463ce0a6b3).(int slot) {
3239 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!((slot >= 0) && (slot < NUM_SOUNDScxx . . $ `pacman.c:164:9`!));
3240 const sound_tcxx . . $ sound_t#* snd = &statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..soundcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#sound.[slot];
3241 voice_tcxx . . $ voice_t#* voice = &statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..voicecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#voice.[2];
3242 if (snd->cur_tickcxx . . $ $anonymous_type_5882ab293b255284_19#cur_tick. == 0) {
3243 voice->volumecxx . . $ $anonymous_type_5882ab293b255284_17#volume. = 12;
3244 voice->waveformcxx . . $ $anonymous_type_5882ab293b255284_17#waveform. = 2;
3245 voice->frequencycxx . . $ $anonymous_type_5882ab293b255284_17#frequency. = 0x0700;
3246 }
3247 else if (snd->cur_tickcxx . . $ $anonymous_type_5882ab293b255284_19#cur_tick. == 5) {
3248 snd_stopcxx . . $ snd_stop(d4f767463ce0a6b3).(slot);
3249 }
3250 else {
3251 voice->frequencycxx . . $ $anonymous_type_5882ab293b255284_17#frequency. += 0x300;
3252 }
3253 }
3254
3255 static void snd_func_eatghostcxx . . $ snd_func_eatghost(d4f767463ce0a6b3).(int slot) {
3256 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!((slot >= 0) && (slot < NUM_SOUNDScxx . . $ `pacman.c:164:9`!));
3257 const sound_tcxx . . $ sound_t#* snd = &statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..soundcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#sound.[slot];
3258 voice_tcxx . . $ voice_t#* voice = &statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..voicecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#voice.[2];
3259 if (snd->cur_tickcxx . . $ $anonymous_type_5882ab293b255284_19#cur_tick. == 0) {
3260 voice->volumecxx . . $ $anonymous_type_5882ab293b255284_17#volume. = 12;
3261 voice->waveformcxx . . $ $anonymous_type_5882ab293b255284_17#waveform. = 5;
3262 voice->frequencycxx . . $ $anonymous_type_5882ab293b255284_17#frequency. = 0;
3263 }
3264 else if (snd->cur_tickcxx . . $ $anonymous_type_5882ab293b255284_19#cur_tick. == 32) {
3265 snd_stopcxx . . $ snd_stop(d4f767463ce0a6b3).(slot);
3266 }
3267 else {
3268 voice->frequencycxx . . $ $anonymous_type_5882ab293b255284_17#frequency. += 0x20;
3269 }
3270 }
3271
3272 static void snd_func_eatfruitcxx . . $ snd_func_eatfruit(d4f767463ce0a6b3).(int slot) {
3273 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!((slot >= 0) && (slot < NUM_SOUNDScxx . . $ `pacman.c:164:9`!));
3274 const sound_tcxx . . $ sound_t#* snd = &statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..soundcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#sound.[slot];
3275 voice_tcxx . . $ voice_t#* voice = &statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..voicecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#voice.[2];
3276 if (snd->cur_tickcxx . . $ $anonymous_type_5882ab293b255284_19#cur_tick. == 0) {
3277 voice->volumecxx . . $ $anonymous_type_5882ab293b255284_17#volume. = 15;
3278 voice->waveformcxx . . $ $anonymous_type_5882ab293b255284_17#waveform. = 6;
3279 voice->frequencycxx . . $ $anonymous_type_5882ab293b255284_17#frequency. = 0x1600;
3280 }
3281 else if (snd->cur_tickcxx . . $ $anonymous_type_5882ab293b255284_19#cur_tick. == 23) {
3282 snd_stopcxx . . $ snd_stop(d4f767463ce0a6b3).(slot);
3283 }
3284 else if (snd->cur_tickcxx . . $ $anonymous_type_5882ab293b255284_19#cur_tick. < 11) {
3285 voice->frequencycxx . . $ $anonymous_type_5882ab293b255284_17#frequency. -= 0x200;
3286 }
3287 else {
3288 voice->frequencycxx . . $ $anonymous_type_5882ab293b255284_17#frequency. += 0x0200;
3289 }
3290 }
3291
3292 static void snd_func_weeoohcxx . . $ snd_func_weeooh(d4f767463ce0a6b3).(int slot) {
3293 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!((slot >= 0) && (slot < NUM_SOUNDScxx . . $ `pacman.c:164:9`!));
3294 const sound_tcxx . . $ sound_t#* snd = &statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..soundcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#sound.[slot];
3295 voice_tcxx . . $ voice_t#* voice = &statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..voicecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#voice.[1];
3296 if (snd->cur_tickcxx . . $ $anonymous_type_5882ab293b255284_19#cur_tick. == 0) {
3297 voice->volumecxx . . $ $anonymous_type_5882ab293b255284_17#volume. = 6;
3298 voice->waveformcxx . . $ $anonymous_type_5882ab293b255284_17#waveform. = 6;
3299 voice->frequencycxx . . $ $anonymous_type_5882ab293b255284_17#frequency. = 0x1000;
3300 }
3301 else if ((snd->cur_tickcxx . . $ $anonymous_type_5882ab293b255284_19#cur_tick. % 24) < 12) {
3302 voice->frequencycxx . . $ $anonymous_type_5882ab293b255284_17#frequency. += 0x0200;
3303 }
3304 else {
3305 voice->frequencycxx . . $ $anonymous_type_5882ab293b255284_17#frequency. -= 0x0200;
3306 }
3307 }
3308
3309 static void snd_func_frightenedcxx . . $ snd_func_frightened(d4f767463ce0a6b3).(int slot) {
3310 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!((slot >= 0) && (slot < NUM_SOUNDScxx . . $ `pacman.c:164:9`!));
3311 const sound_tcxx . . $ sound_t#* snd = &statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..soundcxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#sound.[slot];
3312 voice_tcxx . . $ voice_t#* voice = &statecxx . . $ state..audiocxx . . $ $anonymous_type_5882ab293b255284_20#audio..voicecxx . . $ $anonymous_type_5882ab293b255284_20#$anonymous_type_25#voice.[1];
3313 if (snd->cur_tickcxx . . $ $anonymous_type_5882ab293b255284_19#cur_tick. == 0) {
3314 voice->volumecxx . . $ $anonymous_type_5882ab293b255284_17#volume. = 10;
3315 voice->waveformcxx . . $ $anonymous_type_5882ab293b255284_17#waveform. = 4;
3316 voice->frequencycxx . . $ $anonymous_type_5882ab293b255284_17#frequency. = 0x0180;
3317 }
3318 else if ((snd->cur_tickcxx . . $ $anonymous_type_5882ab293b255284_19#cur_tick. % 8) == 0) {
3319 voice->frequencycxx . . $ $anonymous_type_5882ab293b255284_17#frequency. = 0x0180;
3320 }
3321 else {
3322 voice->frequencycxx . . $ $anonymous_type_5882ab293b255284_17#frequency. += 0x180;
3323 }
3324 }
3325
3326 /*== EMBEDDED DATA ===========================================================*/
3327
3328 // Pacman sprite ROM dump
3329 static const uint8_tcxx . . $ uint8_t# rom_tilescxx . . $ rom_tiles.[4096] = {
3330 0xcc, 0xee, 0x11, 0x11, 0x33, 0xee, 0xcc, 0x0, 0x11, 0x33, 0x66, 0x44, 0x44, 0x33, 0x11, 0x0,
3331 0x11, 0x11, 0xff, 0xff, 0x11, 0x11, 0x0, 0x0, 0x0, 0x0, 0x77, 0x77, 0x22, 0x0, 0x0, 0x0,
3332 0x11, 0x99, 0xdd, 0xdd, 0xff, 0x77, 0x33, 0x0, 0x33, 0x77, 0x55, 0x44, 0x44, 0x66, 0x22, 0x0,
3333 0x66, 0xff, 0x99, 0x99, 0x99, 0x33, 0x22, 0x0, 0x44, 0x66, 0x77, 0x55, 0x44, 0x44, 0x0, 0x0,
3334 0x44, 0xff, 0xff, 0x44, 0x44, 0xcc, 0xcc, 0x0, 0x0, 0x77, 0x77, 0x66, 0x33, 0x11, 0x0, 0x0,
3335 0xee, 0xff, 0x11, 0x11, 0x11, 0x33, 0x22, 0x0, 0x0, 0x55, 0x55, 0x55, 0x55, 0x77, 0x77, 0x0,
3336 0x66, 0xff, 0x99, 0x99, 0x99, 0xff, 0xee, 0x0, 0x0, 0x44, 0x44, 0x44, 0x66, 0x33, 0x11, 0x0,
3337 0x0, 0x0, 0x88, 0xff, 0x77, 0x0, 0x0, 0x0, 0x66, 0x77, 0x55, 0x44, 0x44, 0x66, 0x66, 0x0,
3338 0x66, 0x77, 0xdd, 0xdd, 0x99, 0x99, 0x66, 0x0, 0x0, 0x33, 0x44, 0x44, 0x55, 0x77, 0x33, 0x0,
3339 0xcc, 0xee, 0xbb, 0x99, 0x99, 0x99, 0x0, 0x0, 0x33, 0x77, 0x44, 0x44, 0x44, 0x77, 0x33, 0x0,
3340 0xff, 0xff, 0x44, 0x44, 0x44, 0xff, 0xff, 0x0, 0x11, 0x33, 0x66, 0x44, 0x66, 0x33, 0x11, 0x0,
3341 0x66, 0xff, 0x99, 0x99, 0x99, 0xff, 0xff, 0x0, 0x33, 0x77, 0x44, 0x44, 0x44, 0x77, 0x77, 0x0,
3342 0x22, 0x33, 0x11, 0x11, 0x33, 0xee, 0xcc, 0x0, 0x22, 0x66, 0x44, 0x44, 0x66, 0x33, 0x11, 0x0,
3343 0xcc, 0xee, 0x33, 0x11, 0x11, 0xff, 0xff, 0x0, 0x11, 0x33, 0x66, 0x44, 0x44, 0x77, 0x77, 0x0,
3344 0x11, 0x99, 0x99, 0x99, 0xff, 0xff, 0x0, 0x0, 0x44, 0x44, 0x44, 0x44, 0x77, 0x77, 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, 0x0, 0xee, 0xdd, 0x0, 0xee, 0xdd, 0x0, 0x0,
3370 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0x77, 0xff, 0xcc, 0xcc, 0xcc, 0xcc, 0xff, 0xff,
3371 0xbb, 0xbb, 0xbb, 0xbb, 0xff, 0xff, 0x0, 0x0, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0x11, 0x0, 0x0,
3372 0x0, 0x0, 0xff, 0xff, 0x0, 0x0, 0xff, 0xff, 0xcc, 0xcc, 0xff, 0xff, 0x0, 0x0, 0x77, 0xff,
3373 0x0, 0x0, 0xff, 0xff, 0x0, 0x0, 0xff, 0xff, 0x0, 0x0, 0x77, 0xff, 0xcc, 0xcc, 0xff, 0xff,
3374 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0xff, 0xee, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xff, 0x77,
3375 0x33, 0x33, 0x33, 0x33, 0xff, 0xee, 0x0, 0x0, 0xcc, 0xcc, 0xcc, 0xcc, 0xff, 0x77, 0x0, 0x0,
3376 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xee, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x77, 0xff,
3377 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
3378 0x88, 0xcc, 0x22, 0x22, 0x66, 0xcc, 0x88, 0x0, 0x33, 0x77, 0xcc, 0x88, 0x88, 0x77, 0x33, 0x0,
3379 0x22, 0x22, 0xee, 0xee, 0x22, 0x22, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0x44, 0x0, 0x0, 0x0,
3380 0x22, 0x22, 0xaa, 0xaa, 0xee, 0xee, 0x66, 0x0, 0x66, 0xff, 0xbb, 0x99, 0x99, 0xcc, 0x44, 0x0,
3381 0xcc, 0xee, 0x22, 0x22, 0x22, 0x66, 0x44, 0x0, 0x88, 0xdd, 0xff, 0xbb, 0x99, 0x88, 0x0, 0x0,
3382 0x88, 0xee, 0xee, 0x88, 0x88, 0x88, 0x88, 0x0, 0x0, 0xff, 0xff, 0xcc, 0x66, 0x33, 0x11, 0x0,
3383 0xcc, 0xee, 0x22, 0x22, 0x22, 0x66, 0x44, 0x0, 0x11, 0xbb, 0xaa, 0xaa, 0xaa, 0xee, 0xee, 0x0,
3384 0xcc, 0xee, 0x22, 0x22, 0x22, 0xee, 0xcc, 0x0, 0x0, 0x99, 0x99, 0x99, 0xdd, 0x77, 0x33, 0x0,
3385 0x0, 0x0, 0x0, 0xee, 0xee, 0x0, 0x0, 0x0, 0xcc, 0xee, 0xbb, 0x99, 0x88, 0xcc, 0xcc, 0x0,
3386 0xcc, 0xee, 0xaa, 0xaa, 0x22, 0x22, 0xcc, 0x0, 0x0, 0x66, 0x99, 0x99, 0xbb, 0xff, 0x66, 0x0,
3387 0x88, 0xcc, 0x66, 0x22, 0x22, 0x22, 0x0, 0x0, 0x77, 0xff, 0x99, 0x99, 0x99, 0xff, 0x66, 0x0,
3388 0x0, 0x0, 0x0, 0x0, 0x88, 0x44, 0x22, 0x0, 0x88, 0x44, 0x22, 0x11, 0x0, 0x0, 0x0, 0x0,
3389 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x11, 0x11, 0x11, 0x0, 0x0, 0x0,
3390 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
3391 0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
3392 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0xff,
3393 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff,
3394 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
3395 0xee, 0xee, 0x88, 0x88, 0x88, 0xee, 0xee, 0x0, 0x33, 0x77, 0xcc, 0x88, 0xcc, 0x77, 0x33, 0x0,
3396 0xcc, 0xee, 0x22, 0x22, 0x22, 0xee, 0xee, 0x0, 0x66, 0xff, 0x99, 0x99, 0x99, 0xff, 0xff, 0x0,
3397 0x44, 0x66, 0x22, 0x22, 0x66, 0xcc, 0x88, 0x0, 0x44, 0xcc, 0x88, 0x88, 0xcc, 0x77, 0x33, 0x0,
3398 0x88, 0xcc, 0x66, 0x22, 0x22, 0xee, 0xee, 0x0, 0x33, 0x77, 0xcc, 0x88, 0x88, 0xff, 0xff, 0x0,
3399 0x22, 0x22, 0x22, 0x22, 0xee, 0xee, 0x0, 0x0, 0x88, 0x99, 0x99, 0x99, 0xff, 0xff, 0x0, 0x0,
3400 0x0, 0x0, 0x0, 0x0, 0x0, 0xee, 0xee, 0x0, 0x88, 0x99, 0x99, 0x99, 0x99, 0xff, 0xff, 0x0,
3401 0xee, 0xee, 0x22, 0x22, 0x66, 0xcc, 0x88, 0x0, 0x99, 0x99, 0x99, 0x88, 0xcc, 0x77, 0x33, 0x0,
3402 0xee, 0xee, 0x0, 0x0, 0x0, 0xee, 0xee, 0x0, 0xff, 0xff, 0x11, 0x11, 0x11, 0xff, 0xff, 0x0,
3403 0x22, 0x22, 0xee, 0xee, 0x22, 0x22, 0x0, 0x0, 0x88, 0x88, 0xff, 0xff, 0x88, 0x88, 0x0, 0x0,
3404 0xcc, 0xee, 0x22, 0x22, 0x22, 0x66, 0x44, 0x0, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
3405 0x22, 0x66, 0xee, 0xcc, 0x88, 0xee, 0xee, 0x0, 0x88, 0xcc, 0x66, 0x33, 0x11, 0xff, 0xff, 0x0,
3406 0x22, 0x22, 0x22, 0x22, 0xee, 0xee, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0x0, 0x0,
3407 0xee, 0xee, 0x0, 0x88, 0x0, 0xee, 0xee, 0x0, 0xff, 0xff, 0x77, 0x33, 0x77, 0xff, 0xff, 0x0,
3408 0xee, 0xee, 0xcc, 0x88, 0x0, 0xee, 0xee, 0x0, 0xff, 0xff, 0x11, 0x33, 0x77, 0xff, 0xff, 0x0,
3409 0xcc, 0xee, 0x22, 0x22, 0x22, 0xee, 0xcc, 0x0, 0x77, 0xff, 0x88, 0x88, 0x88, 0xff, 0x77, 0x0,
3410 0x0, 0x88, 0x88, 0x88, 0x88, 0xee, 0xee, 0x0, 0x77, 0xff, 0x88, 0x88, 0x88, 0xff, 0xff, 0x0,
3411 0xaa, 0xcc, 0xee, 0xaa, 0x22, 0xee, 0xcc, 0x0, 0x77, 0xff, 0x88, 0x88, 0x88, 0xff, 0x77, 0x0,
3412 0x22, 0x66, 0xee, 0xcc, 0x88, 0xee, 0xee, 0x0, 0x77, 0xff, 0x99, 0x88, 0x88, 0xff, 0xff, 0x0,
3413 0xcc, 0xee, 0x22, 0x22, 0x22, 0x66, 0x44, 0x0, 0x0, 0x55, 0xdd, 0x99, 0x99, 0xff, 0x66, 0x0,
3414 0x0, 0x0, 0xee, 0xee, 0x0, 0x0, 0x0, 0x0, 0x88, 0x88, 0xff, 0xff, 0x88, 0x88, 0x0, 0x0,
3415 0xcc, 0xee, 0x22, 0x22, 0x22, 0xee, 0xcc, 0x0, 0xff, 0xff, 0x0, 0x0, 0x0, 0xff, 0xff, 0x0,
3416 0x0, 0x88, 0xcc, 0xee, 0xcc, 0x88, 0x0, 0x0, 0xff, 0xff, 0x11, 0x0, 0x11, 0xff, 0xff, 0x0,
3417 0xee, 0xee, 0xcc, 0x88, 0xcc, 0xee, 0xee, 0x0, 0xff, 0xff, 0x11, 0x33, 0x11, 0xff, 0xff, 0x0,
3418 0x66, 0xee, 0xcc, 0x88, 0xcc, 0xee, 0x66, 0x0, 0xcc, 0xee, 0x77, 0x33, 0x77, 0xee, 0xcc, 0x0,
3419 0x0, 0x0, 0xee, 0xee, 0x0, 0x0, 0x0, 0x0, 0xee, 0xff, 0x11, 0x11, 0xff, 0xee, 0x0, 0x0,
3420 0x22, 0x22, 0x22, 0xaa, 0xee, 0xee, 0x66, 0x0, 0xcc, 0xee, 0xff, 0xbb, 0x99, 0x88, 0x88, 0x0,
3421 0x0, 0x0, 0x0, 0x0, 0x88, 0x22, 0x0, 0x0, 0x0, 0xcc, 0xee, 0xff, 0x33, 0x0, 0x0, 0x0,
3422 0xcc, 0x22, 0x11, 0x55, 0x55, 0x99, 0x22, 0xcc, 0x33, 0x44, 0x88, 0xaa, 0xaa, 0x99, 0x44, 0x33,
3423 0x0, 0x0, 0x0, 0x0, 0x88, 0x88, 0x88, 0xee, 0x22, 0x22, 0x0, 0x11, 0x22, 0x22, 0x22, 0x33,
3424 0xaa, 0xaa, 0xaa, 0x22, 0x0, 0x0, 0x0, 0xee, 0x22, 0x22, 0x22, 0x11, 0x0, 0x22, 0x22, 0x33,
3425 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x44, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x22,
3426 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
3427 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
3428 0x33, 0x77, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x33, 0x33, 0x33, 0x33, 0x0,
3429 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, 0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 0xee, 0xcc, 0x88, 0xcc, 0xee, 0x0, 0x0, 0x0, 0x11, 0x33, 0x33, 0x77, 0x77,
3722 0x0, 0x11, 0xbc, 0x3c, 0xf, 0x8f, 0xff, 0xff, 0x0, 0xff, 0xff, 0x7f, 0x7f, 0xff, 0xff, 0xff,
3723 0xee, 0xcc, 0x88, 0xcc, 0xee, 0xee, 0xcc, 0x0, 0x77, 0x77, 0x33, 0x33, 0x11, 0x0, 0x0, 0x0,
3724 0xbc, 0x3c, 0xf, 0x8f, 0xff, 0xff, 0x11, 0x0, 0xff, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0x0,
3725 0x0, 0xee, 0xcc, 0x88, 0xcc, 0xee, 0xee, 0x88, 0x0, 0x0, 0x0, 0x11, 0x33, 0x33, 0x77, 0x77,
3726 0x0, 0x11, 0xff, 0xcf, 0x8f, 0x8f, 0xcf, 0xff, 0x0, 0xff, 0xff, 0x7f, 0xf3, 0xf3, 0x7f, 0xff,
3727 0x88, 0xee, 0xee, 0xcc, 0x88, 0xcc, 0xee, 0x0, 0x77, 0x77, 0x33, 0x33, 0x11, 0x0, 0x0, 0x0,
3728 0xff, 0xcf, 0x8f, 0x8f, 0xcf, 0xff, 0x11, 0x0, 0xff, 0x7f, 0xf3, 0xf3, 0x7f, 0xff, 0xff, 0x0,
3729 0x0, 0xcc, 0xee, 0xee, 0xcc, 0x88, 0xcc, 0xee, 0x0, 0x0, 0x0, 0x11, 0x33, 0x33, 0x77, 0x77,
3730 0x0, 0x11, 0xff, 0xcf, 0x8f, 0x8f, 0xcf, 0xff, 0x0, 0xff, 0xff, 0x7f, 0xf3, 0xf3, 0x7f, 0xff,
3731 0xee, 0xcc, 0x88, 0xcc, 0xee, 0xee, 0xcc, 0x0, 0x77, 0x77, 0x33, 0x33, 0x11, 0x0, 0x0, 0x0,
3732 0xff, 0xcf, 0x8f, 0x8f, 0xcf, 0xff, 0x11, 0x0, 0xff, 0x7f, 0xf3, 0xf3, 0x7f, 0xff, 0xff, 0x0,
3733 0x0, 0xee, 0xcc, 0x88, 0xcc, 0xee, 0xee, 0x88, 0x0, 0x0, 0x0, 0x11, 0x33, 0x33, 0x77, 0x77,
3734 0x0, 0x11, 0xff, 0xff, 0x8f, 0xf, 0x3c, 0xbc, 0x0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x7f, 0xff,
3735 0x88, 0xee, 0xee, 0xcc, 0x88, 0xcc, 0xee, 0x0, 0x77, 0x77, 0x33, 0x33, 0x11, 0x0, 0x0, 0x0,
3736 0xff, 0xff, 0x8f, 0xf, 0x3c, 0xbc, 0x11, 0x0, 0xff, 0xff, 0xff, 0x7f, 0x7f, 0xff, 0xff, 0x0,
3737 0x0, 0xcc, 0xee, 0xee, 0xcc, 0x88, 0xcc, 0xee, 0x0, 0x0, 0x0, 0x11, 0x33, 0x33, 0x77, 0x77,
3738 0x0, 0x11, 0xff, 0xff, 0x8f, 0xf, 0x3c, 0xbc, 0x0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x7f, 0xff,
3739 0xee, 0xcc, 0x88, 0xcc, 0xee, 0xee, 0xcc, 0x0, 0x77, 0x77, 0x33, 0x33, 0x11, 0x0, 0x0, 0x0,
3740 0xff, 0xff, 0x8f, 0xf, 0x3c, 0xbc, 0x11, 0x0, 0xff, 0xff, 0xff, 0x7f, 0x7f, 0xff, 0xff, 0x0,
3741 0x0, 0xee, 0xcc, 0x88, 0xcc, 0xee, 0xee, 0x88, 0x0, 0x0, 0x0, 0x1, 0x30, 0x30, 0x67, 0x77,
3742 0x0, 0x11, 0xff, 0x3f, 0x1f, 0x1f, 0x3f, 0xff, 0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
3743 0x88, 0xee, 0xee, 0xcc, 0x88, 0xcc, 0xee, 0x0, 0x77, 0x67, 0x30, 0x30, 0x1, 0x0, 0x0, 0x0,
3744 0xff, 0x3f, 0x1f, 0x1f, 0x3f, 0xff, 0x11, 0x0, 0xff, 0xff, 0xff,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x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x11, 0x33, 0x33, 0x77, 0x77,
3770 0x0, 0x0, 0x77, 0xff, 0xff, 0xff, 0xee, 0xcc, 0x0, 0x0, 0xcc, 0xcc, 0x88, 0x0, 0x0, 0x0,
3771 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x77, 0x77, 0x77, 0x33, 0x33, 0x11, 0x0, 0x0,
3772 0x88, 0xcc, 0xee, 0xff, 0xff, 0xff, 0x77, 0x0, 0x0, 0x0, 0x0, 0x0, 0x88, 0xcc, 0xcc, 0x0,
3773 0x0, 0x0, 0x0, 0x0, 0x88, 0x88, 0xcc, 0xcc, 0x0, 0x0, 0x0, 0x11, 0x33, 0x33, 0x77, 0x77,
3774 0x0, 0x0, 0x0, 0x88, 0x88, 0xcc, 0xcc, 0xcc, 0x0, 0x0, 0x0, 0x33, 0x33, 0x77, 0x77, 0x77,
3775 0xcc, 0xcc, 0xcc, 0x88, 0x88, 0x0, 0x0, 0x0, 0x77, 0x77, 0x77, 0x33, 0x33, 0x11, 0x0, 0x0,
3776 0xee, 0xee, 0xee, 0xff, 0xff, 0xff, 0x77, 0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcc, 0x0,
3777 0x0, 0x0, 0x0, 0x0, 0x88, 0x88, 0x0, 0x0, 0x0, 0x0, 0x0, 0x11, 0x33, 0x33, 0x77, 0x77,
3778 0x0, 0x0, 0x77, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0xcc, 0xff, 0xff, 0xff, 0xee, 0x0,
3779 0x0, 0x0, 0x0, 0x88, 0x88, 0x0, 0x0, 0x0, 0x77, 0x77, 0x77, 0x33, 0x33, 0x11, 0x0, 0x0,
3780 0xcc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x77, 0x0, 0x0, 0x0, 0xee, 0xff, 0xff, 0xff, 0xcc, 0x0,
3781 0x0, 0x0, 0x0, 0x0, 0x88, 0x88, 0xcc, 0xcc, 0x0, 0x0, 0x0, 0x11, 0x33, 0x33, 0x77, 0x77,
3782 0x0, 0x0, 0x77, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0xcc, 0xff, 0xff, 0xff, 0xff, 0xff,
3783 0xcc, 0xcc, 0xcc, 0x88, 0x88, 0x0, 0x0, 0x0, 0x77, 0x77, 0x77, 0x33, 0x33, 0x11, 0x0, 0x0,
3784 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x77, 0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcc, 0x0,
3785 0x1, 0x2, 0x4, 0xc, 0x8, 0x84, 0x84, 0x8, 0x1, 0x0, 0x0, 0x0, 0x9, 0x5, 0x3, 0x0,
3786 0x0, 0x8, 0x7, 0x78, 0xfa, 0xf5, 0xea, 0x7b, 0x0, 0x0, 0x0, 0xb, 0xb5, 0xea, 0x77, 0x32,
3787 0x8, 0x84, 0x84, 0x8, 0xc, 0x4, 0x2, 0x1, 0x0, 0x1, 0x1, 0x1, 0x3, 0x4, 0x8, 0x0,
3788 0x26, 0x5d, 0xb2, 0x7c, 0x7, 0x0, 0x0, 0x0, 0x72, 0xe6, 0xcc, 0xfc, 0xe3, 0xe, 0x0, 0x0,
3789 0x0, 0x60, 0x60, 0xe0, 0xe0, 0xe8, 0xcc, 0x88, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x67, 0x77,
3790 0x0, 0x11, 0xff, 0x3f, 0x1f, 0x1f, 0x3f, 0xff, 0x0, 0x0, 0xf0, 0xf8, 0xfd, 0xff, 0xff, 0xff,
3791 0x88, 0xee, 0xee, 0xcc, 0x88, 0xcc, 0xee, 0x0, 0x77, 0x67, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0,
3792 0xff, 0x3f, 0x1f, 0x1f, 0x3f, 0xff, 0x11, 0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0,
3793 0x0, 0x60, 0x60, 0xe0, 0xe0, 0xe8, 0xcc, 0x88, 0x0, 0x0, 0x0, 0x11, 0x23, 0x23, 0x77, 0x77,
3794 0x0, 0x11, 0xff, 0x1d, 0xc, 0xf, 0x1f, 0xff, 0x0, 0x0, 0xf0, 0xf8, 0xfd, 0xff, 0xff, 0xff,
3795 0x88, 0xee, 0xee, 0xcc, 0x88, 0xcc, 0xee, 0x0, 0x77, 0x77, 0x23, 0x23, 0x11, 0x0, 0x0, 0x0,
3796 0xff, 0x1d, 0xc, 0xf, 0x1f, 0xff, 0x11, 0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0,
3797 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x11, 0x11, 0x0, 0x0, 0x0, 0x0,
3798 0x0, 0x0, 0xff, 0xff, 0xff, 0x77, 0x33, 0x11, 0x0, 0x0, 0x0, 0xcc, 0xee, 0xee, 0xff, 0xff,
3799 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x11, 0x11, 0x0,
3800 0x0, 0x11, 0x33, 0x77, 0xff, 0xff, 0xff, 0x0, 0xff, 0xff, 0xff, 0xee, 0xee, 0xcc, 0x0, 0x0,
3801 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
3802 0x0, 0x77, 0xff, 0x77, 0x77, 0x33, 0x11, 0x11, 0x0, 0x0, 0xcc, 0xee, 0xee, 0xff, 0xff, 0xff,
3803 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
3804 0x0, 0x11, 0x11, 0x33, 0x77, 0x77, 0xff, 0x77, 0xee, 0xff, 0xff, 0xff, 0xee, 0xee, 0xcc, 0x0,
3805 0x0, 0x0, 0x0, 0x0, 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 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
3843 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
3844 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
3845 };
3846
3847
3848 static const uint8_tcxx . . $ uint8_t# rom_hwcolorscxx . . $ rom_hwcolors.[32] = {
3849 0x0, 0x7, 0x66, 0xef, 0x0, 0xf8, 0xea, 0x6f, 0x0, 0x3f, 0x0, 0xc9, 0x38, 0xaa, 0xaf, 0xf6,
3850 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
3851 };
3852
3853 static const uint8_tcxx . . $ uint8_t# rom_palettecxx . . $ rom_palette.[256] = {
3854 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xb, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xb, 0x3,
3855 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xb, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xb, 0x7,
3856 0x0, 0x0, 0x0, 0x0, 0x0, 0xb, 0x1, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
3857 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0x0, 0xe, 0x0, 0x1, 0xc, 0xf,
3858 0x0, 0xe, 0x0, 0xb, 0x0, 0xc, 0xb, 0xe, 0x0, 0xc, 0xf, 0x1, 0x0, 0x0, 0x0, 0x0,
3859 0x0, 0x1, 0x2, 0xf, 0x0, 0x7, 0xc, 0x2, 0x0, 0x9, 0x6, 0xf, 0x0, 0xd, 0x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 0x1, 0x0,
3887 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf,
3888 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf,
3889 };
3890
3891 /*== SOUND EFFECT REGISTER DUMPS =============================================*/
3892
3893 /*
3894 Each line is a 'register dump' for one 60Hz tick. Each 32-bit number
3895 encodes the per-voice values for frequency, waveform and volume:
3896
3897 31 0 bit
3898 |vvvv-www----ffffffffffffffffffff|
3899 | | |
3900 | | +-- 20 bits frequency
3901 | +-- 3 bits waveform
3902 +-- 4 bits volume
3903 */
3904 static const uint32_tcxx . . $ uint32_t# snd_dump_preludecxx . . $ snd_dump_prelude.[490] = {
3905 0xE20002E0, 0xF0001700,
3906 0xD20002E0, 0xF0001700,
3907 0xC20002E0, 0xF0001700,
3908 0xB20002E0, 0xF0001700,
3909 0xA20002E0, 0xF0000000,
3910 0x920002E0, 0xF0000000,
3911 0x820002E0, 0xF0000000,
3912 0x720002E0, 0xF0000000,
3913 0x620002E0, 0xF0002E00,
3914 0x520002E0, 0xF0002E00,
3915 0x420002E0, 0xF0002E00,
3916 0x320002E0, 0xF0002E00,
3917 0x220002E0, 0xF0000000,
3918 0x120002E0, 0xF0000000,
3919 0x020002E0, 0xF0000000,
3920 0xE2000000, 0xF0002280,
3921 0xD2000000, 0xF0002280,
3922 0xC2000000, 0xF0002280,
3923 0xB2000000, 0xF0002280,
3924 0xA2000000, 0xF0000000,
3925 0x92000000, 0xF0000000,
3926 0x82000000, 0xF0000000,
3927 0x72000000, 0xF0000000,
3928 0xE2000450, 0xF0001D00,
3929 0xD2000450, 0xF0001D00,
3930 0xC2000450, 0xF0001D00,
3931 0xB2000450, 0xF0001D00,
3932 0xA2000450, 0xF0000000,
3933 0x92000450, 0xF0000000,
3934 0x82000450, 0xF0000000,
3935 0x72000450, 0xF0000000,
3936 0xE20002E0, 0xF0002E00,
3937 0xD20002E0, 0xF0002E00,
3938 0xC20002E0, 0xF0002E00,
3939 0xB20002E0, 0xF0002E00,
3940 0xA20002E0, 0xF0002280,
3941 0x920002E0, 0xF0002280,
3942 0x820002E0, 0xF0002280,
3943 0x720002E0, 0xF0002280,
3944 0x620002E0, 0xF0000000,
3945 0x520002E0, 0xF0000000,
3946 0x420002E0, 0xF0000000,
3947 0x320002E0, 0xF0000000,
3948 0x220002E0, 0xF0000000,
3949 0x120002E0, 0xF0000000,
3950 0x020002E0, 0xF0000000,
3951 0xE2000000, 0xF0001D00,
3952 0xD2000000, 0xF0001D00,
3953 0xC2000000, 0xF0001D00,
3954 0xB2000000, 0xF0001D00,
3955 0xA2000000, 0xF0001D00,
3956 0x92000000, 0xF0001D00,
3957 0x82000000, 0xF0001D00,
3958 0x72000000, 0xF0001D00,
3959 0xE2000450, 0xF0000000,
3960 0xD2000450, 0xF0000000,
3961 0xC2000450, 0xF0000000,
3962 0xB2000450, 0xF0000000,
3963 0xA2000450, 0xF0000000,
3964 0x92000450, 0xF0000000,
3965 0x82000450, 0xF0000000,
3966 0x72000450, 0xF0000000,
3967 0xE2000308, 0xF0001840,
3968 0xD2000308, 0xF0001840,
3969 0xC2000308, 0xF0001840,
3970 0xB2000308, 0xF0001840,
3971 0xA2000308, 0xF0000000,
3972 0x92000308, 0xF0000000,
3973 0x82000308, 0xF0000000,
3974 0x72000308, 0xF0000000,
3975 0x62000308, 0xF00030C0,
3976 0x52000308, 0xF00030C0,
3977 0x42000308, 0xF00030C0,
3978 0x32000308, 0xF00030C0,
3979 0x22000308, 0xF0000000,
3980 0x12000308, 0xF0000000,
3981 0x02000308, 0xF0000000,
3982 0xE2000000, 0xF0002480,
3983 0xD2000000, 0xF0002480,
3984 0xC2000000, 0xF0002480,
3985 0xB2000000, 0xF0002480,
3986 0xA2000000, 0xF0000000,
3987 0x92000000, 0xF0000000,
3988 0x82000000, 0xF0000000,
3989 0x72000000, 0xF0000000,
3990 0xE2000490, 0xF0001EC0,
3991 0xD2000490, 0xF0001EC0,
3992 0xC2000490, 0xF0001EC0,
3993 0xB2000490, 0xF0001EC0,
3994 0xA2000490, 0xF0000000,
3995 0x92000490, 0xF0000000,
3996 0x82000490, 0xF0000000,
3997 0x72000490, 0xF0000000,
3998 0xE2000308, 0xF00030C0,
3999 0xD2000308, 0xF00030C0,
4000 0xC2000308, 0xF00030C0,
4001 0xB2000308, 0xF00030C0,
4002 0xA2000308, 0xF0002480,
4003 0x92000308, 0xF0002480,
4004 0x82000308, 0xF0002480,
4005 0x72000308, 0xF0002480,
4006 0x62000308, 0xF0000000,
4007 0x52000308, 0xF0000000,
4008 0x42000308, 0xF0000000,
4009 0x32000308, 0xF0000000,
4010 0x22000308, 0xF0000000,
4011 0x12000308, 0xF0000000,
4012 0x02000308, 0xF0000000,
4013 0xE2000000, 0xF0001EC0,
4014 0xD2000000, 0xF0001EC0,
4015 0xC2000000, 0xF0001EC0,
4016 0xB2000000, 0xF0001EC0,
4017 0xA2000000, 0xF0001EC0,
4018 0x92000000, 0xF0001EC0,
4019 0x82000000, 0xF0001EC0,
4020 0x72000000, 0xF0001EC0,
4021 0xE2000490, 0xF0000000,
4022 0xD2000490, 0xF0000000,
4023 0xC2000490, 0xF0000000,
4024 0xB2000490, 0xF0000000,
4025 0xA2000490, 0xF0000000,
4026 0x92000490, 0xF0000000,
4027 0x82000490, 0xF0000000,
4028 0x72000490, 0xF0000000,
4029 0xE20002E0, 0xF0001700,
4030 0xD20002E0, 0xF0001700,
4031 0xC20002E0, 0xF0001700,
4032 0xB20002E0, 0xF0001700,
4033 0xA20002E0, 0xF0000000,
4034 0x920002E0, 0xF0000000,
4035 0x820002E0, 0xF0000000,
4036 0x720002E0, 0xF0000000,
4037 0x620002E0, 0xF0002E00,
4038 0x520002E0, 0xF0002E00,
4039 0x420002E0, 0xF0002E00,
4040 0x320002E0, 0xF0002E00,
4041 0x220002E0, 0xF0000000,
4042 0x120002E0, 0xF0000000,
4043 0x020002E0, 0xF0000000,
4044 0xE2000000, 0xF0002280,
4045 0xD2000000, 0xF0002280,
4046 0xC2000000, 0xF0002280,
4047 0xB2000000, 0xF0002280,
4048 0xA2000000, 0xF0000000,
4049 0x92000000, 0xF0000000,
4050 0x82000000, 0xF0000000,
4051 0x72000000, 0xF0000000,
4052 0xE2000450, 0xF0001D00,
4053 0xD2000450, 0xF0001D00,
4054 0xC2000450, 0xF0001D00,
4055 0xB2000450, 0xF0001D00,
4056 0xA2000450, 0xF0000000,
4057 0x92000450, 0xF0000000,
4058 0x82000450, 0xF0000000,
4059 0x72000450, 0xF0000000,
4060 0xE20002E0, 0xF0002E00,
4061 0xD20002E0, 0xF0002E00,
4062 0xC20002E0, 0xF0002E00,
4063 0xB20002E0, 0xF0002E00,
4064 0xA20002E0, 0xF0002280,
4065 0x920002E0, 0xF0002280,
4066 0x820002E0, 0xF0002280,
4067 0x720002E0, 0xF0002280,
4068 0x620002E0, 0xF0000000,
4069 0x520002E0, 0xF0000000,
4070 0x420002E0, 0xF0000000,
4071 0x320002E0, 0xF0000000,
4072 0x220002E0, 0xF0000000,
4073 0x120002E0, 0xF0000000,
4074 0x020002E0, 0xF0000000,
4075 0xE2000000, 0xF0001D00,
4076 0xD2000000, 0xF0001D00,
4077 0xC2000000, 0xF0001D00,
4078 0xB2000000, 0xF0001D00,
4079 0xA2000000, 0xF0001D00,
4080 0x92000000, 0xF0001D00,
4081 0x82000000, 0xF0001D00,
4082 0x72000000, 0xF0001D00,
4083 0xE2000450, 0xF0000000,
4084 0xD2000450, 0xF0000000,
4085 0xC2000450, 0xF0000000,
4086 0xB2000450, 0xF0000000,
4087 0xA2000450, 0xF0000000,
4088 0x92000450, 0xF0000000,
4089 0x82000450, 0xF0000000,
4090 0x72000450, 0xF0000000,
4091 0xE2000450, 0xF0001B40,
4092 0xD2000450, 0xF0001B40,
4093 0xC2000450, 0xF0001B40,
4094 0xB2000450, 0xF0001B40,
4095 0xA2000450, 0xF0001D00,
4096 0x92000450, 0xF0001D00,
4097 0x82000450, 0xF0001D00,
4098 0x72000450, 0xF0001D00,
4099 0x62000450, 0xF0001EC0,
4100 0x52000450, 0xF0001EC0,
4101 0x42000450, 0xF0001EC0,
4102 0x32000450, 0xF0001EC0,
4103 0x22000450, 0xF0000000,
4104 0x12000450, 0xF0000000,
4105 0x02000450, 0xF0000000,
4106 0xE20004D0, 0xF0001EC0,
4107 0xD20004D0, 0xF0001EC0,
4108 0xC20004D0, 0xF0001EC0,
4109 0xB20004D0, 0xF0001EC0,
4110 0xA20004D0, 0xF0002080,
4111 0x920004D0, 0xF0002080,
4112 0x820004D0, 0xF0002080,
4113 0x720004D0, 0xF0002080,
4114 0x620004D0, 0xF0002280,
4115 0x520004D0, 0xF0002280,
4116 0x420004D0, 0xF0002280,
4117 0x320004D0, 0xF0002280,
4118 0x220004D0, 0xF0000000,
4119 0x120004D0, 0xF0000000,
4120 0x020004D0, 0xF0000000,
4121 0xE2000568, 0xF0002280,
4122 0xD2000568, 0xF0002280,
4123 0xC2000568, 0xF0002280,
4124 0xB2000568, 0xF0002280,
4125 0xA2000568, 0xF0002480,
4126 0x92000568, 0xF0002480,
4127 0x82000568, 0xF0002480,
4128 0x72000568, 0xF0002480,
4129 0x62000568, 0xF0002680,
4130 0x52000568, 0xF0002680,
4131 0x42000568, 0xF0002680,
4132 0x32000568, 0xF0002680,
4133 0x22000568, 0xF0000000,
4134 0x12000568, 0xF0000000,
4135 0x02000568, 0xF0000000,
4136 0xE20005C0, 0xF0002E00,
4137 0xD20005C0, 0xF0002E00,
4138 0xC20005C0, 0xF0002E00,
4139 0xB20005C0, 0xF0002E00,
4140 0xA20005C0, 0xF0002E00,
4141 0x920005C0, 0xF0002E00,
4142 0x820005C0, 0xF0002E00,
4143 0x720005C0, 0xF0002E00,
4144 0x620005C0, 0x00000E80,
4145 0x520005C0, 0x00000E80,
4146 0x420005C0, 0x00000E80,
4147 0x320005C0, 0x00000E80,
4148 0x220005C0, 0x00000E80,
4149 0x120005C0, 0x00000E80,
4150 };
4151
4152 static const uint32_tcxx . . $ uint32_t# snd_dump_deadcxx . . $ snd_dump_dead.[90] = {
4153 0xF1001F00,
4154 0xF1001E00,
4155 0xF1001D00,
4156 0xF1001C00,
4157 0xF1001B00,
4158 0xF1001C00,
4159 0xF1001D00,
4160 0xF1001E00,
4161 0xF1001F00,
4162 0xF1002000,
4163 0xF1002100,
4164 0xE1001D00,
4165 0xE1001C00,
4166 0xE1001B00,
4167 0xE1001A00,
4168 0xE1001900,
4169 0xE1001800,
4170 0xE1001900,
4171 0xE1001A00,
4172 0xE1001B00,
4173 0xE1001C00,
4174 0xE1001D00,
4175 0xE1001E00,
4176 0xD1001B00,
4177 0xD1001A00,
4178 0xD1001900,
4179 0xD1001800,
4180 0xD1001700,
4181 0xD1001600,
4182 0xD1001700,
4183 0xD1001800,
4184 0xD1001900,
4185 0xD1001A00,
4186 0xD1001B00,
4187 0xD1001C00,
4188 0xC1001900,
4189 0xC1001800,
4190 0xC1001700,
4191 0xC1001600,
4192 0xC1001500,
4193 0xC1001400,
4194 0xC1001500,
4195 0xC1001600,
4196 0xC1001700,
4197 0xC1001800,
4198 0xC1001900,
4199 0xC1001A00,
4200 0xB1001700,
4201 0xB1001600,
4202 0xB1001500,
4203 0xB1001400,
4204 0xB1001300,
4205 0xB1001200,
4206 0xB1001300,
4207 0xB1001400,
4208 0xB1001500,
4209 0xB1001600,
4210 0xB1001700,
4211 0xB1001800,
4212 0xA1001500,
4213 0xA1001400,
4214 0xA1001300,
4215 0xA1001200,
4216 0xA1001100,
4217 0xA1001000,
4218 0xA1001100,
4219 0xA1001200,
4220 0x80000800,
4221 0x80001000,
4222 0x80001800,
4223 0x80002000,
4224 0x80002800,
4225 0x80003000,
4226 0x80003800,
4227 0x80004000,
4228 0x80004800,
4229 0x80005000,
4230 0x80005800,
4231 0x00000000,
4232 0x80000800,
4233 0x80001000,
4234 0x80001800,
4235 0x80002000,
4236 0x80002800,
4237 0x80003000,
4238 0x80003800,
4239 0x80004000,
4240 0x80004800,
4241 0x80005000,
4242 0x80005800,
4243 };