Start of options screen.
This commit is contained in:
parent
28d3c70183
commit
dc85abac77
|
@ -0,0 +1,144 @@
|
|||
/*
|
||||
Copyright (C) 2018 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "options.h"
|
||||
|
||||
static void (*returnFromOptions)(void);
|
||||
static void logic(void);
|
||||
static void draw(void);
|
||||
static void soundVolume(void);
|
||||
static void musicVolume(void);
|
||||
static void bloodGore(void);
|
||||
static void trophyScreenshot(void);
|
||||
static void trophyAlert(void);
|
||||
static void inventory(void);
|
||||
static void keyboard(void);
|
||||
static void joypad(void);
|
||||
static void back(void);
|
||||
|
||||
static Widget soundVolumeWidget;
|
||||
static Widget musicVolumeWidget;
|
||||
static Widget bloodGoreWidget;
|
||||
static Widget trophyScreenshotWidget;
|
||||
static Widget trophyAlertWidget;
|
||||
static Widget inventoryWidget;
|
||||
static Widget keyboardWidget;
|
||||
static Widget joypadWidget;
|
||||
static Widget backWidget;
|
||||
|
||||
void initOptions((void)(*callback))
|
||||
{
|
||||
returnFromOptions = callback;
|
||||
|
||||
atlasTexture = getTexture("");
|
||||
|
||||
soundVolumeWidget = getWidget("soundVolume", "options")
|
||||
soundVolumeWidget->action = soundVolume;
|
||||
soundVolumeWidget->value = game.config.soundVolume;
|
||||
|
||||
musicVolumeWidget = getWidget("musicVolume", "options")
|
||||
musicVolumeWidget->action = musicVolume;
|
||||
musicVolumeWidget->value = game.config.musicVolume;
|
||||
|
||||
bloodGoreWidget = getWidget("bloodGore", "options")
|
||||
bloodGoreWidget->action = bloodGore;
|
||||
bloodGoreWidget->value = game.config.blood;
|
||||
|
||||
trophyScreenshotWidget = getWidget("trophyScreenshot", "options")
|
||||
trophyScreenshotWidget->action = trophyScreenshot;
|
||||
trophyScreenshotWidget->value = game.config.trophyScreenshot;
|
||||
|
||||
trophyAlertWidget = getWidget("trophyAlert", "options")
|
||||
trophyAlertWidget->action = trophyAlert;
|
||||
trophyAlertWidget->value = game.config.trophyAlert;
|
||||
|
||||
inventoryWidget = getWidget("inventory", "options")
|
||||
inventoryWidget->action = inventory;
|
||||
inventoryWidget->value = game.config.inventory;
|
||||
|
||||
keyboardWidget = getWidget("keyboard", "options")
|
||||
keyboardWidget->action = keyboard;
|
||||
|
||||
joypadWidget = getWidget("joypad", "options")
|
||||
joypadWidget->action = joypad;
|
||||
|
||||
backWidget = getWidget("back", "options")
|
||||
backWidget->action = back;
|
||||
|
||||
showWidgetGroup("options");
|
||||
|
||||
app.delegate.logic = logic;
|
||||
app.delegate.draw = draw;
|
||||
}
|
||||
|
||||
static void logic(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void draw(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void soundVolume(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void musicVolume(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void bloodGore(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void trophyScreenshot(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void trophyAlert(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void inventory(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void keyboard(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void joypad(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void back(void)
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
Copyright (C) 2018 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
extern App app;
|
||||
extern Game game;
|
|
@ -209,7 +209,6 @@ struct Item {
|
|||
|
||||
struct Bob {
|
||||
struct Unit;
|
||||
int checkpointTimer;
|
||||
int outTimer;
|
||||
int stunTimer;
|
||||
int immuneTimer;
|
||||
|
@ -331,8 +330,10 @@ typedef struct {
|
|||
int musicVolume;
|
||||
int keyControls[CONTROL_MAX];
|
||||
int joypadControls[CONTROL_MAX];
|
||||
int hudInventory;
|
||||
int inventory;
|
||||
int blood;
|
||||
int trophyScreenshot;
|
||||
int trophyAlert;
|
||||
} Config;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -192,8 +192,10 @@ static void initDefaultConfig(void)
|
|||
{
|
||||
int i;
|
||||
|
||||
app.config.hudInventory = 1;
|
||||
app.config.inventory = 1;
|
||||
app.config.blood = 1;
|
||||
app.config.trophyAlert = 1;
|
||||
app.config.trophyScreenshot = 1;
|
||||
|
||||
app.config.musicVolume = 8;
|
||||
app.config.soundVolume = 10;
|
||||
|
@ -239,8 +241,10 @@ static void loadConfig(void)
|
|||
app.config.musicVolume = cJSON_GetObjectItem(root, "musicVolume")->valueint;
|
||||
app.config.soundVolume = cJSON_GetObjectItem(root, "soundVolume")->valueint;
|
||||
|
||||
app.config.hudInventory = cJSON_GetObjectItem(root, "hudInventory")->valueint;
|
||||
app.config.inventory = cJSON_GetObjectItem(root, "inventory")->valueint;
|
||||
app.config.blood = cJSON_GetObjectItem(root, "blood")->valueint;
|
||||
app.config.trophyAlert = cJSON_GetObjectItem(root, "trophyAlert")->valueint;
|
||||
app.config.trophyScreenshot = cJSON_GetObjectItem(root, "trophyScreenshot")->valueint;
|
||||
|
||||
controlsJSON = cJSON_GetObjectItem(root, "controls");
|
||||
if (controlsJSON)
|
||||
|
@ -288,7 +292,9 @@ void saveConfig(void)
|
|||
cJSON_AddNumberToObject(root, "soundVolume", app.config.soundVolume);
|
||||
|
||||
cJSON_AddNumberToObject(root, "blood", app.config.blood);
|
||||
cJSON_AddNumberToObject(root, "hudInventory", app.config.hudInventory);
|
||||
cJSON_AddNumberToObject(root, "inventory", app.config.inventory);
|
||||
cJSON_AddNumberToObject(root, "trophyAlert", app.config.trophyAlert);
|
||||
cJSON_AddNumberToObject(root, "trophyScreenshot", app.config.trophyScreenshot);
|
||||
|
||||
keysJSON = cJSON_CreateObject();
|
||||
for (i = 0 ; i < CONTROL_MAX ; i++)
|
||||
|
|
|
@ -20,11 +20,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "textures.h"
|
||||
|
||||
static Texture textures[NUM_TEXTURE_BUCKETS];
|
||||
|
||||
static Texture *addTextureToCache(const char *name, SDL_Texture *texture);
|
||||
Texture *getTexture(const char *name);
|
||||
|
||||
static Texture textures[NUM_TEXTURE_BUCKETS];
|
||||
|
||||
void initTextures(void)
|
||||
{
|
||||
memset(&textures, 0, sizeof(Texture) * NUM_TEXTURE_BUCKETS);
|
||||
|
|
|
@ -69,7 +69,7 @@ void drawHud(void)
|
|||
|
||||
drawText(5, 80, 16, TA_LEFT, colors.white, "Weapon: %s", getWeaponName(world.bob->weaponType));
|
||||
|
||||
if (app.config.hudInventory)
|
||||
if (app.config.inventory)
|
||||
{
|
||||
drawInventory();
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ void drawMissionStatus(void)
|
|||
SDL_Rect *r;
|
||||
char *status;
|
||||
|
||||
drawRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 0, 64);
|
||||
drawRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 0, 128);
|
||||
|
||||
w = 800;
|
||||
h = 550;
|
||||
|
|
Loading…
Reference in New Issue