| 1 |
///////////////////////////////////////////////cxx . . $ `<file>/src/snipe2d.cpp`/ |
| 2 |
// |
| 3 |
// Snipe2d ludum dare 48h compo entry |
| 4 |
// |
| 5 |
// Jari Komppa aka Sol |
| 6 |
// http://iki.fi/sol |
| 7 |
// |
| 8 |
/////////////////////////////////////////////// |
| 9 |
// License |
| 10 |
/////////////////////////////////////////////// |
| 11 |
// |
| 12 |
// This software is provided 'as-is', without any express or implied |
| 13 |
// warranty. In no event will the authors be held liable for any damages |
| 14 |
// arising from the use of this software. |
| 15 |
// |
| 16 |
// Permission is granted to anyone to use this software for any purpose, |
| 17 |
// including commercial applications, and to alter it and redistribute it |
| 18 |
// freely, subject to the following restrictions: |
| 19 |
// |
| 20 |
// 1. The origin of this software must not be misrepresented; you must not |
| 21 |
// claim that you wrote the original software. If you use this software |
| 22 |
// in a product, an acknowledgment in the product documentation would be |
| 23 |
// appreciated but is not required. |
| 24 |
// 2. Altered source versions must be plainly marked as such, and must not be |
| 25 |
// misrepresented as being the original software. |
| 26 |
// 3. This notice may not be removed or altered from any source distribution. |
| 27 |
// |
| 28 |
// (eg. same as ZLIB license) |
| 29 |
// |
| 30 |
/////////////////////////////////////////////// |
| 31 |
// |
| 32 |
// Houses are taken from a satellite picture of glasgow. |
| 33 |
// |
| 34 |
// The sources are a mess, as I didn't even try to do anything |
| 35 |
// really organized here.. and hey, it's a 48h compo =) |
| 36 |
// |
| 37 |
|
| 38 |
#include "snipe2d.h"cxx . . $ `<file>/src/snipe2d.h`/ |
| 39 |
//#include <getopt.h> |
| 40 |
#include "binds.h"cxx . . $ `<file>/src/binds.h`/ |
| 41 |
|
| 42 |
PREFScxx . . $ PREFS# gPrefscxx . . $ gPrefs.; |
| 43 |
|
| 44 |
typedef struct oes_joy_tcxx . . $ oes_joy_t# { |
| 45 |
int stylecxx . . $ oes_joy_t#style.; /* axis style: rel (game) or abs (mousepad) */ //not used yet |
| 46 |
float scalecxx . . $ oes_joy_t#scale.; /* scaling factor. */ |
| 47 |
int intervalcxx . . $ oes_joy_t#interval.; /* handling interval, in milliseconds. */ |
| 48 |
|
| 49 |
int timecxx . . $ oes_joy_t#time.; /* timestamp of last handling. */ |
| 50 |
int axescxx . . $ oes_joy_t#axes.; /* number of axes */ |
| 51 |
int buttonscxx . . $ oes_joy_t#buttons.; /* number of buttons. */ |
| 52 |
int statecxx . . $ oes_joy_t#state.; /* joy shifter state. */ |
| 53 |
float xcxx . . $ oes_joy_t#x.; /* X axis. */ |
| 54 |
float ycxx . . $ oes_joy_t#y.; /* Y axis. */ |
| 55 |
float zcxx . . $ oes_joy_t#z.; /* throttle? */ |
| 56 |
SDL_Joystick* sdljoycxx . . $ oes_joy_t#sdljoy.; /* SDL Joystick handle. */ |
| 57 |
#if 0 |
| 58 |
/* bindings for 32 axes and 32 buttons. */ |
| 59 |
oesbind_t axis[32]; |
| 60 |
oesbind_t button[32]; |
| 61 |
#endif /* 0 */ |
| 62 |
} oes_joy_tcxx . . $ oes_joy_t#; |
| 63 |
|
| 64 |
oes_joy_tcxx . . $ oes_joy_t# oesjoycxx . . $ oesjoy. = { 0, }; |
| 65 |
|
| 66 |
|
| 67 |
struct keymarkers_tcxx . . $ keymarkers_t# { |
| 68 |
int mousexcxx . . $ keymarkers_t#mousex.; |
| 69 |
int mouseycxx . . $ keymarkers_t#mousey.; |
| 70 |
int mouse0cxx . . $ keymarkers_t#mouse0.; |
| 71 |
int axis1cxx . . $ keymarkers_t#axis1.; |
| 72 |
int joy1cxx . . $ keymarkers_t#joy1.; |
| 73 |
} keymarkerscxx . . $ keymarkers.; |
| 74 |
|
| 75 |
|
| 76 |
ORBITALSNIPERcxx . . $ ORBITALSNIPER# Gamecxx . . $ Game.; |
| 77 |
|
| 78 |
|
| 79 |
//char *mediaPath; |
| 80 |
|
| 81 |
//int gPlaySound = 0; |
| 82 |
int screen_shot_numbercxx . . $ screen_shot_number.=1; |
| 83 |
char *invocationcxx . . $ invocation.; |
| 84 |
|
| 85 |
#if 0 |
| 86 |
BUTTONS gButton; |
| 87 |
#endif /* 0 */ |
| 88 |
|
| 89 |
static const char *crosshairs_xpmcxx . . $ crosshairs_xpm.[] = { |
| 90 |
" 16 16 3 1", |
| 91 |
"X c #000000", |
| 92 |
". c #ffffff", |
| 93 |
" c None", |
| 94 |
" ", |
| 95 |
" . ", |
| 96 |
" ..... ", |
| 97 |
" . . . ", |
| 98 |
" . . . ", |
| 99 |
" . . ", |
| 100 |
" . . ", |
| 101 |
" .... . .... ", |
| 102 |
" . . ", |
| 103 |
" . . ", |
| 104 |
" . . . ", |
| 105 |
" . . . ", |
| 106 |
" ..... ", |
| 107 |
" . ", |
| 108 |
" ", |
| 109 |
" ", |
| 110 |
"8,8" |
| 111 |
}; |
| 112 |
|
| 113 |
#if 0 |
| 114 |
//SDL_AudioSpec *gAudioSpec = NULL; |
| 115 |
Mix_Chunk *gAudioZoomSample = NULL; |
| 116 |
Mix_Chunk *gAudioFireSample = NULL; |
| 117 |
Mix_Chunk *gAudioZoomOut = NULL; |
| 118 |
Mix_Chunk *gAudioZoomIn = NULL; |
| 119 |
Mix_Chunk *gAudioFire = NULL; |
| 120 |
//Mix_Music *gAudioBGM = NULL; |
| 121 |
int gAudioZoomSampleLen = 0; |
| 122 |
int gAudioZoomOutLen = 0; |
| 123 |
int gAudioZoomInLen = 0; |
| 124 |
int gAudioZoomOfs = 0; |
| 125 |
int gAudioFireOfs = 0; |
| 126 |
int gAudioFireSampleLen = 0; |
| 127 |
int gAudioFireLen = 0; |
| 128 |
#endif /* 0 */ |
| 129 |
|
| 130 |
|
| 131 |
const char *usagecxx . . $ usage. = \ |
| 132 |
"Usage: %s [OPTIONS]...\n\ |
| 133 |
Overhead shooting game; kill red marks, protect blue marks, avoid white marks.\n\ |
| 134 |
\n\ |
| 135 |
Orbital Eunuchs Sniper recognizes the following command parameters:\n\ |
| 136 |
-a | --audio Start with sound\n\ |
| 137 |
-n | --noaudio Start without sound\n\ |
| 138 |
-f | --fullscreen Start in fullscreen mode\n\ |
| 139 |
-w | --window Start in a window\n\ |
| 140 |
-1 | --diff1 Difficulty 1 (Easy)\n\ |
| 141 |
-2 | --diff2 Difficulty 2 (Medium)\n\ |
| 142 |
-3 | --diff3 Difficulty 3 (Hard)\n\ |
| 143 |
-h | --help Display this help message and exit\n\ |
| 144 |
\n\ |
| 145 |
Orbital Eunuchs Sniper is licensed under the same terms as the ZLIB license.\n\ |
| 146 |
\n"; |
| 147 |
/* -d 1|2|3 | --difficulty 1|2|3 Set difficulty level (1 is easiest)\n\ */ |
| 148 |
|
| 149 |
|
| 150 |
/* Set SDL cursor. */ |
| 151 |
void |
| 152 |
oes_cursorcxx . . $ oes_cursor(49f6e7a06ebc5aa8). () |
| 153 |
{ |
| 154 |
int i, row, col; |
| 155 |
Uint8cxx . . $ Uint8# data[4*16]; |
| 156 |
Uint8cxx . . $ Uint8# mask[4*16]; |
| 157 |
int hot_x, hot_y; |
| 158 |
const char **image; |
| 159 |
SDL_Cursor *cursor; |
| 160 |
|
| 161 |
image = crosshairs_xpmcxx . . $ crosshairs_xpm.; |
| 162 |
i = -1; |
| 163 |
for ( row=0; row<16; ++row ) { |
| 164 |
for ( col=0; col<16; ++col ) { |
| 165 |
if ( col % 8 ) { |
| 166 |
data[i] <<= 1; |
| 167 |
mask[i] <<= 1; |
| 168 |
} else { |
| 169 |
++i; |
| 170 |
data[i] = mask[i] = 0; |
| 171 |
} |
| 172 |
switch (image[4+row][col]) { |
| 173 |
case 'X': |
| 174 |
data[i] |= 0x01; |
| 175 |
mask[i] |= 0x01; |
| 176 |
break; |
| 177 |
case '.': |
| 178 |
mask[i] |= 0x01; |
| 179 |
break; |
| 180 |
case ' ': |
| 181 |
break; |
| 182 |
} |
| 183 |
} |
| 184 |
} |
| 185 |
sscanf(image[4+row], "%d,%d", &hot_x, &hot_y); |
| 186 |
cursor = SDL_CreateCursor(data, mask, 16, 16, hot_x, hot_y); |
| 187 |
SDL_SetCursor (cursor); |
| 188 |
} |
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
/********************/ |
| 196 |
/* Background Music */ |
| 197 |
/********************/ |
| 198 |
|
| 199 |
|
| 200 |
/* Function for SDL_mixer */ |
| 201 |
static void oes_bgm_loopcxx . . $ oes_bgm_loop(49f6e7a06ebc5aa8).() |
| 202 |
{ |
| 203 |
sniperbgm_loopcxx . . $ sniperbgm_loop(4db74b65ed7f6c67).(Gamecxx . . $ Game..BGMcxx . . $ orbitalsniper_t#BGM.); |
| 204 |
} |
| 205 |
|
| 206 |
|
| 207 |
sniperbgm_tcxx . . $ sniperbgm_t# * |
| 208 |
sniperbgm_initcxx . . $ sniperbgm_init(74624cd5faa1f97e). (sniperbgm_tcxx . . $ sniperbgm_t# *self) |
| 209 |
{ |
| 210 |
if (!self) |
| 211 |
self = (sniperbgm_tcxx . . $ sniperbgm_t#*)calloc(1, sizeof(*self)); |
| 212 |
self->BGMcxx . . $ sniperbgm_t#BGM. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 213 |
self->playpcxx . . $ sniperbgm_t#playp. = 0; |
| 214 |
self->pausepcxx . . $ sniperbgm_t#pausep. = 0; |
| 215 |
return self; |
| 216 |
} |
| 217 |
|
| 218 |
sniperbgm_tcxx . . $ sniperbgm_t# * |
| 219 |
sniperbgm_init_musiccxx . . $ sniperbgm_init_music(26a9d92e68a31028). (sniperbgm_tcxx . . $ sniperbgm_t# *self, Mix_Music *m) |
| 220 |
{ |
| 221 |
if ((self = sniperbgm_initcxx . . $ sniperbgm_init(74624cd5faa1f97e).(self))) |
| 222 |
{ |
| 223 |
// SniperBGM(); |
| 224 |
self->BGMcxx . . $ sniperbgm_t#BGM. = m; |
| 225 |
} |
| 226 |
return self; |
| 227 |
} |
| 228 |
|
| 229 |
void |
| 230 |
sniperbgm_deletecxx . . $ sniperbgm_delete(4db74b65ed7f6c67). (sniperbgm_tcxx . . $ sniperbgm_t# *self) |
| 231 |
{ |
| 232 |
sniperbgm_stopcxx . . $ sniperbgm_stop(4db74b65ed7f6c67).(self); /* Don't wait for fadeout to finish. */ |
| 233 |
Mix_FreeMusic(self->BGMcxx . . $ sniperbgm_t#BGM.); |
| 234 |
free(self); |
| 235 |
} |
| 236 |
|
| 237 |
Mix_Music * |
| 238 |
sniperbgm_musiccxx . . $ sniperbgm_music(2094606d626ac5db). (sniperbgm_tcxx . . $ sniperbgm_t# *self) |
| 239 |
{ |
| 240 |
return self->BGMcxx . . $ sniperbgm_t#BGM.; |
| 241 |
} |
| 242 |
|
| 243 |
int |
| 244 |
sniperbgm_usecxx . . $ sniperbgm_use(f56ea5b978ff069f). (sniperbgm_tcxx . . $ sniperbgm_t# *self, Mix_Music *m) |
| 245 |
{ |
| 246 |
if (!m) return 0; |
| 247 |
self->BGMcxx . . $ sniperbgm_t#BGM. = m; |
| 248 |
return 1; |
| 249 |
} |
| 250 |
|
| 251 |
void |
| 252 |
sniperbgm_startcxx . . $ sniperbgm_start(4db74b65ed7f6c67). (sniperbgm_tcxx . . $ sniperbgm_t# *self) |
| 253 |
{ |
| 254 |
if (self->BGMcxx . . $ sniperbgm_t#BGM.) |
| 255 |
{ |
| 256 |
if (Mix_PlayMusic(self->BGMcxx . . $ sniperbgm_t#BGM., 0)) |
| 257 |
printf("Mix_PlayMusic: %s\n", Mix_GetErrorcxx . . $ `<external>/13318562018335047551/SDL_mixer.h:626:9`!()); |
| 258 |
} |
| 259 |
Mix_HookMusicFinished(oes_bgm_loopcxx . . $ oes_bgm_loop(49f6e7a06ebc5aa8).); |
| 260 |
self->playpcxx . . $ sniperbgm_t#playp. = 1; |
| 261 |
self->time_startcxx . . $ sniperbgm_t#time_start. = SDL_GetTicks(); |
| 262 |
} |
| 263 |
|
| 264 |
void |
| 265 |
sniperbgm_stimulatecxx . . $ sniperbgm_stimulate(4db74b65ed7f6c67). (sniperbgm_tcxx . . $ sniperbgm_t# *self) |
| 266 |
{ |
| 267 |
if (self->playpcxx . . $ sniperbgm_t#playp.) return; |
| 268 |
if (Mix_FadeInMusic(self->BGMcxx . . $ sniperbgm_t#BGM., 0, sniperbgm_FadeInTimecxx . . $ `src/snipe2d.h:242:9`!)) |
| 269 |
printf("Mix_PlayMusic: %s\n", Mix_GetErrorcxx . . $ `<external>/13318562018335047551/SDL_mixer.h:626:9`!()); |
| 270 |
Mix_HookMusicFinished(oes_bgm_loopcxx . . $ oes_bgm_loop(49f6e7a06ebc5aa8).); |
| 271 |
self->playpcxx . . $ sniperbgm_t#playp. = 1; |
| 272 |
self->time_startcxx . . $ sniperbgm_t#time_start. = SDL_GetTicks(); |
| 273 |
} |
| 274 |
|
| 275 |
void |
| 276 |
sniperbgm_depresscxx . . $ sniperbgm_depress(4db74b65ed7f6c67). (sniperbgm_tcxx . . $ sniperbgm_t# *self) |
| 277 |
{ |
| 278 |
Mix_HookMusicFinished(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 279 |
if (!Mix_FadeOutMusic(sniperbgm_FadeOutTimecxx . . $ `src/snipe2d.h:243:9`!)) |
| 280 |
Mix_HaltMusic(); |
| 281 |
self->playpcxx . . $ sniperbgm_t#playp. = 0; |
| 282 |
} |
| 283 |
|
| 284 |
void |
| 285 |
sniperbgm_stopcxx . . $ sniperbgm_stop(4db74b65ed7f6c67). (sniperbgm_tcxx . . $ sniperbgm_t# *self) |
| 286 |
{ |
| 287 |
Mix_HaltMusic(); |
| 288 |
Mix_HookMusicFinished(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 289 |
self->playpcxx . . $ sniperbgm_t#playp. = 0; |
| 290 |
} |
| 291 |
|
| 292 |
void |
| 293 |
sniperbgm_pausecxx . . $ sniperbgm_pause(98d8e6f92d821ace). (sniperbgm_tcxx . . $ sniperbgm_t# *self, int newstate) |
| 294 |
{ |
| 295 |
switch (newstate) |
| 296 |
{ |
| 297 |
case 0: /* pause */ |
| 298 |
Mix_PauseMusic(); |
| 299 |
self->pausepcxx . . $ sniperbgm_t#pausep. = 1; |
| 300 |
break; |
| 301 |
case 1: /* resume */ |
| 302 |
Mix_ResumeMusic(); |
| 303 |
self->pausepcxx . . $ sniperbgm_t#pausep. = 0; |
| 304 |
break; |
| 305 |
default: /* toggle */ |
| 306 |
if (self->pausepcxx . . $ sniperbgm_t#pausep.) Mix_ResumeMusic(); else Mix_PauseMusic(); |
| 307 |
self->pausepcxx . . $ sniperbgm_t#pausep. = !self->pausepcxx . . $ sniperbgm_t#pausep.; |
| 308 |
break; |
| 309 |
} |
| 310 |
} |
| 311 |
|
| 312 |
void |
| 313 |
sniperbgm_jumptocxx . . $ sniperbgm_jumpto(356a4784eba0f491). (sniperbgm_tcxx . . $ sniperbgm_t# *self, float pos) |
| 314 |
{ |
| 315 |
Mix_SetMusicPosition(pos); |
| 316 |
} |
| 317 |
|
| 318 |
void |
| 319 |
sniperbgm_rewindcxx . . $ sniperbgm_rewind(4db74b65ed7f6c67). (sniperbgm_tcxx . . $ sniperbgm_t# *self) |
| 320 |
{ |
| 321 |
Mix_RewindMusic(); |
| 322 |
} |
| 323 |
|
| 324 |
void |
| 325 |
sniperbgm_loopcxx . . $ sniperbgm_loop(4db74b65ed7f6c67). (sniperbgm_tcxx . . $ sniperbgm_t# *self) |
| 326 |
{ |
| 327 |
sniperbgm_startcxx . . $ sniperbgm_start(4db74b65ed7f6c67).(self); |
| 328 |
sniperbgm_jumptocxx . . $ sniperbgm_jumpto(356a4784eba0f491).(self, sniperbgm_RepeatJumpPoscxx . . $ `src/snipe2d.h:244:9`!); |
| 329 |
} |
| 330 |
|
| 331 |
void |
| 332 |
sniperbgm_releasecxx . . $ sniperbgm_release(4db74b65ed7f6c67). (sniperbgm_tcxx . . $ sniperbgm_t# *self) |
| 333 |
{ |
| 334 |
/* Prepare for release of sound device. */ |
| 335 |
/* Figure out where in the BGM we currently are. */ |
| 336 |
self->time_stopcxx . . $ sniperbgm_t#time_stop. = SDL_GetTicks(); |
| 337 |
self->bookmarkcxx . . $ sniperbgm_t#bookmark. = (self->time_stopcxx . . $ sniperbgm_t#time_stop. - self->time_startcxx . . $ sniperbgm_t#time_start.) / 1000.0; |
| 338 |
sniperbgm_stopcxx . . $ sniperbgm_stop(4db74b65ed7f6c67).(self); |
| 339 |
} |
| 340 |
|
| 341 |
void |
| 342 |
sniperbgm_grabcxx . . $ sniperbgm_grab(4db74b65ed7f6c67). (sniperbgm_tcxx . . $ sniperbgm_t# *self) |
| 343 |
{ |
| 344 |
/* Try to resume BGM after reopening sound device. */ |
| 345 |
sniperbgm_startcxx . . $ sniperbgm_start(4db74b65ed7f6c67).(self); |
| 346 |
sniperbgm_jumptocxx . . $ sniperbgm_jumpto(356a4784eba0f491).(self, self->bookmarkcxx . . $ sniperbgm_t#bookmark.); |
| 347 |
self->time_startcxx . . $ sniperbgm_t#time_start. -= (int)(self->bookmarkcxx . . $ sniperbgm_t#bookmark. * 1000); /* For next pause. */ |
| 348 |
} |
| 349 |
|
| 350 |
|
| 351 |
|
| 352 |
|
| 353 |
|
| 354 |
/******************/ |
| 355 |
/* Options parser */ |
| 356 |
/******************/ |
| 357 |
|
| 358 |
static int |
| 359 |
parse_optioncxx . . $ parse_option(2ab16ae315e6670e). (PETOPTcxx . . $ PETOPT# *pp, PETOPTScxx . . $ PETOPTS# *pov, const char *arg) |
| 360 |
{ |
| 361 |
switch (pov->scxx . . $ petopt_option#s.) { |
| 362 |
case 'n': // no audio |
| 363 |
gPrefscxx . . $ gPrefs..audiocxx . . $ prefs_#audio. = 0; |
| 364 |
break; |
| 365 |
case 'f': // fullscreen |
| 366 |
gPrefscxx . . $ gPrefs..fullscreencxx . . $ prefs_#fullscreen. = 1; |
| 367 |
break; |
| 368 |
case 'w': // window |
| 369 |
gPrefscxx . . $ gPrefs..fullscreencxx . . $ prefs_#fullscreen. = 0; |
| 370 |
break; |
| 371 |
case 'a': // audio |
| 372 |
gPrefscxx . . $ gPrefs..audiocxx . . $ prefs_#audio. = 1; |
| 373 |
break; |
| 374 |
case '1': |
| 375 |
gPrefscxx . . $ gPrefs..difficultycxx . . $ prefs_#difficulty. = 1; |
| 376 |
break; |
| 377 |
case '2': |
| 378 |
gPrefscxx . . $ gPrefs..difficultycxx . . $ prefs_#difficulty. = 2; |
| 379 |
break; |
| 380 |
case '3': |
| 381 |
gPrefscxx . . $ gPrefs..difficultycxx . . $ prefs_#difficulty. = 3; |
| 382 |
break; |
| 383 |
case 'h': |
| 384 |
fprintf (stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, usagecxx . . $ usage., invocationcxx . . $ invocation.); |
| 385 |
exit (0); |
| 386 |
break; |
| 387 |
} |
| 388 |
return 1; |
| 389 |
} |
| 390 |
|
| 391 |
void parse_argscxx . . $ parse_args(c759356ac01a31e7).(int argc, char **argv) |
| 392 |
{ |
| 393 |
int fs, au, ds, petopt_err; |
| 394 |
PETOPTScxx . . $ PETOPTS# pov[] = { |
| 395 |
{ 'n', POF_BOOLcxx . . $ `src/petopt.h:24:9`!, "noaudio", &au, "Disable Audio" }, |
| 396 |
{ 'f', POF_BOOLcxx . . $ `src/petopt.h:24:9`!, "fullscreen", &fs, "Enable Fullscreen" }, |
| 397 |
{ 'w', POF_BOOLcxx . . $ `src/petopt.h:24:9`!, "windowed", &fs, "Disable Fullscreen" }, |
| 398 |
{ 'a', POF_BOOLcxx . . $ `src/petopt.h:24:9`!, "audio", &au, "Enable Audio" }, |
| 399 |
{ '1', POF_OPTcxx . . $ `src/petopt.h:26:9`!|POF_INTcxx . . $ `src/petopt.h:22:9`!,"diff1", &ds, "Difficulty Setting 1" }, |
| 400 |
{ '2', POF_OPTcxx . . $ `src/petopt.h:26:9`!|POF_INTcxx . . $ `src/petopt.h:22:9`!,"diff2", &ds, "Difficulty Setting 2" }, |
| 401 |
{ '3', POF_OPTcxx . . $ `src/petopt.h:26:9`!|POF_INTcxx . . $ `src/petopt.h:22:9`!,"diff3", &ds, "Difficulty Setting 3" }, |
| 402 |
{ 'h', 0, "help", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, "Extended mode" }, |
| 403 |
{ -1, 0, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! }, |
| 404 |
}; |
| 405 |
|
| 406 |
PETOPTcxx . . $ PETOPT# *pop; |
| 407 |
|
| 408 |
petopt_err = petopt_setupcxx . . $ petopt_setup(9cab59fb7568ad4c). (&pop, 0, argc, argv, pov, parse_optioncxx . . $ parse_option(2ab16ae315e6670e)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 409 |
if (petopt_err > 0) { |
| 410 |
fprintf (stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Unable to initialise petopt: %s\n", strerror(petopt_err)); |
| 411 |
exit (1); |
| 412 |
} |
| 413 |
petopt_err = petopt_parsecxx . . $ petopt_parse(7260f6448cc115d3). (pop, &argc, &argv); |
| 414 |
if (petopt_err > 0) { |
| 415 |
fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "petopt_parse_all: %s\n", strerror(petopt_err)); |
| 416 |
exit(1); |
| 417 |
} |
| 418 |
petopt_cleanupcxx . . $ petopt_cleanup(c5237268d77c6cf4). (pop); |
| 419 |
|
| 420 |
return; |
| 421 |
} |
| 422 |
|
| 423 |
|
| 424 |
|
| 425 |
|
| 426 |
|
| 427 |
|
| 428 |
/***************/ |
| 429 |
/* Audio stuff */ |
| 430 |
/***************/ |
| 431 |
|
| 432 |
#if 0 |
| 433 |
void audiomixer(void *userdata, Uint8 *stream, int len) |
| 434 |
{ |
| 435 |
int l = len / 2; |
| 436 |
short * buf = (short*)stream; |
| 437 |
memset(stream,0,len); |
| 438 |
if (gPlaySound & (1<<1)) |
| 439 |
{ |
| 440 |
gPlaySound &= ~(1<<1); |
| 441 |
Game.AudioZoom.ofs = 0; |
| 442 |
Game.AudioZoom.data = Game.AudioZoomOut.data; |
| 443 |
Game.AudioZoom.len = Game.AudioZoomOut.len; |
| 444 |
} |
| 445 |
if (gPlaySound & (1<<2)) |
| 446 |
{ |
| 447 |
gPlaySound &= ~(1<<2); |
| 448 |
Game.AudioZoom.ofs = 0; |
| 449 |
Game.AudioZoom.data = Game.AudioZoomIn.data; |
| 450 |
Game.AudioZoom.len = Game.AudioZoomIn.len; |
| 451 |
} |
| 452 |
if (gPlaySound & (1<<3)) |
| 453 |
{ |
| 454 |
gPlaySound &= ~(1<<3); |
| 455 |
Game.AudioFireSample.ofs = 0; |
| 456 |
Game.AudioFireSample.data = Game.AudioFire.data; |
| 457 |
Game.AudioFireSample.len = Game.AudioFire.len; |
| 458 |
} |
| 459 |
if (Game.AudioZoom.data != NULL) |
| 460 |
{ |
| 461 |
int n = l; |
| 462 |
if (n + Game.AudioZoom.ofs > Game.AudioZoom.len) |
| 463 |
n = Game.AudioZoom.len - Game.AudioZoom.ofs; |
| 464 |
int i; |
| 465 |
for (i = 0; i < n; i++) |
| 466 |
buf[i] = Game.AudioZoom.data[i + Game.AudioZoom.ofs] / 2; |
| 467 |
Game.AudioZoom.ofs += n; |
| 468 |
if (l != n) |
| 469 |
{ |
| 470 |
Game.AudioZoom.data = NULL; |
| 471 |
} |
| 472 |
} |
| 473 |
if (Game.AudioFireSample != NULL) |
| 474 |
{ |
| 475 |
int n = l; |
| 476 |
if (n + Game.AudioFireSample.ofs > Game.AudioFireSample.len) |
| 477 |
n = Game.AudioFireSample.len - Game.AudioFireSample.ofs; |
| 478 |
int i; |
| 479 |
for (i = 0; i < n; i++) |
| 480 |
buf[i] += Game.AudioFireSample.data[i + Game.AudioFireSample.ofs] / 2; |
| 481 |
Game.AudioFireSample.ofs += n; |
| 482 |
if (l != n) |
| 483 |
{ |
| 484 |
Game.AudioFireSample.data = NULL; |
| 485 |
} |
| 486 |
} |
| 487 |
} |
| 488 |
#endif /* 0 */ |
| 489 |
|
| 490 |
/* Sillily expensive, but faster. */ |
| 491 |
char chanusecxx . . $ chanuse.[16]; |
| 492 |
|
| 493 |
void oes_sound_finishcxx . . $ oes_sound_finish(d4f767463ce0a6b3). (int chan) |
| 494 |
{ |
| 495 |
chanusecxx . . $ chanuse.[chan] = 0; |
| 496 |
} |
| 497 |
|
| 498 |
void oes_sound_playcxx . . $ oes_sound_play(d4f767463ce0a6b3). (int aSound) |
| 499 |
{ |
| 500 |
int chan; |
| 501 |
if (!gPrefscxx . . $ gPrefs..audiocxx . . $ prefs_#audio.) |
| 502 |
return; |
| 503 |
// SDL_LockAudio(); |
| 504 |
// gPlaySound |= 1 << aSound; |
| 505 |
// SDL_UnlockAudio(); |
| 506 |
/* Find a free channel. */ |
| 507 |
for (chan = 0; (chan < 16) && (chanusecxx . . $ chanuse.[chan]); chan++); |
| 508 |
if (chan >= 16) return; /* out of channels. */ |
| 509 |
chanusecxx . . $ chanuse.[chan] = 1; |
| 510 |
switch (aSound) { |
| 511 |
case 1: |
| 512 |
Mix_PlayChannelcxx . . $ `<external>/13318562018335047551/SDL_mixer.h:536:9`!(chan, Game.AudioZoomOut, 0); |
| 513 |
break; |
| 514 |
case 2: |
| 515 |
Mix_PlayChannelcxx . . $ `<external>/13318562018335047551/SDL_mixer.h:536:9`!(chan, Game.AudioZoomIn, 0); |
| 516 |
break; |
| 517 |
case 3: |
| 518 |
Mix_PlayChannelcxx . . $ `<external>/13318562018335047551/SDL_mixer.h:536:9`!(chan, Game.AudioFire, 0); |
| 519 |
break; |
| 520 |
} |
| 521 |
} |
| 522 |
|
| 523 |
int oes_audio_opencxx . . $ oes_audio_open(b126dc7c1de90089). () |
| 524 |
{ |
| 525 |
#ifdef PLAY_AUDIOcxx . . $ `src/snipe2d.h:76:9`! |
| 526 |
if (gPrefscxx . . $ gPrefs..audiocxx . . $ prefs_#audio.) |
| 527 |
{ |
| 528 |
#if 1 |
| 529 |
/* XXX: take settings from prefs. */ |
| 530 |
if (Mix_OpenAudio(44100, AUDIO_S16cxx . . $ `<external>/17835154366534373553/SDL_audio.h:57:9`!, 2, 4096)) { |
| 531 |
printf("Mix_OpenAudio(): %s\n", Mix_GetErrorcxx . . $ `<external>/13318562018335047551/SDL_mixer.h:626:9`!()); |
| 532 |
} |
| 533 |
Mix_AllocateChannels(17); |
| 534 |
Mix_ChannelFinished(oes_sound_finishcxx . . $ oes_sound_finish(d4f767463ce0a6b3).); |
| 535 |
#else |
| 536 |
SDL_AudioSpec *as = (SDL_AudioSpec*)malloc(sizeof(SDL_AudioSpec)); |
| 537 |
as->freq = 44100; |
| 538 |
as->format = AUDIO_S16; |
| 539 |
as->channels = 2; |
| 540 |
as->samples = 4096; |
| 541 |
as->callback = audiomixer; |
| 542 |
as->userdata = NULL; |
| 543 |
if (SDL_OpenAudio(as, NULL) < 0) |
| 544 |
{ |
| 545 |
fprintf(stderr, "Unable to init SDL audio: %s\n", SDL_GetError()); |
| 546 |
exit(1); |
| 547 |
} |
| 548 |
Game.sdlaudio = as; |
| 549 |
#endif /* 0 */ |
| 550 |
} |
| 551 |
#endif |
| 552 |
return 0; |
| 553 |
} |
| 554 |
|
| 555 |
int oes_audio_closecxx . . $ oes_audio_close(b126dc7c1de90089). () |
| 556 |
{ |
| 557 |
Mix_CloseAudio(); |
| 558 |
return 0; |
| 559 |
} |
| 560 |
|
| 561 |
|
| 562 |
|
| 563 |
|
| 564 |
|
| 565 |
|
| 566 |
/*****************************/ |
| 567 |
/* Game and system resources */ |
| 568 |
/*****************************/ |
| 569 |
|
| 570 |
|
| 571 |
/* initialize game data. */ |
| 572 |
ORBITALSNIPERcxx . . $ ORBITALSNIPER# * |
| 573 |
oes_game_initcxx . . $ oes_game_init(b8aae9ffdb43a026). (ORBITALSNIPERcxx . . $ ORBITALSNIPER# *self) |
| 574 |
{ |
| 575 |
int i; |
| 576 |
int tick; |
| 577 |
|
| 578 |
if (!self) |
| 579 |
self = (ORBITALSNIPERcxx . . $ ORBITALSNIPER#*)calloc(1, sizeof(ORBITALSNIPERcxx . . $ ORBITALSNIPER#)); |
| 580 |
|
| 581 |
tick = SDL_GetTicks(); |
| 582 |
self->MouseXcxx . . $ orbitalsniper_t#MouseX. = 0; |
| 583 |
self->MouseYcxx . . $ orbitalsniper_t#MouseY. = 0; |
| 584 |
self->MouseZcxx . . $ orbitalsniper_t#MouseZ. = 1.0f; |
| 585 |
self->CoordScalecxx . . $ orbitalsniper_t#CoordScale. = 1.0f; |
| 586 |
self->WobbleXcxx . . $ orbitalsniper_t#WobbleX. = 0; |
| 587 |
self->WobbleYcxx . . $ orbitalsniper_t#WobbleY. = 0; |
| 588 |
self->CenterXcxx . . $ orbitalsniper_t#CenterX. = 0; |
| 589 |
self->CenterYcxx . . $ orbitalsniper_t#CenterY. = 0; |
| 590 |
self->ControlStatecxx . . $ orbitalsniper_t#ControlState. = 0; |
| 591 |
self->Reloadingcxx . . $ orbitalsniper_t#Reloading. = 0; |
| 592 |
self->Scorecxx . . $ orbitalsniper_t#Score. = 0; |
| 593 |
self->vipcxx . . $ orbitalsniper_t#vip..countcxx . . $ charcount_t#count. = 0; |
| 594 |
self->baddycxx . . $ orbitalsniper_t#baddy..countcxx . . $ charcount_t#count. = 0; |
| 595 |
self->WobbleIndexcxx . . $ orbitalsniper_t#WobbleIndex. = 0; |
| 596 |
self->vipcxx . . $ orbitalsniper_t#vip..goalcxx . . $ charcount_t#goal. = 0; |
| 597 |
self->pedestriancxx . . $ orbitalsniper_t#pedestrian..deadcxx . . $ charcount_t#dead. = 0; |
| 598 |
self->baddycxx . . $ orbitalsniper_t#baddy..deadcxx . . $ charcount_t#dead. = 0; |
| 599 |
self->SightedCharactercxx . . $ orbitalsniper_t#SightedCharacter. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 600 |
|
| 601 |
if (oesjoycxx . . $ oesjoy..sdljoycxx . . $ oes_joy_t#sdljoy.) { |
| 602 |
SDL_JoystickClose(oesjoycxx . . $ oesjoy..sdljoycxx . . $ oes_joy_t#sdljoy.); |
| 603 |
oesjoycxx . . $ oesjoy..sdljoycxx . . $ oes_joy_t#sdljoy. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 604 |
} |
| 605 |
oesjoycxx . . $ oesjoy..xcxx . . $ oes_joy_t#x. = 0; oesjoycxx . . $ oesjoy..ycxx . . $ oes_joy_t#y. = 0; oesjoycxx . . $ oesjoy..zcxx . . $ oes_joy_t#z. = 0; oesjoycxx . . $ oesjoy..statecxx . . $ oes_joy_t#state. = 0; |
| 606 |
oesjoycxx . . $ oesjoy..axescxx . . $ oes_joy_t#axes. = 0; oesjoycxx . . $ oesjoy..buttonscxx . . $ oes_joy_t#buttons. = 0; |
| 607 |
if (gPrefscxx . . $ gPrefs..joystickcxx . . $ prefs_#joystick.) { |
| 608 |
/* want to use joystick. */ |
| 609 |
//printf("Detected %d joysticks\n", SDL_NumJoysticks()); |
| 610 |
if ((oesjoycxx . . $ oesjoy..sdljoycxx . . $ oes_joy_t#sdljoy. = SDL_JoystickOpen(gPrefscxx . . $ gPrefs..joystickcxx . . $ prefs_#joystick. - 1))) { /* off-by-one */ |
| 611 |
oesjoycxx . . $ oesjoy..axescxx . . $ oes_joy_t#axes. = SDL_JoystickNumAxes(oesjoycxx . . $ oesjoy..sdljoycxx . . $ oes_joy_t#sdljoy.); |
| 612 |
oesjoycxx . . $ oesjoy..buttonscxx . . $ oes_joy_t#buttons. = SDL_JoystickNumButtons(oesjoycxx . . $ oesjoy..sdljoycxx . . $ oes_joy_t#sdljoy.); |
| 613 |
} |
| 614 |
} |
| 615 |
|
| 616 |
for (i = 0; i < self->num_characterscxx . . $ orbitalsniper_t#num_characters.; i++) |
| 617 |
{ |
| 618 |
self->characterscxx . . $ orbitalsniper_t#characters.[i].mTypecxx . . $ character_#mType. = -1; |
| 619 |
} |
| 620 |
for (i = 0; i < (int)(self->num_characterscxx . . $ orbitalsniper_t#num_characters. * 0.75f); i++) |
| 621 |
{ |
| 622 |
int id = spawn_aicxx . . $ spawn_ai(7864480464b09eea).(2); |
| 623 |
int j; |
| 624 |
for (j = 0; j < 1000; j++) // Run 1000 physics loops for all pedestrians.. |
| 625 |
handle_aicxx . . $ handle_ai(538e78ad5df5d635).(self->characterscxx . . $ orbitalsniper_t#characters.[id]); |
| 626 |
} |
| 627 |
self->vipcxx . . $ orbitalsniper_t#vip..timecxx . . $ charcount_t#time. = 2000; |
| 628 |
self->vipcxx . . $ orbitalsniper_t#vip..periodcxx . . $ charcount_t#period. = 20000; |
| 629 |
self->baddycxx . . $ orbitalsniper_t#baddy..timecxx . . $ charcount_t#time. = 3000; |
| 630 |
self->baddycxx . . $ orbitalsniper_t#baddy..periodcxx . . $ charcount_t#period. = 8000; |
| 631 |
self->WobbleIndexcxx . . $ orbitalsniper_t#WobbleIndex. = 0; |
| 632 |
self->StartTickcxx . . $ orbitalsniper_t#StartTick. = tick; |
| 633 |
self->FrameCountcxx . . $ orbitalsniper_t#FrameCount. = 0; |
| 634 |
self->LastTickcxx . . $ orbitalsniper_t#LastTick. = tick; |
| 635 |
self->GameStatecxx . . $ orbitalsniper_t#GameState. = 1; |
| 636 |
self->GameStartTickcxx . . $ orbitalsniper_t#GameStartTick. = tick; |
| 637 |
SDL_ShowCursor (0); |
| 638 |
|
| 639 |
return self; |
| 640 |
} |
| 641 |
|
| 642 |
|
| 643 |
/* One-time setup at start. */ |
| 644 |
int |
| 645 |
oes_setupcxx . . $ oes_setup(b126dc7c1de90089). () |
| 646 |
{ |
| 647 |
/* load audio, load images, load models(?), allocate objects. */ |
| 648 |
int i; |
| 649 |
const char *city_img = "citee2.png"; |
| 650 |
const char *charseq_img = "charseq.png"; |
| 651 |
const char *aimap_img = "aimap.png"; |
| 652 |
const char *font_img = "font4x6.png"; |
| 653 |
const char *zoomin_snd = "camera_in.wav"; |
| 654 |
const char *zoomout_snd = "camera_out.wav"; |
| 655 |
const char *boing_snd = "twang.wav"; |
| 656 |
const char *bgmusic = "oes.ogg"; |
| 657 |
|
| 658 |
// char path[ strlen(mediaPath) + 1 + 30 + 1 ]; |
| 659 |
// path = (char*)calloc(strlen(mediaPath) + 1 + 30 + 1, sizeof(char)); |
| 660 |
char *path; |
| 661 |
/* free on function exit. */ |
| 662 |
path = (char*)allocacxx . . $ `<external>/11612401604547820122/alloca.h:35:10`!((strlen(Game.mediaPath) + 1 + 30 + 1) * sizeof(char)); |
| 663 |
|
| 664 |
|
| 665 |
/* Configure difficulty. */ |
| 666 |
configure_difficultycxx . . $ configure_difficulty(49f6e7a06ebc5aa8).(); |
| 667 |
/* Initialise high scores. */ |
| 668 |
init_hiscorescxx . . $ init_hiscores(49f6e7a06ebc5aa8).(); |
| 669 |
|
| 670 |
/* Initialise SDL */ |
| 671 |
//if ( SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0 ) |
| 672 |
// if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) |
| 673 |
if ( SDL_Init(SDL_INIT_VIDEOcxx . . $ `<external>/2689019671020267068/SDL.h:49:9`! | SDL_INIT_JOYSTICKcxx . . $ `<external>/2689019671020267068/SDL.h:51:9`!) < 0 ) |
| 674 |
{ |
| 675 |
fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Unable to init SDL: %s\n", SDL_GetError()); |
| 676 |
exit(1); |
| 677 |
} |
| 678 |
|
| 679 |
atexit(SDL_Quit); |
| 680 |
|
| 681 |
//gScreen = SDL_SetVideoMode(640, 480, 16, SDL_SWSURFACE); |
| 682 |
#ifdef OSX_SUX |
| 683 |
Game.Screen = SDL_SetVideoMode(640, 480, 16, (gPrefs.fullscreen ? SDL_FULLSCREEN : 0) | SDL_SWSURFACE); |
| 684 |
#else |
| 685 |
Gamecxx . . $ Game..Screencxx . . $ orbitalsniper_t#Screen. = SDL_SetVideoMode(640, 480, 16, (gPrefscxx . . $ gPrefs..fullscreencxx . . $ prefs_#fullscreen. ? SDL_FULLSCREENcxx . . $ `<external>/3508485105195885937/SDL_video.h:237:9`! : 0) | SDL_SWSURFACEcxx . . $ `<external>/3508485105195885937/SDL_video.h:229:9`! | SDL_DOUBLEBUFcxx . . $ `<external>/3508485105195885937/SDL_video.h:235:9`!); |
| 686 |
#endif |
| 687 |
SDL_WM_SetCaption("ORBITAL EUNUCHS SNIPER", "ORBITAL_EUNUCHS_SNIPER"); |
| 688 |
if (Gamecxx . . $ Game..Screencxx . . $ orbitalsniper_t#Screen. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 689 |
{ |
| 690 |
fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Unable to set 640x480 video: %s\n", SDL_GetError()); |
| 691 |
exit(1); |
| 692 |
} |
| 693 |
/* Cursor */ |
| 694 |
oes_cursorcxx . . $ oes_cursor(49f6e7a06ebc5aa8).(); |
| 695 |
// init_logoscreen(); |
| 696 |
|
| 697 |
oes_audio_opencxx . . $ oes_audio_open(b126dc7c1de90089).(); |
| 698 |
|
| 699 |
|
| 700 |
Gamecxx . . $ Game..BGMcxx . . $ orbitalsniper_t#BGM. = sniperbgm_initcxx . . $ sniperbgm_init(74624cd5faa1f97e).(Gamecxx . . $ Game..BGMcxx . . $ orbitalsniper_t#BGM.); |
| 701 |
|
| 702 |
sprintf(path, "%s/%s", Gamecxx . . $ Game..mediaPathcxx . . $ orbitalsniper_t#mediaPath., city_img); |
| 703 |
SDL_Surface *temp = IMG_Load(path); |
| 704 |
if (!temp) { |
| 705 |
fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Unable to load city map from '%s'\n",path); |
| 706 |
exit(1); |
| 707 |
} |
| 708 |
Gamecxx . . $ Game..Mapcxx . . $ orbitalsniper_t#Map. = SDL_ConvertSurface(temp, Gamecxx . . $ Game..Screencxx . . $ orbitalsniper_t#Screen.->format,SDL_SWSURFACEcxx . . $ `<external>/3508485105195885937/SDL_video.h:229:9`!); |
| 709 |
SDL_FreeSurface(temp); |
| 710 |
|
| 711 |
sprintf(path, "%s/%s", Gamecxx . . $ Game..mediaPathcxx . . $ orbitalsniper_t#mediaPath., charseq_img); |
| 712 |
temp = IMG_Load(path); |
| 713 |
if (!temp) { |
| 714 |
fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Unable to load character image from '%s'\n",path); |
| 715 |
exit(1); |
| 716 |
} |
| 717 |
Gamecxx . . $ Game..CharSpritecxx . . $ orbitalsniper_t#CharSprite. = SDL_ConvertSurface(temp, Gamecxx . . $ Game..Screencxx . . $ orbitalsniper_t#Screen.->format,SDL_SWSURFACEcxx . . $ `<external>/3508485105195885937/SDL_video.h:229:9`!); |
| 718 |
SDL_FreeSurface(temp); |
| 719 |
|
| 720 |
sprintf(path, "%s/%s", Gamecxx . . $ Game..mediaPathcxx . . $ orbitalsniper_t#mediaPath., aimap_img); |
| 721 |
Gamecxx . . $ Game..AIMapcxx . . $ orbitalsniper_t#AIMap. = IMG_Load(path); |
| 722 |
if (!temp) { |
| 723 |
fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Unable to load AI map from '%s'\n",path); |
| 724 |
exit(1); |
| 725 |
} |
| 726 |
|
| 727 |
// Okay, this is ugly. Load font several times & change the color of each. |
| 728 |
|
| 729 |
for (i = 0; i < 5; i++) |
| 730 |
{ |
| 731 |
sprintf(path, "%s/%s", Gamecxx . . $ Game..mediaPathcxx . . $ orbitalsniper_t#mediaPath., font_img); |
| 732 |
Gamecxx . . $ Game..Fontcxx . . $ orbitalsniper_t#Font.[i] = IMG_Load(path); |
| 733 |
if (!Gamecxx . . $ Game..Fontcxx . . $ orbitalsniper_t#Font.[i]) { |
| 734 |
fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Unable to load font %d from '%s'\n",i,path); |
| 735 |
exit(1); |
| 736 |
} |
| 737 |
SDL_SetColorKey(Gamecxx . . $ Game..Fontcxx . . $ orbitalsniper_t#Font.[i],SDL_SRCCOLORKEYcxx . . $ `<external>/3508485105195885937/SDL_video.h:244:9`!,1); // set color index 1 (black) transparent |
| 738 |
} |
| 739 |
*(int*)&(Gamecxx . . $ Game..Fontcxx . . $ orbitalsniper_t#Font.[0]->format->palette->colors[0]) = 0x000000; // black |
| 740 |
*(int*)&(Gamecxx . . $ Game..Fontcxx . . $ orbitalsniper_t#Font.[1]->format->palette->colors[0]) = 0xffffff; // white |
| 741 |
*(int*)&(Gamecxx . . $ Game..Fontcxx . . $ orbitalsniper_t#Font.[2]->format->palette->colors[0]) = 0x00ff00; // green |
| 742 |
*(int*)&(Gamecxx . . $ Game..Fontcxx . . $ orbitalsniper_t#Font.[3]->format->palette->colors[0]) = 0x00ffff; // yellow |
| 743 |
*(int*)&(Gamecxx . . $ Game..Fontcxx . . $ orbitalsniper_t#Font.[4]->format->palette->colors[0]) = 0x0000ff; // red |
| 744 |
|
| 745 |
precalc_aicxx . . $ precalc_ai(49f6e7a06ebc5aa8).(); |
| 746 |
|
| 747 |
Gamecxx . . $ Game..num_characterscxx . . $ orbitalsniper_t#num_characters. = 2048; |
| 748 |
Gamecxx . . $ Game..characterscxx . . $ orbitalsniper_t#characters. = (CHARACTERcxx . . $ CHARACTER#*)calloc(Gamecxx . . $ Game..num_characterscxx . . $ orbitalsniper_t#num_characters., sizeof(CHARACTERcxx . . $ CHARACTER#)); |
| 749 |
|
| 750 |
#ifdef PLAY_AUDIOcxx . . $ `src/snipe2d.h:76:9`! |
| 751 |
if (gPrefscxx . . $ gPrefs..audiocxx . . $ prefs_#audio.) |
| 752 |
{ |
| 753 |
sprintf(path, "%s/%s", Gamecxx . . $ Game..mediaPathcxx . . $ orbitalsniper_t#mediaPath., zoomin_snd); |
| 754 |
Gamecxx . . $ Game..AudioZoomIncxx . . $ orbitalsniper_t#AudioZoomIn. = Mix_LoadWAVcxx . . $ `<external>/13318562018335047551/SDL_mixer.h:150:9`!(path); |
| 755 |
if (!Gamecxx . . $ Game..AudioZoomIncxx . . $ orbitalsniper_t#AudioZoomIn.) { |
| 756 |
fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Unable to load zoom in sound from '%s'\n",path); |
| 757 |
exit(1); |
| 758 |
} |
| 759 |
sprintf(path, "%s/%s", Gamecxx . . $ Game..mediaPathcxx . . $ orbitalsniper_t#mediaPath., zoomout_snd); |
| 760 |
Gamecxx . . $ Game..AudioZoomOutcxx . . $ orbitalsniper_t#AudioZoomOut. = Mix_LoadWAVcxx . . $ `<external>/13318562018335047551/SDL_mixer.h:150:9`!(path); |
| 761 |
if (!Gamecxx . . $ Game..AudioZoomOutcxx . . $ orbitalsniper_t#AudioZoomOut.) { |
| 762 |
fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Unable to load zoom out sound from '%s'\n",path); |
| 763 |
exit(1); |
| 764 |
} |
| 765 |
sprintf(path, "%s/%s", Gamecxx . . $ Game..mediaPathcxx . . $ orbitalsniper_t#mediaPath., boing_snd); |
| 766 |
Gamecxx . . $ Game..AudioFirecxx . . $ orbitalsniper_t#AudioFire. = Mix_LoadWAVcxx . . $ `<external>/13318562018335047551/SDL_mixer.h:150:9`!(path); |
| 767 |
if (!Gamecxx . . $ Game..AudioFirecxx . . $ orbitalsniper_t#AudioFire.) { |
| 768 |
fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Unable to load fire sound from '%s'\n",path); |
| 769 |
exit(1); |
| 770 |
} |
| 771 |
sprintf(path, "%s/%s", Gamecxx . . $ Game..mediaPathcxx . . $ orbitalsniper_t#mediaPath., bgmusic); |
| 772 |
// Game.BGM = Mix_LoadMUS(path); |
| 773 |
if (!sniperbgm_usecxx . . $ sniperbgm_use(f56ea5b978ff069f).(Gamecxx . . $ Game..BGMcxx . . $ orbitalsniper_t#BGM., Mix_LoadMUS(path))) { |
| 774 |
fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Unable to load background music from '%s'\n",path); |
| 775 |
exit(1); |
| 776 |
} |
| 777 |
|
| 778 |
// SDL_PauseAudio(0); // let it play |
| 779 |
} |
| 780 |
#endif |
| 781 |
|
| 782 |
oes_game_initcxx . . $ oes_game_init(b8aae9ffdb43a026).(&Gamecxx . . $ Game.); |
| 783 |
return 0; |
| 784 |
} |
| 785 |
|
| 786 |
/* One-time teardown at exit. */ |
| 787 |
void |
| 788 |
oes_teardowncxx . . $ oes_teardown(49f6e7a06ebc5aa8). () |
| 789 |
{ |
| 790 |
if (oesjoycxx . . $ oesjoy..sdljoycxx . . $ oes_joy_t#sdljoy.) |
| 791 |
{ |
| 792 |
SDL_JoystickClose(oesjoycxx . . $ oesjoy..sdljoycxx . . $ oes_joy_t#sdljoy.); |
| 793 |
oesjoycxx . . $ oesjoy..sdljoycxx . . $ oes_joy_t#sdljoy. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 794 |
} |
| 795 |
} |
| 796 |
|
| 797 |
/* Temporarily release system resources. */ |
| 798 |
int |
| 799 |
oes_suspendcxx . . $ oes_suspend(b126dc7c1de90089). () |
| 800 |
{ |
| 801 |
if (Gamecxx . . $ Game..GameStatecxx . . $ orbitalsniper_t#GameState. != OESGAME_PLAYcxx . . $ OESGAME_PLAY.) return 0; |
| 802 |
sniperbgm_releasecxx . . $ sniperbgm_release(4db74b65ed7f6c67).(Gamecxx . . $ Game..BGMcxx . . $ orbitalsniper_t#BGM.); |
| 803 |
oes_audio_closecxx . . $ oes_audio_close(b126dc7c1de90089).(); |
| 804 |
SDL_WM_GrabInput(SDL_GRAB_OFF); |
| 805 |
SDL_ShowCursor(1); |
| 806 |
Gamecxx . . $ Game..GameStatecxx . . $ orbitalsniper_t#GameState. = OESGAME_PAUSEDcxx . . $ OESGAME_PAUSED.; |
| 807 |
return 0; |
| 808 |
} |
| 809 |
|
| 810 |
/* Reassert system resources that were temporarily released. */ |
| 811 |
int |
| 812 |
oes_resumecxx . . $ oes_resume(b126dc7c1de90089). () |
| 813 |
{ |
| 814 |
if (Gamecxx . . $ Game..GameStatecxx . . $ orbitalsniper_t#GameState. != OESGAME_PAUSEDcxx . . $ OESGAME_PAUSED.) return 0; |
| 815 |
if (Gamecxx . . $ Game..GrabPcxx . . $ orbitalsniper_t#GrabP.) |
| 816 |
{ |
| 817 |
SDL_ShowCursor(0); |
| 818 |
SDL_WM_GrabInput(SDL_GRAB_ON); |
| 819 |
} |
| 820 |
oes_audio_opencxx . . $ oes_audio_open(b126dc7c1de90089).(); |
| 821 |
sniperbgm_grabcxx . . $ sniperbgm_grab(4db74b65ed7f6c67).(Gamecxx . . $ Game..BGMcxx . . $ orbitalsniper_t#BGM.); |
| 822 |
Gamecxx . . $ Game..GameStatecxx . . $ orbitalsniper_t#GameState. = OESGAME_UNPAUSEDcxx . . $ OESGAME_UNPAUSED.; |
| 823 |
return 0; |
| 824 |
} |
| 825 |
|
| 826 |
|
| 827 |
|
| 828 |
|
| 829 |
|
| 830 |
|
| 831 |
/**************/ |
| 832 |
/* Game logic */ |
| 833 |
/**************/ |
| 834 |
|
| 835 |
#define PHYSICS_MScxx . . $ `src/snipe2d.cpp:835:9`! 10 |
| 836 |
// 10ms physics loops == 100 loops per sec, 'should be enough'.. |
| 837 |
|
| 838 |
void oes_reindeercxx . . $ oes_reindeer(49f6e7a06ebc5aa8).() |
| 839 |
{ |
| 840 |
Gamecxx . . $ Game..SightedCharactercxx . . $ orbitalsniper_t#SightedCharacter. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 841 |
int tick = SDL_GetTicks(); |
| 842 |
Gamecxx . . $ Game..FrameCountcxx . . $ orbitalsniper_t#FrameCount.++; |
| 843 |
if (Gamecxx . . $ Game..Reloadingcxx . . $ orbitalsniper_t#Reloading.) |
| 844 |
{ |
| 845 |
Gamecxx . . $ Game..Reloadingcxx . . $ orbitalsniper_t#Reloading. -= tick - Gamecxx . . $ Game..LastTickcxx . . $ orbitalsniper_t#LastTick.; |
| 846 |
if (Gamecxx . . $ Game..Reloadingcxx . . $ orbitalsniper_t#Reloading. < 0) |
| 847 |
Gamecxx . . $ Game..Reloadingcxx . . $ orbitalsniper_t#Reloading. = 0; |
| 848 |
} |
| 849 |
|
| 850 |
Gamecxx . . $ Game..CenterXcxx . . $ orbitalsniper_t#CenterX. = (640.0f - 640.0f * Gamecxx . . $ Game..CoordScalecxx . . $ orbitalsniper_t#CoordScale.) / 2; |
| 851 |
Gamecxx . . $ Game..CenterYcxx . . $ orbitalsniper_t#CenterY. = (480.0f - 480.0f * Gamecxx . . $ Game..CoordScalecxx . . $ orbitalsniper_t#CoordScale.) / 2; |
| 852 |
Gamecxx . . $ Game..WobbleXcxx . . $ orbitalsniper_t#WobbleX. = (float)(sincxx . . $ sin(fee4f1d22bc8e617).(Gamecxx . . $ Game..WobbleIndexcxx . . $ orbitalsniper_t#WobbleIndex. * 0.000654387) + |
| 853 |
sincxx . . $ sin(fee4f1d22bc8e617).(Gamecxx . . $ Game..WobbleIndexcxx . . $ orbitalsniper_t#WobbleIndex. * 0.000547867)*2 + |
| 854 |
sincxx . . $ sin(fee4f1d22bc8e617).(Gamecxx . . $ Game..WobbleIndexcxx . . $ orbitalsniper_t#WobbleIndex. * 0.000700133)) * (WOBBLEcxx . . $ `src/snipe2d.h:71:9`! / 4.0f); |
| 855 |
Gamecxx . . $ Game..WobbleYcxx . . $ orbitalsniper_t#WobbleY. = (float)(sincxx . . $ sin(fee4f1d22bc8e617).(Gamecxx . . $ Game..WobbleIndexcxx . . $ orbitalsniper_t#WobbleIndex. * 0.000537234) + |
| 856 |
sincxx . . $ sin(fee4f1d22bc8e617).(Gamecxx . . $ Game..WobbleIndexcxx . . $ orbitalsniper_t#WobbleIndex. * 0.000732897) + |
| 857 |
sincxx . . $ sin(fee4f1d22bc8e617).(Gamecxx . . $ Game..WobbleIndexcxx . . $ orbitalsniper_t#WobbleIndex. * 0.000600613)*2) * (WOBBLEcxx . . $ `src/snipe2d.h:71:9`! / 4.0f); |
| 858 |
|
| 859 |
|
| 860 |
|
| 861 |
#ifdef UNREAL_DITHERcxx . . $ `src/snipe2d.h:70:9`! |
| 862 |
zoom_unrealcxx . . $ zoom_unreal(c450de46b9b492d1).(Gamecxx . . $ Game..Mapcxx . . $ orbitalsniper_t#Map., Gamecxx . . $ Game..MouseXcxx . . $ orbitalsniper_t#MouseX. + Gamecxx . . $ Game..CenterXcxx . . $ orbitalsniper_t#CenterX. + Gamecxx . . $ Game..WobbleXcxx . . $ orbitalsniper_t#WobbleX., Gamecxx . . $ Game..MouseYcxx . . $ orbitalsniper_t#MouseY. + Gamecxx . . $ Game..CenterYcxx . . $ orbitalsniper_t#CenterY. + Gamecxx . . $ Game..WobbleYcxx . . $ orbitalsniper_t#WobbleY., Gamecxx . . $ Game..CoordScalecxx . . $ orbitalsniper_t#CoordScale.); |
| 863 |
#else |
| 864 |
zoom(Game.Map, Game.MouseX + Game.CenterX + Game.WobbleX, Game.MouseY + Game.CenterY + Game.WobbleX, Game.CoordScale); |
| 865 |
#endif |
| 866 |
|
| 867 |
int i; |
| 868 |
int physics_loops = (tick - Gamecxx . . $ Game..LastTickcxx . . $ orbitalsniper_t#LastTick.) / PHYSICS_MScxx . . $ `src/snipe2d.cpp:835:9`!; |
| 869 |
int j; |
| 870 |
for (i = 0; i < Gamecxx . . $ Game..num_characterscxx . . $ orbitalsniper_t#num_characters.; i++) |
| 871 |
{ |
| 872 |
for (j = 0; j < physics_loops; j++) |
| 873 |
handle_aicxx . . $ handle_ai(538e78ad5df5d635).(Gamecxx . . $ Game..characterscxx . . $ orbitalsniper_t#characters.[i]); |
| 874 |
if (!Gamecxx . . $ Game..GameStatecxx . . $ orbitalsniper_t#GameState.) |
| 875 |
return; |
| 876 |
drawCharactercxx . . $ drawCharacter(538e78ad5df5d635).(Gamecxx . . $ Game..characterscxx . . $ orbitalsniper_t#characters.[i]); |
| 877 |
} |
| 878 |
|
| 879 |
targetcxx . . $ target(49f6e7a06ebc5aa8).(); |
| 880 |
|
| 881 |
for (j = 0; j < physics_loops; j++) |
| 882 |
{ |
| 883 |
int physicstick = Gamecxx . . $ Game..LastTickcxx . . $ orbitalsniper_t#LastTick. - Gamecxx . . $ Game..GameStartTickcxx . . $ orbitalsniper_t#GameStartTick.; |
| 884 |
Gamecxx . . $ Game..WobbleIndexcxx . . $ orbitalsniper_t#WobbleIndex. += PHYSICS_MScxx . . $ `src/snipe2d.cpp:835:9`!; |
| 885 |
|
| 886 |
// spawn VIPs |
| 887 |
if (physicstick >= Gamecxx . . $ Game..vipcxx . . $ orbitalsniper_t#vip..timecxx . . $ charcount_t#time.) |
| 888 |
{ |
| 889 |
|
| 890 |
if (Gamecxx . . $ Game..vipcxx . . $ orbitalsniper_t#vip..countcxx . . $ charcount_t#count. == 2 && rand() < 2048) |
| 891 |
spawn_aicxx . . $ spawn_ai(7864480464b09eea).(1); |
| 892 |
if (Gamecxx . . $ Game..vipcxx . . $ orbitalsniper_t#vip..countcxx . . $ charcount_t#count. == 1 && rand() < 8192) |
| 893 |
spawn_aicxx . . $ spawn_ai(7864480464b09eea).(1); |
| 894 |
if (Gamecxx . . $ Game..vipcxx . . $ orbitalsniper_t#vip..countcxx . . $ charcount_t#count. == 0) |
| 895 |
spawn_aicxx . . $ spawn_ai(7864480464b09eea).(1); |
| 896 |
Gamecxx . . $ Game..vipcxx . . $ orbitalsniper_t#vip..timecxx . . $ charcount_t#time. += (int)Gamecxx . . $ Game..vipcxx . . $ orbitalsniper_t#vip..periodcxx . . $ charcount_t#period.; |
| 897 |
} |
| 898 |
// spawn baddies |
| 899 |
if (physicstick >= Gamecxx . . $ Game..baddycxx . . $ orbitalsniper_t#baddy..timecxx . . $ charcount_t#time.) |
| 900 |
{ |
| 901 |
spawn_aicxx . . $ spawn_ai(7864480464b09eea).(0); |
| 902 |
Gamecxx . . $ Game..baddycxx . . $ orbitalsniper_t#baddy..timecxx . . $ charcount_t#time. += (int)Gamecxx . . $ Game..baddycxx . . $ orbitalsniper_t#baddy..periodcxx . . $ charcount_t#period.; |
| 903 |
} |
| 904 |
if (((Gamecxx . . $ Game..LastTickcxx . . $ orbitalsniper_t#LastTick. / PHYSICS_MScxx . . $ `src/snipe2d.cpp:835:9`!) & 3) == 0) |
| 905 |
Gamecxx . . $ Game..baddycxx . . $ orbitalsniper_t#baddy..periodcxx . . $ charcount_t#period.--; |
| 906 |
|
| 907 |
if (Gamecxx . . $ Game..baddycxx . . $ orbitalsniper_t#baddy..periodcxx . . $ charcount_t#period. < 3000) |
| 908 |
Gamecxx . . $ Game..baddycxx . . $ orbitalsniper_t#baddy..periodcxx . . $ charcount_t#period. = 3000; // Eventually it will be impossible to kill all bad guys. |
| 909 |
|
| 910 |
Gamecxx . . $ Game..LastTickcxx . . $ orbitalsniper_t#LastTick. += PHYSICS_MScxx . . $ `src/snipe2d.cpp:835:9`!; |
| 911 |
} |
| 912 |
|
| 913 |
|
| 914 |
SDL_Flip(Gamecxx . . $ Game..Screencxx . . $ orbitalsniper_t#Screen.); |
| 915 |
} |
| 916 |
|
| 917 |
|
| 918 |
int oes_game_statecxx . . $ oes_game_state(7864480464b09eea). (int newstate) |
| 919 |
{ |
| 920 |
switch ((Gamecxx . . $ Game..GameStatecxx . . $ orbitalsniper_t#GameState. = newstate)) { |
| 921 |
case 0: |
| 922 |
/* need init */ |
| 923 |
break; |
| 924 |
case 1: |
| 925 |
/* main game state. */ |
| 926 |
break; |
| 927 |
case 2: |
| 928 |
/* paused state. */ |
| 929 |
break; |
| 930 |
case 3: |
| 931 |
/* just unpaused. Need re-init, transit to 1. */ |
| 932 |
break; |
| 933 |
} |
| 934 |
return Gamecxx . . $ Game..GameStatecxx . . $ orbitalsniper_t#GameState.; |
| 935 |
} |
| 936 |
|
| 937 |
/* |
| 938 |
Alter input grab state. |
| 939 |
0 = try to release |
| 940 |
1 = try to grab |
| 941 |
-1 = toggle whatever it is. |
| 942 |
*/ |
| 943 |
int oes_game_grabcxx . . $ oes_game_grab(7864480464b09eea). (int newstate) |
| 944 |
{ |
| 945 |
int tryGrabState; |
| 946 |
|
| 947 |
if (SDL_GetVideoSurface()->flags & SDL_FULLSCREENcxx . . $ `<external>/3508485105195885937/SDL_video.h:237:9`!) { |
| 948 |
/* Don't release grab in fullscreen. */ |
| 949 |
SDL_WM_GrabInput(SDL_GRAB_ON); |
| 950 |
SDL_ShowCursor(0); |
| 951 |
Gamecxx . . $ Game..GrabPcxx . . $ orbitalsniper_t#GrabP. = 1; |
| 952 |
return 0; |
| 953 |
} |
| 954 |
tryGrabState = (newstate == -1) ? !Gamecxx . . $ Game..GrabPcxx . . $ orbitalsniper_t#GrabP. : newstate; |
| 955 |
switch (tryGrabState) { |
| 956 |
case 0: |
| 957 |
SDL_WM_GrabInput(SDL_GRAB_OFF); |
| 958 |
Gamecxx . . $ Game..GrabPcxx . . $ orbitalsniper_t#GrabP. = 0; |
| 959 |
SDL_ShowCursor(1); |
| 960 |
break; |
| 961 |
case 1: |
| 962 |
SDL_ShowCursor(0); |
| 963 |
SDL_WM_GrabInput(SDL_GRAB_ON); |
| 964 |
Gamecxx . . $ Game..GrabPcxx . . $ orbitalsniper_t#GrabP. = 1; |
| 965 |
break; |
| 966 |
} |
| 967 |
return Gamecxx . . $ Game..GrabPcxx . . $ orbitalsniper_t#GrabP.; |
| 968 |
} |
| 969 |
|
| 970 |
int oes_game_zoomcxx . . $ oes_game_zoom(1bb0578f3efdc255). (float amt) |
| 971 |
{ |
| 972 |
float oldcoord = Gamecxx . . $ Game..CoordScalecxx . . $ orbitalsniper_t#CoordScale.; |
| 973 |
|
| 974 |
Gamecxx . . $ Game..MouseZcxx . . $ orbitalsniper_t#MouseZ. += amt; |
| 975 |
if (Gamecxx . . $ Game..MouseZcxx . . $ orbitalsniper_t#MouseZ. > 1.25) Gamecxx . . $ Game..MouseZcxx . . $ orbitalsniper_t#MouseZ. = 1.25; |
| 976 |
if (Gamecxx . . $ Game..MouseZcxx . . $ orbitalsniper_t#MouseZ. < 0.05f) Gamecxx . . $ Game..MouseZcxx . . $ orbitalsniper_t#MouseZ. = 0.05f; |
| 977 |
#ifndef CAMERA_STEPScxx . . $ `src/snipe2d.h:69:9`! |
| 978 |
Game.CoordScale = Game.MouseZ; |
| 979 |
#else /* CAMERA_STEPS */ |
| 980 |
Gamecxx . . $ Game..CoordScalecxx . . $ orbitalsniper_t#CoordScale. = ((int)(Gamecxx . . $ Game..MouseZcxx . . $ orbitalsniper_t#MouseZ. * 4)) / 4.0f; |
| 981 |
if (Gamecxx . . $ Game..CoordScalecxx . . $ orbitalsniper_t#CoordScale. < 0.05f) Gamecxx . . $ Game..CoordScalecxx . . $ orbitalsniper_t#CoordScale. = 0.05f; |
| 982 |
#endif /* CAMERA_STEPS */ |
| 983 |
if (oldcoord < Gamecxx . . $ Game..CoordScalecxx . . $ orbitalsniper_t#CoordScale.) |
| 984 |
oes_sound_playcxx . . $ oes_sound_play(d4f767463ce0a6b3).(1); |
| 985 |
if (oldcoord > Gamecxx . . $ Game..CoordScalecxx . . $ orbitalsniper_t#CoordScale.) |
| 986 |
oes_sound_playcxx . . $ oes_sound_play(d4f767463ce0a6b3).(2); |
| 987 |
return 0; |
| 988 |
} |
| 989 |
|
| 990 |
/* |
| 991 |
Set paused state. |
| 992 |
0 = force play/resume |
| 993 |
1 = force pause |
| 994 |
-1 = toggle paused state |
| 995 |
*/ |
| 996 |
int oes_game_pausecxx . . $ oes_game_pause(7864480464b09eea). (int newstate) |
| 997 |
{ |
| 998 |
int tryPause; |
| 999 |
int tick; |
| 1000 |
|
| 1001 |
tryPause = newstate; |
| 1002 |
if (newstate == -1) |
| 1003 |
{ |
| 1004 |
if (Gamecxx . . $ Game..GameStatecxx . . $ orbitalsniper_t#GameState. == OESGAME_PAUSEDcxx . . $ OESGAME_PAUSED.) |
| 1005 |
tryPause = 0; |
| 1006 |
else |
| 1007 |
tryPause = 1; |
| 1008 |
} |
| 1009 |
tick = SDL_GetTicks(); |
| 1010 |
switch (tryPause) |
| 1011 |
{ |
| 1012 |
case 0: |
| 1013 |
if (Gamecxx . . $ Game..GameStatecxx . . $ orbitalsniper_t#GameState. == OESGAME_PAUSEDcxx . . $ OESGAME_PAUSED.) |
| 1014 |
{ |
| 1015 |
//printf("UNPAUSING\n"); |
| 1016 |
/* resume */ |
| 1017 |
oes_resumecxx . . $ oes_resume(b126dc7c1de90089).(); /* regain system resources. */ |
| 1018 |
Gamecxx . . $ Game..AfterPauseTickcxx . . $ orbitalsniper_t#AfterPauseTick. = tick; |
| 1019 |
Gamecxx . . $ Game..GameStartTickcxx . . $ orbitalsniper_t#GameStartTick. += Gamecxx . . $ Game..AfterPauseTickcxx . . $ orbitalsniper_t#AfterPauseTick. - Gamecxx . . $ Game..BeforePauseTickcxx . . $ orbitalsniper_t#BeforePauseTick.; |
| 1020 |
Gamecxx . . $ Game..GameStatecxx . . $ orbitalsniper_t#GameState. = OESGAME_PLAYcxx . . $ OESGAME_PLAY.; |
| 1021 |
break; |
| 1022 |
} |
| 1023 |
break; |
| 1024 |
case 1: |
| 1025 |
if (Gamecxx . . $ Game..GameStatecxx . . $ orbitalsniper_t#GameState. == OESGAME_PLAYcxx . . $ OESGAME_PLAY.) |
| 1026 |
{ |
| 1027 |
/* go to pause */ |
| 1028 |
//printf("Pausing\n"); |
| 1029 |
Gamecxx . . $ Game..BeforePauseTickcxx . . $ orbitalsniper_t#BeforePauseTick. = tick; |
| 1030 |
oes_suspendcxx . . $ oes_suspend(b126dc7c1de90089).(); /* release system resources. */ |
| 1031 |
Gamecxx . . $ Game..GameStatecxx . . $ orbitalsniper_t#GameState. = OESGAME_PAUSEDcxx . . $ OESGAME_PAUSED.; |
| 1032 |
} |
| 1033 |
break; |
| 1034 |
} |
| 1035 |
return tryPause; |
| 1036 |
} |
| 1037 |
|
| 1038 |
/* Boss event. */ |
| 1039 |
int |
| 1040 |
oes_game_hidecxx . . $ oes_game_hide(7864480464b09eea). (int newstate) |
| 1041 |
{ |
| 1042 |
SDL_WM_IconifyWindow(); |
| 1043 |
oes_game_pausecxx . . $ oes_game_pause(7864480464b09eea).(1); |
| 1044 |
return 1; |
| 1045 |
} |
| 1046 |
|
| 1047 |
|
| 1048 |
|
| 1049 |
|
| 1050 |
|
| 1051 |
|
| 1052 |
/******************/ |
| 1053 |
/* OES Game Binds */ |
| 1054 |
/******************/ |
| 1055 |
|
| 1056 |
|
| 1057 |
/* No-operation */ |
| 1058 |
int oes_bind_nopcxx . . $ oes_bind_nop(7864480464b09eea). (int val) |
| 1059 |
{ |
| 1060 |
/* do-nothing */ |
| 1061 |
return 0; |
| 1062 |
} |
| 1063 |
|
| 1064 |
|
| 1065 |
/* On-release-only binds */ |
| 1066 |
|
| 1067 |
int oes_bind_grabcxx . . $ oes_bind_grab(7864480464b09eea). (int val) |
| 1068 |
{ |
| 1069 |
if (val) return 0; |
| 1070 |
return oes_game_grabcxx . . $ oes_game_grab(7864480464b09eea).(-1); |
| 1071 |
} |
| 1072 |
|
| 1073 |
/* toggle fullscreen... on key release */ |
| 1074 |
int oes_bind_fullscreencxx . . $ oes_bind_fullscreen(7864480464b09eea). (int val) |
| 1075 |
{ |
| 1076 |
if (val) return 0; /* toggle on release. */ |
| 1077 |
|
| 1078 |
gPrefscxx . . $ gPrefs..fullscreencxx . . $ prefs_#fullscreen. = !gPrefscxx . . $ gPrefs..fullscreencxx . . $ prefs_#fullscreen.; |
| 1079 |
if (((Gamecxx . . $ Game..Screencxx . . $ orbitalsniper_t#Screen.->flags & SDL_FULLSCREENcxx . . $ `<external>/3508485105195885937/SDL_video.h:237:9`!) == SDL_FULLSCREENcxx . . $ `<external>/3508485105195885937/SDL_video.h:237:9`!) ^ (gPrefscxx . . $ gPrefs..fullscreencxx . . $ prefs_#fullscreen.)) { |
| 1080 |
SDL_WM_ToggleFullScreen(Gamecxx . . $ Game..Screencxx . . $ orbitalsniper_t#Screen.); |
| 1081 |
} |
| 1082 |
// SDL_WM_ToggleFullScreen(Game.Screen); |
| 1083 |
// gPrefs.fullscreen = !gPrefs.fullscreen; |
| 1084 |
return 0; |
| 1085 |
} |
| 1086 |
|
| 1087 |
/* Boss Key */ |
| 1088 |
int oes_bind_hidecxx . . $ oes_bind_hide(7864480464b09eea). (int val) |
| 1089 |
{ |
| 1090 |
if (val) return 0; /* trigger on release */ |
| 1091 |
oes_game_hidecxx . . $ oes_game_hide(7864480464b09eea).(1); |
| 1092 |
return 0; |
| 1093 |
} |
| 1094 |
|
| 1095 |
/* Forceful end of game. */ |
| 1096 |
int |
| 1097 |
oes_bind_abandoncxx . . $ oes_bind_abandon(7864480464b09eea). (int pressed) |
| 1098 |
{ |
| 1099 |
if (pressed) return 0; |
| 1100 |
oes_resumecxx . . $ oes_resume(b126dc7c1de90089).(); |
| 1101 |
Gamecxx . . $ Game..GameOverReasoncxx . . $ orbitalsniper_t#GameOverReason. = OESREASON_AWOLcxx . . $ OESREASON_AWOL.; |
| 1102 |
return 0; |
| 1103 |
} |
| 1104 |
|
| 1105 |
|
| 1106 |
/* On-press binds */ |
| 1107 |
|
| 1108 |
/* paused mode. */ |
| 1109 |
int oes_bind_pausecxx . . $ oes_bind_pause(7864480464b09eea). (int val) |
| 1110 |
{ |
| 1111 |
if (!val) return 0; |
| 1112 |
return oes_game_pausecxx . . $ oes_game_pause(7864480464b09eea).(-1); |
| 1113 |
} |
| 1114 |
|
| 1115 |
/* the extra information around the targeting reticles */ |
| 1116 |
int oes_bind_verbositycxx . . $ oes_bind_verbosity(7864480464b09eea). (int val) |
| 1117 |
{ |
| 1118 |
if (!val) return 0; |
| 1119 |
Gamecxx . . $ Game..verbositycxx . . $ orbitalsniper_t#verbosity. = (Gamecxx . . $ Game..verbositycxx . . $ orbitalsniper_t#verbosity. + 1) % 3; |
| 1120 |
gPrefscxx . . $ gPrefs..verbosecxx . . $ prefs_#verbose. = Gamecxx . . $ Game..verbositycxx . . $ orbitalsniper_t#verbosity.; |
| 1121 |
return 0; |
| 1122 |
} |
| 1123 |
|
| 1124 |
/* save screenshot */ |
| 1125 |
int oes_bind_screenshotcxx . . $ oes_bind_screenshot(7864480464b09eea). (int val) |
| 1126 |
{ |
| 1127 |
if (!val) return 0; |
| 1128 |
SDL_SaveBMPcxx . . $ `<external>/3508485105195885937/SDL_video.h:265:9`!(SDL_GetVideoSurface(),"screenshot.bmp"); |
| 1129 |
screen_shot_numbercxx . . $ screen_shot_number.++; |
| 1130 |
return 0; |
| 1131 |
} |
| 1132 |
|
| 1133 |
int oes_bind_firecxx . . $ oes_bind_fire(7864480464b09eea). (int val) |
| 1134 |
{ |
| 1135 |
if (!val) return 0; |
| 1136 |
if (Gamecxx . . $ Game..GameStatecxx . . $ orbitalsniper_t#GameState. == OESGAME_PLAYcxx . . $ OESGAME_PLAY.) { |
| 1137 |
if (!Gamecxx . . $ Game..Reloadingcxx . . $ orbitalsniper_t#Reloading.) { |
| 1138 |
oes_sound_playcxx . . $ oes_sound_play(d4f767463ce0a6b3).(3); |
| 1139 |
shootcxx . . $ shoot(49f6e7a06ebc5aa8).(); |
| 1140 |
} |
| 1141 |
} else if (Gamecxx . . $ Game..GameStatecxx . . $ orbitalsniper_t#GameState. == OESGAME_PAUSEDcxx . . $ OESGAME_PAUSED.) { |
| 1142 |
if (Gamecxx . . $ Game..LastTickcxx . . $ orbitalsniper_t#LastTick. - Gamecxx . . $ Game..SemiPausecxx . . $ orbitalsniper_t#SemiPause. < 500) { |
| 1143 |
// Game.GameState = OESGAME_UNPAUSED; |
| 1144 |
oes_game_pausecxx . . $ oes_game_pause(7864480464b09eea).(0); |
| 1145 |
} else { |
| 1146 |
Gamecxx . . $ Game..SemiPausecxx . . $ orbitalsniper_t#SemiPause. = Gamecxx . . $ Game..LastTickcxx . . $ orbitalsniper_t#LastTick.; |
| 1147 |
} |
| 1148 |
} |
| 1149 |
return val; |
| 1150 |
} |
| 1151 |
|
| 1152 |
/* zooming mode */ |
| 1153 |
int oes_bind_zoomcxx . . $ oes_bind_zoom(7864480464b09eea). (int val) |
| 1154 |
{ |
| 1155 |
Gamecxx . . $ Game..ControlStatecxx . . $ orbitalsniper_t#ControlState. = val ? 1 : 0; |
| 1156 |
return Gamecxx . . $ Game..ControlStatecxx . . $ orbitalsniper_t#ControlState.; |
| 1157 |
} |
| 1158 |
|
| 1159 |
/* Zoom in */ |
| 1160 |
int oes_bind_zoomincxx . . $ oes_bind_zoomin(7864480464b09eea). (int val) |
| 1161 |
{ |
| 1162 |
if (!val) return 0; |
| 1163 |
if (Gamecxx . . $ Game..GameStatecxx . . $ orbitalsniper_t#GameState. != OESGAME_PLAYcxx . . $ OESGAME_PLAY.) return 1; |
| 1164 |
oes_game_zoomcxx . . $ oes_game_zoom(1bb0578f3efdc255).(-0.20f); |
| 1165 |
return val; |
| 1166 |
} |
| 1167 |
|
| 1168 |
/* Zoom out */ |
| 1169 |
int oes_bind_zoomoutcxx . . $ oes_bind_zoomout(7864480464b09eea). (int val) |
| 1170 |
{ |
| 1171 |
if (!val) return 0; |
| 1172 |
if (Gamecxx . . $ Game..GameStatecxx . . $ orbitalsniper_t#GameState. != OESGAME_PLAYcxx . . $ OESGAME_PLAY.) return 1; |
| 1173 |
oes_game_zoomcxx . . $ oes_game_zoom(1bb0578f3efdc255).(0.20f); |
| 1174 |
return val; |
| 1175 |
} |
| 1176 |
|
| 1177 |
|
| 1178 |
|
| 1179 |
/* Continuous-value binds */ |
| 1180 |
|
| 1181 |
/* Mouse motion, horizontal */ |
| 1182 |
int oes_bind_mhorizcxx . . $ oes_bind_mhoriz(7864480464b09eea). (int val) |
| 1183 |
{ |
| 1184 |
if (!Gamecxx . . $ Game..GrabPcxx . . $ orbitalsniper_t#GrabP.) { |
| 1185 |
/* A little confusing if not grabbed... */ |
| 1186 |
return 1; |
| 1187 |
} |
| 1188 |
if (Gamecxx . . $ Game..GameStatecxx . . $ orbitalsniper_t#GameState. != OESGAME_PLAYcxx . . $ OESGAME_PLAY.) return 1; |
| 1189 |
if (Gamecxx . . $ Game..ControlStatecxx . . $ orbitalsniper_t#ControlState. == 0) { |
| 1190 |
Gamecxx . . $ Game..MouseXcxx . . $ orbitalsniper_t#MouseX. += val * Gamecxx . . $ Game..CoordScalecxx . . $ orbitalsniper_t#CoordScale.; |
| 1191 |
if (Gamecxx . . $ Game..MouseXcxx . . $ orbitalsniper_t#MouseX. < -320) Gamecxx . . $ Game..MouseXcxx . . $ orbitalsniper_t#MouseX. = -320; |
| 1192 |
if (Gamecxx . . $ Game..MouseXcxx . . $ orbitalsniper_t#MouseX. > (800 -320)) Gamecxx . . $ Game..MouseXcxx . . $ orbitalsniper_t#MouseX. = (800 - 320); |
| 1193 |
} else { |
| 1194 |
/* nothing on horizontal while zoomshift */ |
| 1195 |
} |
| 1196 |
return 0; |
| 1197 |
} |
| 1198 |
|
| 1199 |
/* Mouse motion, vertical */ |
| 1200 |
int oes_bind_mvertcxx . . $ oes_bind_mvert(7864480464b09eea). (int val) |
| 1201 |
{ |
| 1202 |
if (!Gamecxx . . $ Game..GrabPcxx . . $ orbitalsniper_t#GrabP.) { |
| 1203 |
/* A little confusing if not grabbed... */ |
| 1204 |
return 1; |
| 1205 |
} |
| 1206 |
if (Gamecxx . . $ Game..GameStatecxx . . $ orbitalsniper_t#GameState. != OESGAME_PLAYcxx . . $ OESGAME_PLAY.) return 1; |
| 1207 |
if (Gamecxx . . $ Game..ControlStatecxx . . $ orbitalsniper_t#ControlState. == 0) { |
| 1208 |
Gamecxx . . $ Game..MouseYcxx . . $ orbitalsniper_t#MouseY. += val * Gamecxx . . $ Game..CoordScalecxx . . $ orbitalsniper_t#CoordScale.; |
| 1209 |
if (Gamecxx . . $ Game..MouseYcxx . . $ orbitalsniper_t#MouseY. < -240) Gamecxx . . $ Game..MouseYcxx . . $ orbitalsniper_t#MouseY. = -240; |
| 1210 |
if (Gamecxx . . $ Game..MouseYcxx . . $ orbitalsniper_t#MouseY. > (600 - 240)) Gamecxx . . $ Game..MouseYcxx . . $ orbitalsniper_t#MouseY. = (600 - 240); |
| 1211 |
} else { |
| 1212 |
oes_game_zoomcxx . . $ oes_game_zoom(1bb0578f3efdc255). (val * 0.005f); |
| 1213 |
} |
| 1214 |
return 0; |
| 1215 |
} |
| 1216 |
|
| 1217 |
/* Axis, horizontal */ |
| 1218 |
int oes_bind_jhorizcxx . . $ oes_bind_jhoriz(7864480464b09eea). (int val) |
| 1219 |
{ |
| 1220 |
if (!Gamecxx . . $ Game..GrabPcxx . . $ orbitalsniper_t#GrabP.) return 1; |
| 1221 |
if (Gamecxx . . $ Game..GameStatecxx . . $ orbitalsniper_t#GameState. != OESGAME_PLAYcxx . . $ OESGAME_PLAY.) return 1; |
| 1222 |
oesjoycxx . . $ oesjoy..xcxx . . $ oes_joy_t#x. = (val * oesjoycxx . . $ oesjoy..scalecxx . . $ oes_joy_t#scale.) / 32767.0; |
| 1223 |
return val; |
| 1224 |
} |
| 1225 |
|
| 1226 |
/* Axis, vertical */ |
| 1227 |
int oes_bind_jvertcxx . . $ oes_bind_jvert(7864480464b09eea). (int val) |
| 1228 |
{ |
| 1229 |
if (!Gamecxx . . $ Game..GrabPcxx . . $ orbitalsniper_t#GrabP.) return 1; |
| 1230 |
if (Gamecxx . . $ Game..GameStatecxx . . $ orbitalsniper_t#GameState. != OESGAME_PLAYcxx . . $ OESGAME_PLAY.) return 1; |
| 1231 |
oesjoycxx . . $ oesjoy..ycxx . . $ oes_joy_t#y. = (val * oesjoycxx . . $ oesjoy..scalecxx . . $ oes_joy_t#scale.) / 32767.0; |
| 1232 |
return val; |
| 1233 |
} |
| 1234 |
|
| 1235 |
/* Axis, depth (zoom) */ |
| 1236 |
int oes_bind_jdeepcxx . . $ oes_bind_jdeep(7864480464b09eea). (int val) |
| 1237 |
{ |
| 1238 |
float joyz; |
| 1239 |
|
| 1240 |
if (!Gamecxx . . $ Game..GrabPcxx . . $ orbitalsniper_t#GrabP.) return 1; |
| 1241 |
if (Gamecxx . . $ Game..GameStatecxx . . $ orbitalsniper_t#GameState. != OESGAME_PLAYcxx . . $ OESGAME_PLAY.) return 1; |
| 1242 |
oesjoycxx . . $ oesjoy..zcxx . . $ oes_joy_t#z. = val; |
| 1243 |
/* XXX: what about going backwards? */ |
| 1244 |
/* out in */ |
| 1245 |
/* map oes.joyz from 1.25 to 0.05 */ |
| 1246 |
/* 0 32767 */ |
| 1247 |
/* deltas: 1.20 : 32767 */ |
| 1248 |
// joyz = (oesjoy.z * 1.20 / 32767.0) + 0.05; |
| 1249 |
joyz = 1.25 - (oesjoycxx . . $ oesjoy..zcxx . . $ oes_joy_t#z. * 1.20 / 32767.0); |
| 1250 |
Gamecxx . . $ Game..MouseZcxx . . $ orbitalsniper_t#MouseZ. = joyz; |
| 1251 |
oes_game_zoomcxx . . $ oes_game_zoom(1bb0578f3efdc255).(0); |
| 1252 |
|
| 1253 |
return val; |
| 1254 |
} |
| 1255 |
|
| 1256 |
|
| 1257 |
|
| 1258 |
|
| 1259 |
|
| 1260 |
|
| 1261 |
|
| 1262 |
|
| 1263 |
|
| 1264 |
/* After binds. */ |
| 1265 |
|
| 1266 |
|
| 1267 |
|
| 1268 |
/* game binding names (from config file) */ |
| 1269 |
oes_xlat_tcxx . . $ oes_xlat_t# oesxlatcxx . . $ oesxlat.[] = { |
| 1270 |
{ "mousex", oes_bind_mhorizcxx . . $ oes_bind_mhoriz(7864480464b09eea). }, |
| 1271 |
{ "mousey", oes_bind_mvertcxx . . $ oes_bind_mvert(7864480464b09eea). }, |
| 1272 |
{ "joyx", oes_bind_jhorizcxx . . $ oes_bind_jhoriz(7864480464b09eea). }, |
| 1273 |
{ "joyy", oes_bind_jvertcxx . . $ oes_bind_jvert(7864480464b09eea). }, |
| 1274 |
{ "joyz", oes_bind_jdeepcxx . . $ oes_bind_jdeep(7864480464b09eea). }, |
| 1275 |
{ "fire", oes_bind_firecxx . . $ oes_bind_fire(7864480464b09eea). }, |
| 1276 |
{ "zoom", oes_bind_zoomcxx . . $ oes_bind_zoom(7864480464b09eea). }, |
| 1277 |
{ "zoomin", oes_bind_zoomincxx . . $ oes_bind_zoomin(7864480464b09eea). }, |
| 1278 |
{ "zoomout", oes_bind_zoomoutcxx . . $ oes_bind_zoomout(7864480464b09eea). }, |
| 1279 |
{ "verbosity", oes_bind_verbositycxx . . $ oes_bind_verbosity(7864480464b09eea). }, |
| 1280 |
{ "screenshot", oes_bind_screenshotcxx . . $ oes_bind_screenshot(7864480464b09eea). }, |
| 1281 |
{ "fullscreen", oes_bind_fullscreencxx . . $ oes_bind_fullscreen(7864480464b09eea). }, |
| 1282 |
{ "hide", oes_bind_hidecxx . . $ oes_bind_hide(7864480464b09eea). }, |
| 1283 |
{ "abandon", oes_bind_abandoncxx . . $ oes_bind_abandon(7864480464b09eea). }, |
| 1284 |
{ "pause", oes_bind_pausecxx . . $ oes_bind_pause(7864480464b09eea). }, |
| 1285 |
{ "grab", oes_bind_grabcxx . . $ oes_bind_grab(7864480464b09eea). }, |
| 1286 |
{ 0, 0 }, |
| 1287 |
}; |
| 1288 |
|
| 1289 |
|
| 1290 |
|
| 1291 |
|
| 1292 |
/*******************/ |
| 1293 |
/* Events handling */ |
| 1294 |
/*******************/ |
| 1295 |
|
| 1296 |
|
| 1297 |
/* Called at intervals, handling joystick axes. */ |
| 1298 |
int oes_game_joystickcxx . . $ oes_game_joystick(7864480464b09eea). (int ticks) |
| 1299 |
{ |
| 1300 |
/* Joystick axes handling. */ |
| 1301 |
int joyx, joyy; |
| 1302 |
if (!oesjoycxx . . $ oesjoy..sdljoycxx . . $ oes_joy_t#sdljoy.) return 0; |
| 1303 |
if (ticks > oesjoycxx . . $ oesjoy..timecxx . . $ oes_joy_t#time. + oesjoycxx . . $ oesjoy..intervalcxx . . $ oes_joy_t#interval.) { |
| 1304 |
//printf("JOY HANDLE\n"); |
| 1305 |
joyx = (int)(oesjoycxx . . $ oesjoy..xcxx . . $ oes_joy_t#x.); |
| 1306 |
joyy = (int)(oesjoycxx . . $ oesjoy..ycxx . . $ oes_joy_t#y.); |
| 1307 |
switch (oesjoycxx . . $ oesjoy..statecxx . . $ oes_joy_t#state.) { |
| 1308 |
case 0: /* normal */ |
| 1309 |
oes_bind_mhorizcxx . . $ oes_bind_mhoriz(7864480464b09eea).(joyx); |
| 1310 |
oes_bind_mvertcxx . . $ oes_bind_mvert(7864480464b09eea).(joyy); |
| 1311 |
break; |
| 1312 |
case 1: /* shifted 1 */ |
| 1313 |
oes_game_zoomcxx . . $ oes_game_zoom(1bb0578f3efdc255).(joyy * 0.005); |
| 1314 |
break; |
| 1315 |
} |
| 1316 |
oesjoycxx . . $ oesjoy..timecxx . . $ oes_joy_t#time. = ticks; |
| 1317 |
} |
| 1318 |
return 1; |
| 1319 |
} |
| 1320 |
|
| 1321 |
|
| 1322 |
int oes_game_eventscxx . . $ oes_game_events(b126dc7c1de90089). () |
| 1323 |
{ |
| 1324 |
SDL_Event event; |
| 1325 |
int kmod; |
| 1326 |
int oeskey; |
| 1327 |
oesbind_tcxx . . $ oesbind_t# binding; /* function pointer */ |
| 1328 |
|
| 1329 |
while (SDL_PollEvent(&event)) |
| 1330 |
{ |
| 1331 |
switch (event.type) |
| 1332 |
{ |
| 1333 |
case SDL_KEYDOWN: |
| 1334 |
binding = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1335 |
kmod = SDL_GetModState(); |
| 1336 |
oeskey = event.key.keysym.sym; |
| 1337 |
switch (event.key.keysym.sym) |
| 1338 |
{ |
| 1339 |
/* Rebindable keys */ |
| 1340 |
default: |
| 1341 |
binding = oeskeymap_getcxx . . $ oeskeymap_get(3f28065ff06886e1).(&oeskeymapcxx . . $ oeskeymap., oeskey); |
| 1342 |
break; |
| 1343 |
} |
| 1344 |
if (binding) |
| 1345 |
binding(1); |
| 1346 |
break; |
| 1347 |
case SDL_KEYUP: |
| 1348 |
binding = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1349 |
kmod = SDL_GetModState(); |
| 1350 |
oeskey = event.key.keysym.sym; |
| 1351 |
switch (event.key.keysym.sym) |
| 1352 |
{ |
| 1353 |
/* Hard-coded keys */ |
| 1354 |
case SDLK_F12cxx . . $ SDLK_F12.: /* failsafe */ |
| 1355 |
exit(69); |
| 1356 |
break; |
| 1357 |
case SDLK_F4cxx . . $ SDLK_F4.: /* failsafe */ |
| 1358 |
if (kmod & KMOD_ALTcxx . . $ `<external>/3845399233368516323/SDL_keysym.h:286:9`!) exit(69); |
| 1359 |
break; |
| 1360 |
case SDLK_RETURNcxx . . $ SDLK_RETURN.: |
| 1361 |
if (kmod & KMOD_ALTcxx . . $ `<external>/3845399233368516323/SDL_keysym.h:286:9`!) |
| 1362 |
{ |
| 1363 |
binding = oes_bind_fullscreencxx . . $ oes_bind_fullscreen(7864480464b09eea).; |
| 1364 |
} |
| 1365 |
break; |
| 1366 |
case SDLK_zcxx . . $ SDLK_z.: |
| 1367 |
if (kmod & KMOD_CTRLcxx . . $ `<external>/3845399233368516323/SDL_keysym.h:284:9`!) |
| 1368 |
{ |
| 1369 |
binding = oes_bind_hidecxx . . $ oes_bind_hide(7864480464b09eea).; |
| 1370 |
} |
| 1371 |
break; |
| 1372 |
case SDLK_gcxx . . $ SDLK_g.: |
| 1373 |
if (kmod & KMOD_CTRLcxx . . $ `<external>/3845399233368516323/SDL_keysym.h:284:9`!) |
| 1374 |
{ |
| 1375 |
binding = oes_bind_grabcxx . . $ oes_bind_grab(7864480464b09eea).; |
| 1376 |
} |
| 1377 |
break; |
| 1378 |
/* Rebindable keys */ |
| 1379 |
default: |
| 1380 |
binding = oeskeymap_getcxx . . $ oeskeymap_get(3f28065ff06886e1).(&oeskeymapcxx . . $ oeskeymap., oeskey); |
| 1381 |
break; |
| 1382 |
} |
| 1383 |
if (binding) |
| 1384 |
binding(0); |
| 1385 |
break; |
| 1386 |
case SDL_MOUSEMOTION: |
| 1387 |
// binding = oeskeymap_get(&oeskeymap, oeskeymap_resolve("MOUSEX")); |
| 1388 |
binding = oeskeymap_getcxx . . $ oeskeymap_get(3f28065ff06886e1).(&oeskeymapcxx . . $ oeskeymap., keymarkerscxx . . $ keymarkers..mousexcxx . . $ keymarkers_t#mousex.); |
| 1389 |
if (binding) |
| 1390 |
binding(event.motion.xrel); |
| 1391 |
binding = oeskeymap_getcxx . . $ oeskeymap_get(3f28065ff06886e1).(&oeskeymapcxx . . $ oeskeymap., keymarkerscxx . . $ keymarkers..mouseycxx . . $ keymarkers_t#mousey.); |
| 1392 |
if (binding) |
| 1393 |
binding(event.motion.yrel); |
| 1394 |
// oes_bind_mhoriz(event.motion.xrel); |
| 1395 |
// oes_bind_mvert(event.motion.yrel); |
| 1396 |
break; |
| 1397 |
case SDL_MOUSEBUTTONDOWN: |
| 1398 |
// oeskey = oeskeymap_resolve("MOUSE0") + event.button.button; |
| 1399 |
oeskey = keymarkerscxx . . $ keymarkers..mouse0cxx . . $ keymarkers_t#mouse0. + event.button.button; |
| 1400 |
binding = oeskeymap_getcxx . . $ oeskeymap_get(3f28065ff06886e1).(&oeskeymapcxx . . $ oeskeymap., oeskey); |
| 1401 |
if (binding) |
| 1402 |
binding(1); |
| 1403 |
break; |
| 1404 |
case SDL_MOUSEBUTTONUP: |
| 1405 |
oeskey = keymarkerscxx . . $ keymarkers..mouse0cxx . . $ keymarkers_t#mouse0. + event.button.button; |
| 1406 |
binding = oeskeymap_getcxx . . $ oeskeymap_get(3f28065ff06886e1).(&oeskeymapcxx . . $ oeskeymap., oeskey); |
| 1407 |
if (binding) |
| 1408 |
binding(0); |
| 1409 |
break; |
| 1410 |
case SDL_JOYAXISMOTION: |
| 1411 |
// oeskey = oeskeymap_resolve("AXIS1") + event.jaxis.axis; |
| 1412 |
oeskey = keymarkerscxx . . $ keymarkers..axis1cxx . . $ keymarkers_t#axis1. + event.jaxis.axis; |
| 1413 |
binding = oeskeymap_getcxx . . $ oeskeymap_get(3f28065ff06886e1).(&oeskeymapcxx . . $ oeskeymap., oeskey); |
| 1414 |
if (binding) |
| 1415 |
{ |
| 1416 |
binding(event.jaxis.value); |
| 1417 |
} |
| 1418 |
break; |
| 1419 |
case SDL_JOYBUTTONDOWN: |
| 1420 |
// oeskey = oeskeymap_resolve("JOY1") + event.jbutton.button; |
| 1421 |
oeskey = keymarkerscxx . . $ keymarkers..joy1cxx . . $ keymarkers_t#joy1. + event.jbutton.button; |
| 1422 |
binding = oeskeymap_getcxx . . $ oeskeymap_get(3f28065ff06886e1).(&oeskeymapcxx . . $ oeskeymap., oeskey); |
| 1423 |
if (binding) |
| 1424 |
binding(1); |
| 1425 |
break; |
| 1426 |
case SDL_JOYBUTTONUP: |
| 1427 |
oeskey = keymarkerscxx . . $ keymarkers..joy1cxx . . $ keymarkers_t#joy1. + event.jbutton.button; |
| 1428 |
binding = oeskeymap_getcxx . . $ oeskeymap_get(3f28065ff06886e1).(&oeskeymapcxx . . $ oeskeymap., oeskey); |
| 1429 |
if (binding) |
| 1430 |
binding(0); |
| 1431 |
break; |
| 1432 |
case SDL_QUIT: |
| 1433 |
Gamecxx . . $ Game..GameOverReasoncxx . . $ orbitalsniper_t#GameOverReason. = OESREASON_QUITcxx . . $ OESREASON_QUIT.; |
| 1434 |
return 1; |
| 1435 |
break; |
| 1436 |
default: |
| 1437 |
break; |
| 1438 |
} //switch event.type |
| 1439 |
} //while SDL_PollEvent |
| 1440 |
|
| 1441 |
if (Gamecxx . . $ Game..GameStatecxx . . $ orbitalsniper_t#GameState. == OESGAME_PAUSEDcxx . . $ OESGAME_PAUSED.) |
| 1442 |
{ /* Don't hog CPU when paused. */ |
| 1443 |
SDL_Delay(100); |
| 1444 |
} |
| 1445 |
return 0; |
| 1446 |
} |
| 1447 |
|
| 1448 |
|
| 1449 |
/* Main game stub. */ |
| 1450 |
int |
| 1451 |
oes_gamecxx . . $ oes_game(b126dc7c1de90089). () |
| 1452 |
{ |
| 1453 |
int tick; |
| 1454 |
|
| 1455 |
oesjoycxx . . $ oesjoy..timecxx . . $ oes_joy_t#time. = Gamecxx . . $ Game..LastTickcxx . . $ orbitalsniper_t#LastTick.; |
| 1456 |
Gamecxx . . $ Game..GameStartTickcxx . . $ orbitalsniper_t#GameStartTick. = SDL_GetTicks(); |
| 1457 |
Gamecxx . . $ Game..LastTickcxx . . $ orbitalsniper_t#LastTick. = Gamecxx . . $ Game..GameStartTickcxx . . $ orbitalsniper_t#GameStartTick.; |
| 1458 |
sniperbgm_stimulatecxx . . $ sniperbgm_stimulate(4db74b65ed7f6c67).(Gamecxx . . $ Game..BGMcxx . . $ orbitalsniper_t#BGM.); |
| 1459 |
Gamecxx . . $ Game..GameOverReasoncxx . . $ orbitalsniper_t#GameOverReason. = OESREASON_NONEcxx . . $ OESREASON_NONE.; |
| 1460 |
|
| 1461 |
oes_game_grabcxx . . $ oes_game_grab(7864480464b09eea).(1); |
| 1462 |
while (Gamecxx . . $ Game..GameOverReasoncxx . . $ orbitalsniper_t#GameOverReason. == OESREASON_NONEcxx . . $ OESREASON_NONE.) |
| 1463 |
{ |
| 1464 |
tick = SDL_GetTicks(); |
| 1465 |
switch (Gamecxx . . $ Game..GameStatecxx . . $ orbitalsniper_t#GameState.) |
| 1466 |
{ |
| 1467 |
case OESGAME_CHAOScxx . . $ OESGAME_CHAOS.: |
| 1468 |
oes_game_initcxx . . $ oes_game_init(b8aae9ffdb43a026).(&Gamecxx . . $ Game.); |
| 1469 |
sniperbgm_stimulatecxx . . $ sniperbgm_stimulate(4db74b65ed7f6c67).(Gamecxx . . $ Game..BGMcxx . . $ orbitalsniper_t#BGM.); |
| 1470 |
Gamecxx . . $ Game..GameStatecxx . . $ orbitalsniper_t#GameState. = OESGAME_PLAYcxx . . $ OESGAME_PLAY.; |
| 1471 |
break; |
| 1472 |
case OESGAME_PLAYcxx . . $ OESGAME_PLAY.: |
| 1473 |
oes_reindeercxx . . $ oes_reindeer(49f6e7a06ebc5aa8).(); |
| 1474 |
break; |
| 1475 |
case OESGAME_PAUSEDcxx . . $ OESGAME_PAUSED.: |
| 1476 |
Gamecxx . . $ Game..LastTickcxx . . $ orbitalsniper_t#LastTick. = tick; |
| 1477 |
break; |
| 1478 |
case OESGAME_UNPAUSEDcxx . . $ OESGAME_UNPAUSED.: |
| 1479 |
oes_game_pausecxx . . $ oes_game_pause(7864480464b09eea).(0); |
| 1480 |
break; |
| 1481 |
default: |
| 1482 |
Gamecxx . . $ Game..GameStatecxx . . $ orbitalsniper_t#GameState. = OESGAME_CHAOScxx . . $ OESGAME_CHAOS.; |
| 1483 |
break; |
| 1484 |
} |
| 1485 |
|
| 1486 |
/* SDL events. */ |
| 1487 |
oes_game_eventscxx . . $ oes_game_events(b126dc7c1de90089).(); |
| 1488 |
/* joystick-interval handling. */ |
| 1489 |
oes_game_joystickcxx . . $ oes_game_joystick(7864480464b09eea).(tick); |
| 1490 |
} |
| 1491 |
Gamecxx . . $ Game..GameOverTickscxx . . $ orbitalsniper_t#GameOverTicks. = SDL_GetTicks(); |
| 1492 |
oes_game_grabcxx . . $ oes_game_grab(7864480464b09eea).(0); |
| 1493 |
sniperbgm_depresscxx . . $ sniperbgm_depress(4db74b65ed7f6c67).(Gamecxx . . $ Game..BGMcxx . . $ orbitalsniper_t#BGM.); |
| 1494 |
Gamecxx . . $ Game..GameStatecxx . . $ orbitalsniper_t#GameState. = OESGAME_CHAOScxx . . $ OESGAME_CHAOS.; |
| 1495 |
|
| 1496 |
if (Gamecxx . . $ Game..GameOverReasoncxx . . $ orbitalsniper_t#GameOverReason. == OESREASON_QUITcxx . . $ OESREASON_QUIT.) |
| 1497 |
return 0; |
| 1498 |
return 1; |
| 1499 |
} |
| 1500 |
|
| 1501 |
|
| 1502 |
/* Launche web browser to point to a URI. */ |
| 1503 |
int |
| 1504 |
oes_webcxx . . $ oes_web(5c4306d8553b3696). (const char *uri) |
| 1505 |
{ |
| 1506 |
char cmd[256]; |
| 1507 |
|
| 1508 |
/* Don't check URI protocol. Assume browser understands all. */ |
| 1509 |
oes_game_hidecxx . . $ oes_game_hide(7864480464b09eea).(1); |
| 1510 |
snprintf(cmd, sizeof(cmd), "%s \"%s\"", gPrefscxx . . $ gPrefs..wwwbrowsercxx . . $ prefs_#wwwbrowser., uri); |
| 1511 |
return system(cmd); |
| 1512 |
} |
| 1513 |
|
| 1514 |
|
| 1515 |
/* Widget signal fallback (unhandled/unblocked widget signals) */ |
| 1516 |
//int oes_uisignal (oesui_t *gui, const char *signame) |
| 1517 |
int |
| 1518 |
oes_uisignalcxx . . $ oes_uisignal(c2ac3d1eaf2d8402). (oesui_tcxx . . $ oesui_t# *gui, oesui_signal_tcxx . . $ oesui_signal_t# *sig) |
| 1519 |
{ |
| 1520 |
const char *signame; |
| 1521 |
SDL_Rect r; |
| 1522 |
|
| 1523 |
signame = UISIG_NAMEcxx . . $ `src/ui.h:83:9`!(sig); |
| 1524 |
if (0); |
| 1525 |
else if (0 == strcmp(signame, "start-game")) |
| 1526 |
{ |
| 1527 |
oesui_eventcxx . . $ oesui_event(d20ac4a2bf684293).(gui, OESUI_CLOSEcxx . . $ OESUI_CLOSE., 0); |
| 1528 |
if (oes_gamecxx . . $ oes_game(b126dc7c1de90089).()) |
| 1529 |
oesui_opencxx . . $ oesui_open(4540eefb18608ff5).(gui, "gameover"); |
| 1530 |
else |
| 1531 |
gui->retcodecxx . . $ oesui_t#retcode. = 1; |
| 1532 |
return 1; |
| 1533 |
} |
| 1534 |
else if (0 == strcmp(signame, "go-main")) |
| 1535 |
{ |
| 1536 |
oesui_opencxx . . $ oesui_open(4540eefb18608ff5).(gui, "main"); |
| 1537 |
return 1; |
| 1538 |
} |
| 1539 |
else if (0 == strcmp(signame, "go-prefs")) |
| 1540 |
{ |
| 1541 |
oesui_opencxx . . $ oesui_open(4540eefb18608ff5).(gui, "prefs"); |
| 1542 |
return 1; |
| 1543 |
} |
| 1544 |
else if (0 == strcmp(signame, "go-scores")) |
| 1545 |
{ |
| 1546 |
oesui_opencxx . . $ oesui_open(4540eefb18608ff5).(gui, "highscores"); |
| 1547 |
return 1; |
| 1548 |
} |
| 1549 |
else if (0 == strcmp(signame, "frob-fullscreen")) |
| 1550 |
{ |
| 1551 |
oes_bind_fullscreencxx . . $ oes_bind_fullscreen(7864480464b09eea).(0); |
| 1552 |
oesui_eventcxx . . $ oesui_event(d20ac4a2bf684293).(gui, OESUI_UPDATEcxx . . $ OESUI_UPDATE., 0); |
| 1553 |
return 1; |
| 1554 |
} |
| 1555 |
else if (0 == strcmp(signame, "frob-audio")) |
| 1556 |
{ |
| 1557 |
gPrefscxx . . $ gPrefs..audiocxx . . $ prefs_#audio. = !gPrefscxx . . $ gPrefs..audiocxx . . $ prefs_#audio.; |
| 1558 |
oesui_eventcxx . . $ oesui_event(d20ac4a2bf684293).(gui, OESUI_UPDATEcxx . . $ OESUI_UPDATE., 0); |
| 1559 |
return 1; |
| 1560 |
} |
| 1561 |
else if (0 == strcmp(signame, "frob-skill")) |
| 1562 |
{ |
| 1563 |
gPrefscxx . . $ gPrefs..difficultycxx . . $ prefs_#difficulty.++; |
| 1564 |
if (gPrefscxx . . $ gPrefs..difficultycxx . . $ prefs_#difficulty. > 3) |
| 1565 |
gPrefscxx . . $ gPrefs..difficultycxx . . $ prefs_#difficulty. = 1; |
| 1566 |
oesui_eventcxx . . $ oesui_event(d20ac4a2bf684293).(gui, OESUI_UPDATEcxx . . $ OESUI_UPDATE., 0); |
| 1567 |
return 1; |
| 1568 |
} |
| 1569 |
else if (0 == strcmp(signame, "highscores")) |
| 1570 |
{ |
| 1571 |
r.x = UISIG_ARGcxx . . $ `src/ui.h:82:9`!(sig, 1).icxx . . $ oesui_atom_t#i.; |
| 1572 |
r.y = UISIG_ARGcxx . . $ `src/ui.h:82:9`!(sig, 2).icxx . . $ oesui_atom_t#i.; |
| 1573 |
r.w = UISIG_ARGcxx . . $ `src/ui.h:82:9`!(sig, 3).icxx . . $ oesui_atom_t#i.; |
| 1574 |
r.h = UISIG_ARGcxx . . $ `src/ui.h:82:9`!(sig, 4).icxx . . $ oesui_atom_t#i.; |
| 1575 |
draw_hiscorescxx . . $ draw_hiscores(715989be3a25e77e).(gui->screencxx . . $ oesui_t#screen., &r); |
| 1576 |
} |
| 1577 |
else if (0 == strcmp(signame, "gameover")) |
| 1578 |
{ |
| 1579 |
r.x = UISIG_ARGcxx . . $ `src/ui.h:82:9`!(sig, 1).icxx . . $ oesui_atom_t#i.; |
| 1580 |
r.y = UISIG_ARGcxx . . $ `src/ui.h:82:9`!(sig, 2).icxx . . $ oesui_atom_t#i.; |
| 1581 |
r.w = UISIG_ARGcxx . . $ `src/ui.h:82:9`!(sig, 3).icxx . . $ oesui_atom_t#i.; |
| 1582 |
r.h = UISIG_ARGcxx . . $ `src/ui.h:82:9`!(sig, 4).icxx . . $ oesui_atom_t#i.; |
| 1583 |
draw_gameovercxx . . $ draw_gameover(715989be3a25e77e).(gui->screencxx . . $ oesui_t#screen., &r); |
| 1584 |
} |
| 1585 |
else if (0 == strcmp(signame, "quit")) |
| 1586 |
{ |
| 1587 |
gui->retcodecxx . . $ oesui_t#retcode. = 1; |
| 1588 |
return 1; |
| 1589 |
} |
| 1590 |
else if (0 == strcmp(signame, "url-oes")) |
| 1591 |
{ |
| 1592 |
/* http://www.icculus.org/oes/ */ |
| 1593 |
oes_webcxx . . $ oes_web(5c4306d8553b3696).("http://www.icculus.org/oes/"); |
| 1594 |
} |
| 1595 |
else if (0 == strcmp(signame, "url-os")) |
| 1596 |
{ |
| 1597 |
/* http://www.iki.fi/sol/ */ |
| 1598 |
oes_webcxx . . $ oes_web(5c4306d8553b3696).("http://www.iki.fi/sol/"); |
| 1599 |
} |
| 1600 |
else if (0 == strcmp(signame, "url-td")) |
| 1601 |
{ |
| 1602 |
/* http://www.timedoctor.org/ */ |
| 1603 |
oes_webcxx . . $ oes_web(5c4306d8553b3696).("http://www.timedoctor.org/"); |
| 1604 |
} |
| 1605 |
else if (0 == strcmp(signame, "url-io")) |
| 1606 |
{ |
| 1607 |
/* http://www.icculus.org/ */ |
| 1608 |
oes_webcxx . . $ oes_web(5c4306d8553b3696).("http://www.icculus.org/"); |
| 1609 |
} |
| 1610 |
else if (0 == strcmp(signame, "url-ov")) |
| 1611 |
{ |
| 1612 |
/* http://www.vorbis.com/ */ |
| 1613 |
oes_webcxx . . $ oes_web(5c4306d8553b3696).("http://www.vorbis.com/"); |
| 1614 |
} |
| 1615 |
return 0; |
| 1616 |
} |
| 1617 |
|
| 1618 |
|
| 1619 |
int |
| 1620 |
oes_binds_initcxx . . $ oes_binds_init(b126dc7c1de90089). () |
| 1621 |
{ |
| 1622 |
/* TODO: bind map */ |
| 1623 |
/* sane joystick defaults. */ |
| 1624 |
oesjoycxx . . $ oesjoy..stylecxx . . $ oes_joy_t#style. = 0; |
| 1625 |
oesjoycxx . . $ oesjoy..scalecxx . . $ oes_joy_t#scale. = 10.0f; |
| 1626 |
oesjoycxx . . $ oesjoy..intervalcxx . . $ oes_joy_t#interval. = 20; |
| 1627 |
#if 0 |
| 1628 |
oesjoy.axis[0] = oes_bind_jhoriz; |
| 1629 |
oesjoy.axis[1] = oes_bind_jvert; |
| 1630 |
oesjoy.axis[2] = oes_bind_jdeep; |
| 1631 |
oesjoy.button[0] = oes_bind_fire; |
| 1632 |
oesjoy.button[1] = oes_bind_zoom; |
| 1633 |
oesjoy.button[2] = oes_bind_zoomout; |
| 1634 |
oesjoy.button[3] = oes_bind_zoomin; |
| 1635 |
#endif /* 0 */ |
| 1636 |
|
| 1637 |
oeskeymap_initcxx . . $ oeskeymap_init(4554ac8aee1e3e31).(&oeskeymapcxx . . $ oeskeymap.); |
| 1638 |
oeskeymap_loadcxx . . $ oeskeymap_load(6003e71dff3b69f1).(&oeskeymapcxx . . $ oeskeymap., gPrefscxx . . $ gPrefs..bindpathcxx . . $ prefs_#bindpath.); |
| 1639 |
// oeskeymap_set(&oeskeymap, SDLK_a, oes_bind_fire); //test |
| 1640 |
oeskeymap_setcxx . . $ oeskeymap_set(f63c713ba6d28aa7).(&oeskeymapcxx . . $ oeskeymap., SDLK_vcxx . . $ SDLK_v., oes_bind_verbositycxx . . $ oes_bind_verbosity(7864480464b09eea)., 1); |
| 1641 |
oeskeymap_setcxx . . $ oeskeymap_set(f63c713ba6d28aa7).(&oeskeymapcxx . . $ oeskeymap., SDLK_pcxx . . $ SDLK_p., oes_bind_pausecxx . . $ oes_bind_pause(7864480464b09eea)., 1); |
| 1642 |
oeskeymap_setcxx . . $ oeskeymap_set(f63c713ba6d28aa7).(&oeskeymapcxx . . $ oeskeymap., SDLK_scxx . . $ SDLK_s., oes_bind_screenshotcxx . . $ oes_bind_screenshot(7864480464b09eea)., 1); |
| 1643 |
oeskeymap_setcxx . . $ oeskeymap_set(f63c713ba6d28aa7).(&oeskeymapcxx . . $ oeskeymap., SDLK_ESCAPEcxx . . $ SDLK_ESCAPE., oes_bind_abandoncxx . . $ oes_bind_abandon(7864480464b09eea)., 1); |
| 1644 |
oeskeymap_setcxx . . $ oeskeymap_set(f63c713ba6d28aa7).(&oeskeymapcxx . . $ oeskeymap., oeskeymap_resolvecxx . . $ oeskeymap_resolve(5c4306d8553b3696).("MOUSEX"), oes_bind_mhorizcxx . . $ oes_bind_mhoriz(7864480464b09eea)., 1); |
| 1645 |
oeskeymap_setcxx . . $ oeskeymap_set(f63c713ba6d28aa7).(&oeskeymapcxx . . $ oeskeymap., oeskeymap_resolvecxx . . $ oeskeymap_resolve(5c4306d8553b3696).("MOUSEY"), oes_bind_mvertcxx . . $ oes_bind_mvert(7864480464b09eea)., 1); |
| 1646 |
oeskeymap_setcxx . . $ oeskeymap_set(f63c713ba6d28aa7).(&oeskeymapcxx . . $ oeskeymap., oeskeymap_resolvecxx . . $ oeskeymap_resolve(5c4306d8553b3696).("MOUSE1"), oes_bind_firecxx . . $ oes_bind_fire(7864480464b09eea)., 1); |
| 1647 |
oeskeymap_setcxx . . $ oeskeymap_set(f63c713ba6d28aa7).(&oeskeymapcxx . . $ oeskeymap., oeskeymap_resolvecxx . . $ oeskeymap_resolve(5c4306d8553b3696).("MOUSE2"), oes_bind_zoomcxx . . $ oes_bind_zoom(7864480464b09eea)., 1); |
| 1648 |
oeskeymap_setcxx . . $ oeskeymap_set(f63c713ba6d28aa7).(&oeskeymapcxx . . $ oeskeymap., oeskeymap_resolvecxx . . $ oeskeymap_resolve(5c4306d8553b3696).("MOUSE4"), oes_bind_zoomincxx . . $ oes_bind_zoomin(7864480464b09eea)., 1); |
| 1649 |
oeskeymap_setcxx . . $ oeskeymap_set(f63c713ba6d28aa7).(&oeskeymapcxx . . $ oeskeymap., oeskeymap_resolvecxx . . $ oeskeymap_resolve(5c4306d8553b3696).("MOUSE5"), oes_bind_zoomoutcxx . . $ oes_bind_zoomout(7864480464b09eea)., 1); |
| 1650 |
oeskeymap_setcxx . . $ oeskeymap_set(f63c713ba6d28aa7).(&oeskeymapcxx . . $ oeskeymap., oeskeymap_resolvecxx . . $ oeskeymap_resolve(5c4306d8553b3696).("JOY1"), oes_bind_firecxx . . $ oes_bind_fire(7864480464b09eea)., 1); |
| 1651 |
oeskeymap_setcxx . . $ oeskeymap_set(f63c713ba6d28aa7).(&oeskeymapcxx . . $ oeskeymap., oeskeymap_resolvecxx . . $ oeskeymap_resolve(5c4306d8553b3696).("JOY2"), oes_bind_zoomcxx . . $ oes_bind_zoom(7864480464b09eea)., 1); |
| 1652 |
oeskeymap_setcxx . . $ oeskeymap_set(f63c713ba6d28aa7).(&oeskeymapcxx . . $ oeskeymap., oeskeymap_resolvecxx . . $ oeskeymap_resolve(5c4306d8553b3696).("JOY3"), oes_bind_zoomincxx . . $ oes_bind_zoomin(7864480464b09eea)., 1); |
| 1653 |
oeskeymap_setcxx . . $ oeskeymap_set(f63c713ba6d28aa7).(&oeskeymapcxx . . $ oeskeymap., oeskeymap_resolvecxx . . $ oeskeymap_resolve(5c4306d8553b3696).("JOY4"), oes_bind_zoomoutcxx . . $ oes_bind_zoomout(7864480464b09eea)., 1); |
| 1654 |
oeskeymap_setcxx . . $ oeskeymap_set(f63c713ba6d28aa7).(&oeskeymapcxx . . $ oeskeymap., oeskeymap_resolvecxx . . $ oeskeymap_resolve(5c4306d8553b3696).("AXIS1"), oes_bind_jhorizcxx . . $ oes_bind_jhoriz(7864480464b09eea)., 10); |
| 1655 |
oeskeymap_setcxx . . $ oeskeymap_set(f63c713ba6d28aa7).(&oeskeymapcxx . . $ oeskeymap., oeskeymap_resolvecxx . . $ oeskeymap_resolve(5c4306d8553b3696).("AXIS2"), oes_bind_jvertcxx . . $ oes_bind_jvert(7864480464b09eea)., 10); |
| 1656 |
oeskeymap_setcxx . . $ oeskeymap_set(f63c713ba6d28aa7).(&oeskeymapcxx . . $ oeskeymap., oeskeymap_resolvecxx . . $ oeskeymap_resolve(5c4306d8553b3696).("AXIS3"), oes_bind_jdeepcxx . . $ oes_bind_jdeep(7864480464b09eea)., 10); |
| 1657 |
keymarkerscxx . . $ keymarkers..mousexcxx . . $ keymarkers_t#mousex. = oeskeymap_resolvecxx . . $ oeskeymap_resolve(5c4306d8553b3696).("MOUSEX"); |
| 1658 |
keymarkerscxx . . $ keymarkers..mouseycxx . . $ keymarkers_t#mousey. = oeskeymap_resolvecxx . . $ oeskeymap_resolve(5c4306d8553b3696).("MOUSEY"); |
| 1659 |
keymarkerscxx . . $ keymarkers..mouse0cxx . . $ keymarkers_t#mouse0. = oeskeymap_resolvecxx . . $ oeskeymap_resolve(5c4306d8553b3696).("MOUSE0"); |
| 1660 |
keymarkerscxx . . $ keymarkers..axis1cxx . . $ keymarkers_t#axis1. = oeskeymap_resolvecxx . . $ oeskeymap_resolve(5c4306d8553b3696).("AXIS1"); |
| 1661 |
keymarkerscxx . . $ keymarkers..joy1cxx . . $ keymarkers_t#joy1. = oeskeymap_resolvecxx . . $ oeskeymap_resolve(5c4306d8553b3696).("JOY1"); |
| 1662 |
|
| 1663 |
return 0; |
| 1664 |
} |
| 1665 |
|
| 1666 |
|
| 1667 |
int maincxx . . $ main(afcd3168fc1188a4).(int argc, char *argv[]) |
| 1668 |
{ |
| 1669 |
oesui_tcxx . . $ oesui_t# *gui; |
| 1670 |
|
| 1671 |
srand(SDL_GetTicks()); |
| 1672 |
|
| 1673 |
/* |
| 1674 |
Game.mediaPath = (char*)calloc(strlen(argv[0]), sizeof(char)); |
| 1675 |
// invocation = (char*)malloc(strlen(argv[0]) + 1); memcpy(invocation, argv[0], strlen(argv[0])); |
| 1676 |
invocation = strdup(argv[0]); |
| 1677 |
sprintf(Game.mediaPath, "%s", dirname(invocation)); |
| 1678 |
free(invocation); |
| 1679 |
*/ |
| 1680 |
Gamecxx . . $ Game..mediaPathcxx . . $ orbitalsniper_t#mediaPath. = strdup(GAMEDATADIRcxx . . $ `config.h:5:9`!); |
| 1681 |
invocationcxx . . $ invocation. = argv[0]; |
| 1682 |
|
| 1683 |
/* Load Preferences. */ |
| 1684 |
prefs_initcxx . . $ prefs_init(fac825aec9ca7bcf).(&gPrefscxx . . $ gPrefs.); |
| 1685 |
prefs_loadcxx . . $ prefs_load(fac825aec9ca7bcf).(&gPrefscxx . . $ gPrefs.); |
| 1686 |
Gamecxx . . $ Game..verbositycxx . . $ orbitalsniper_t#verbosity. = gPrefscxx . . $ gPrefs..verbosecxx . . $ prefs_#verbose.; |
| 1687 |
|
| 1688 |
/* Parse options, which may override saved preferences. */ |
| 1689 |
parse_argscxx . . $ parse_args(c759356ac01a31e7).(argc, argv); |
| 1690 |
|
| 1691 |
oes_binds_initcxx . . $ oes_binds_init(b126dc7c1de90089).(); |
| 1692 |
oes_setupcxx . . $ oes_setup(b126dc7c1de90089). (); /* prefs initialized in here */ |
| 1693 |
|
| 1694 |
|
| 1695 |
gui = oesui_init_surfacecxx . . $ oesui_init_surface(beb0cc957d9e5acc).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, Gamecxx . . $ Game..Screencxx . . $ orbitalsniper_t#Screen.); /* initialise gui */ |
| 1696 |
oesui_loadcxx . . $ oesui_load(4540eefb18608ff5).(gui, "menus.cfg"); /* Load gui data */ |
| 1697 |
oesui_sighandlecxx . . $ oesui_sighandle(10083bca6c1c8e25).(gui, oes_uisignalcxx . . $ oes_uisignal(c2ac3d1eaf2d8402).); /* widget signal handler */ |
| 1698 |
oesui_opencxx . . $ oesui_open(4540eefb18608ff5).(gui, "main"); /* Main menu */ |
| 1699 |
oesui_loopcxx . . $ oesui_loop(7f84c27812e048a1).(gui); /* Main UI loop */ |
| 1700 |
|
| 1701 |
|
| 1702 |
oes_teardowncxx . . $ oes_teardown(49f6e7a06ebc5aa8). (); |
| 1703 |
// delete[] mediaPath; |
| 1704 |
free(Gamecxx . . $ Game..mediaPathcxx . . $ orbitalsniper_t#mediaPath.); |
| 1705 |
|
| 1706 |
// oes_audio_close(); |
| 1707 |
return 0; |
| 1708 |
} |
| 1709 |
|
| 1710 |
|
| 1711 |
void configure_difficultycxx . . $ configure_difficulty(49f6e7a06ebc5aa8).() |
| 1712 |
{ |
| 1713 |
gPrefscxx . . $ gPrefs..difficultycxx . . $ prefs_#difficulty. = (gPrefscxx . . $ gPrefs..difficultycxx . . $ prefs_#difficulty. < 1 ? 1 : gPrefscxx . . $ gPrefs..difficultycxx . . $ prefs_#difficulty.); |
| 1714 |
gPrefscxx . . $ gPrefs..difficultycxx . . $ prefs_#difficulty. = (gPrefscxx . . $ gPrefs..difficultycxx . . $ prefs_#difficulty. > 3 ? 3 : gPrefscxx . . $ gPrefs..difficultycxx . . $ prefs_#difficulty.); |
| 1715 |
switch (gPrefscxx . . $ gPrefs..difficultycxx . . $ prefs_#difficulty.) |
| 1716 |
{ |
| 1717 |
case 1: |
| 1718 |
Gamecxx . . $ Game..ReloadTimecxx . . $ orbitalsniper_t#ReloadTime. = 1500; |
| 1719 |
Gamecxx . . $ Game..ScoreModcxx . . $ orbitalsniper_t#ScoreMod. = 1.5; |
| 1720 |
break; |
| 1721 |
case 2: |
| 1722 |
Gamecxx . . $ Game..ReloadTimecxx . . $ orbitalsniper_t#ReloadTime. = 3000; |
| 1723 |
Gamecxx . . $ Game..ScoreModcxx . . $ orbitalsniper_t#ScoreMod. = 1.0; |
| 1724 |
break; |
| 1725 |
case 3: |
| 1726 |
Gamecxx . . $ Game..ReloadTimecxx . . $ orbitalsniper_t#ReloadTime. = 4000; |
| 1727 |
Gamecxx . . $ Game..ScoreModcxx . . $ orbitalsniper_t#ScoreMod. = 0.5; |
| 1728 |
break; |
| 1729 |
} |
| 1730 |
} |
| 1731 |
|
| 1732 |
#if 0 |
| 1733 |
void draw_button (SDL_Surface *b, int x, int y) |
| 1734 |
{ |
| 1735 |
SDL_Rect d; |
| 1736 |
|
| 1737 |
d.x = x; |
| 1738 |
d.y = y; |
| 1739 |
d.h = 32; |
| 1740 |
d.w = 196; |
| 1741 |
|
| 1742 |
SDL_BlitSurface (b, NULL, Game.Screen, &d); |
| 1743 |
} |
| 1744 |
#endif /* 0 */ |
| 1745 |
|
| 1746 |
SDL_Surface *oes_load_imgcxx . . $ oes_load_img(998637ddb3131754). (const char *path) |
| 1747 |
{ |
| 1748 |
SDL_Surface *sfc = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1749 |
char lpath[PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!]; |
| 1750 |
snprintf (lpath, PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!, "%s/%s", Gamecxx . . $ Game..mediaPathcxx . . $ orbitalsniper_t#mediaPath., path); |
| 1751 |
sfc = IMG_Load (lpath); |
| 1752 |
if (!sfc) { |
| 1753 |
fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!,"Unable to load image '%s': %s\n",lpath,SDL_GetError()); |
| 1754 |
exit (1); |
| 1755 |
} |
| 1756 |
return sfc; |
| 1757 |
} |
| 1758 |
|
| 1759 |
#if 0 |
| 1760 |
bool hovering (int x, int y, int w, int h) |
| 1761 |
{ |
| 1762 |
int lx, ly; |
| 1763 |
SDL_GetMouseState (&lx, &ly); |
| 1764 |
if ((lx > x) && (ly > y) && |
| 1765 |
(lx < x + w) && (ly < y + h)) |
| 1766 |
return true; |
| 1767 |
return false; |
| 1768 |
} |
| 1769 |
#endif /* 0 */ |