| 1 |
/** |
| 2 |
* Game world state |
| 3 |
|
| 4 |
* Copyright (C) 2015 Sylvain Beucler |
| 5 |
|
| 6 |
* This file is part of GNU FreeDink |
| 7 |
|
| 8 |
* GNU FreeDink is free software; you can redistribute it and/or |
| 9 |
* modify it under the terms of the GNU General Public License as |
| 10 |
* published by the Free Software Foundation; either version 3 of the |
| 11 |
* License, or (at your option) any later version. |
| 12 |
|
| 13 |
* GNU FreeDink is distributed in the hope that it will be useful, but |
| 14 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 |
* General Public License for more details. |
| 17 |
|
| 18 |
* You should have received a copy of the GNU General Public License |
| 19 |
* along with this program. If not, see |
| 20 |
* <http://www.gnu.org/licenses/>. |
| 21 |
*/ |
| 22 |
|
| 23 |
#ifndef GAME_STATE_H |
| 24 |
#define GAME_STATE_H |
| 25 |
|
| 26 |
#include "dinkc.h" |
| 27 |
#include "gfx_tiles.h" |
| 28 |
|
| 29 |
/* Game state. */ |
| 30 |
// for storing current tiles in save game |
| 31 |
struct player_info_tile |
| 32 |
{ |
| 33 |
char file[50]; |
| 34 |
}; |
| 35 |
|
| 36 |
enum item_type { ITEM_REGULAR, ITEM_MAGIC }; |
| 37 |
#define NB_MITEMS 8 |
| 38 |
#define NB_ITEMS 16 |
| 39 |
struct item_struct |
| 40 |
{ |
| 41 |
BOOL_1BYTE active; |
| 42 |
char name[10+1]; |
| 43 |
int seq; |
| 44 |
int frame; |
| 45 |
}; |
| 46 |
|
| 47 |
struct editor_sprite_override |
| 48 |
{ |
| 49 |
unsigned char type[100]; // DinkC's editor_type(i) |
| 50 |
unsigned short seq[100]; // DinkC's editor_seq(i) |
| 51 |
unsigned char frame[100]; // DinkC's editor_frame(i) |
| 52 |
Uint32 last_time; // ticks when type 6, 7 or 8 was set |
| 53 |
}; |
| 54 |
|
| 55 |
struct player_info |
| 56 |
{ |
| 57 |
int minutes; |
| 58 |
|
| 59 |
struct item_struct mitem[NB_MITEMS]; |
| 60 |
struct item_struct item[NB_ITEMS]; |
| 61 |
|
| 62 |
int curitem; // highlighted item in the inventory |
| 63 |
enum item_type item_type; |
| 64 |
|
| 65 |
struct editor_sprite_override spmap[769]; /* editor sprite override */ |
| 66 |
|
| 67 |
struct varman var[MAX_VARS]; |
| 68 |
|
| 69 |
int last_map; /* screen to show on the map */ |
| 70 |
|
| 71 |
char palette[50]; |
| 72 |
struct player_info_tile tile[GFX_TILES_NB_SETS+1]; |
| 73 |
struct global_function func[100]; |
| 74 |
|
| 75 |
/* Variables that need not be saved */ |
| 76 |
bool push_active; /* player started maintaining direction against hard object */ |
| 77 |
int push_dir; /* pushing animation direction */ |
| 78 |
unsigned int push_timer; /* time the player started maintaining the direction */ |
| 79 |
|
| 80 |
int last_talk; /* script of last 'say_stop*' sprite */ |
| 81 |
|
| 82 |
int mouse; /* vertical position of the mouse when selecting a dialog option */ |
| 83 |
}; |
| 84 |
extern struct player_info play; |
| 85 |
|
| 86 |
/* TODO: non-backed-up game state */ |
| 87 |
extern int dinkspeed; /* player speed, cf. dc_set_dink_speed */ |
| 88 |
extern int push_active; /* player is allowed to push, cf. dc_push_active */ |
| 89 |
extern unsigned int dink_base_push; /* base Dink push sequence, cf. set_dink_base_push */ |
| 90 |
|
| 91 |
|
| 92 |
/* Engine variables directly mapped with DinkC variables */ |
| 93 |
extern int *pvision, *plife, *presult, *pspeed, *ptiming, *plifemax, |
| 94 |
*pexp, *pstrength, *pcur_weapon,*pcur_magic, *pdefense, |
| 95 |
*pgold, *pmagic, *plevel, *plast_text, *pplayer_map, *pmagic_level, |
| 96 |
*pupdate_status, *pmissile_target, *penemy_sprite, |
| 97 |
*pmagic_cost, *pmissle_source; |
| 98 |
|
| 99 |
#endif |