2010-10-12 10:55:23 +02:00
|
|
|
/*
|
2011-03-05 13:44:21 +01:00
|
|
|
* This software is licensed under the terms of the MIT-License
|
2017-02-11 04:52:08 +01:00
|
|
|
* See COPYING for further information.
|
2011-03-05 13:44:21 +01:00
|
|
|
* ---
|
2017-09-12 03:28:15 +02:00
|
|
|
* Copyright (c) 2011-2017, Lukas Weber <laochailan@web.de>.
|
|
|
|
* Copyright (c) 2012-2017, Andrei Alexeyev <akari@alienslab.net>.
|
2010-10-12 10:55:23 +02:00
|
|
|
*/
|
|
|
|
|
2017-11-25 20:45:11 +01:00
|
|
|
#include "taisei.h"
|
|
|
|
|
2010-10-12 10:55:23 +02:00
|
|
|
#include "global.h"
|
|
|
|
|
|
|
|
Global global;
|
|
|
|
|
2017-04-03 01:30:12 +02:00
|
|
|
void init_global(CLIAction *cli) {
|
2017-02-11 04:52:08 +01:00
|
|
|
memset(&global, 0, sizeof(global));
|
2017-02-05 21:16:50 +01:00
|
|
|
|
|
|
|
tsrand_init(&global.rand_game, time(0));
|
|
|
|
tsrand_init(&global.rand_visual, time(0));
|
2012-07-27 19:11:45 +02:00
|
|
|
tsrand_switch(&global.rand_visual);
|
2017-02-11 04:52:08 +01:00
|
|
|
|
2011-07-04 12:40:09 +02:00
|
|
|
memset(&resources, 0, sizeof(Resources));
|
2012-07-14 19:46:03 +02:00
|
|
|
memset(&global.replay, 0, sizeof(Replay));
|
2017-02-05 19:25:18 +01:00
|
|
|
|
2017-04-03 01:30:12 +02:00
|
|
|
global.replaymode = REPLAY_RECORD;
|
|
|
|
global.frameskip = cli->frameskip;
|
2017-02-05 19:25:18 +01:00
|
|
|
|
2017-04-03 01:30:12 +02:00
|
|
|
if(global.frameskip) {
|
|
|
|
log_warn("FPS limiter disabled. Gotta go fast! (frameskip = %i)", global.frameskip);
|
2017-02-05 19:25:18 +01:00
|
|
|
}
|
2011-04-25 19:40:21 +02:00
|
|
|
}
|
2017-09-29 21:03:49 +02:00
|
|
|
|
|
|
|
// Inputdevice-agnostic method of checking whether a game control is pressed.
|
|
|
|
// ALWAYS use this instead of SDL_GetKeyState if you need it.
|
|
|
|
// XXX: Move this somewhere?
|
|
|
|
bool gamekeypressed(KeyIndex key) {
|
|
|
|
return SDL_GetKeyboardState(NULL)[config_get_int(KEYIDX_TO_CFGIDX(key))] || gamepad_gamekeypressed(key);
|
|
|
|
}
|