Skip to content
This repository has been archived by the owner on Jun 7, 2018. It is now read-only.

Commit

Permalink
Removing global variable ZSDX::zsdx
Browse files Browse the repository at this point in the history
git-svn-id: svn://solarus-engine.org/solarus/trunk@1210 08e91b48-8f19-0410-8fc9-9db6b7bce602
  • Loading branch information
christopho authored and Christophe THIÉRY committed Feb 10, 2012
1 parent f360a50 commit ea6d8dd
Show file tree
Hide file tree
Showing 67 changed files with 1,019 additions and 897 deletions.
4 changes: 3 additions & 1 deletion include/DialogBox.h
Expand Up @@ -69,6 +69,7 @@ class DialogBox {
MessageId first_message_id;

// dialog properties
Game *game;
static Style style;
Speed speed;
SkipMode skip_mode;
Expand Down Expand Up @@ -105,10 +106,11 @@ class DialogBox {
public:

// creation and destruction
DialogBox(const MessageId &first_message_id, int x, int y);
DialogBox(Game *game, const MessageId &first_message_id, int x, int y);
~DialogBox(void);

// dialog properties
Game * get_game(void);
static void set_style(Style style);
Speed get_speed(void);
void set_speed(Speed speed);
Expand Down
31 changes: 17 additions & 14 deletions include/DungeonEquipment.h
Expand Up @@ -30,27 +30,30 @@
*/
class DungeonEquipment {

private:
private:

Savegame *savegame;
int get_current_dungeon(void);
Savegame *savegame;
Game *game; /**< the current game */
int get_current_dungeon(void);

public:
public:

DungeonEquipment(Savegame *savegame);
~DungeonEquipment(void);
DungeonEquipment(Savegame *savegame);
~DungeonEquipment(void);
void set_game(Game *game);

bool has_map(void);
void add_map(void);
bool has_map(void);
void add_map(void);

bool has_compass(void);
void add_compass(void);
bool has_compass(void);
void add_compass(void);

bool has_big_key(void);
void add_big_key(void);
bool has_big_key(void);
void add_big_key(void);

bool has_boss_key(void);
void add_boss_key(void);
bool has_boss_key(void);
void add_boss_key(void);
};

#endif

287 changes: 146 additions & 141 deletions include/Equipment.h
Expand Up @@ -29,147 +29,152 @@
*/
class Equipment {

private:

Savegame *savegame;

// magic bar decrease handling
uint32_t magic_decrease_delay;
uint32_t next_magic_decrease_date;

// giving some bottle content to the player
bool giving_fairy;
bool giving_water;
InventoryItemId destination_bottle_id;

public:

Equipment(Savegame *savegame);
~Equipment(void);

void update(void);

// tunic
int get_tunic(void);
void set_tunic(int tunic);

// sword
bool has_sword(void);
int get_sword(void);
void set_sword(int sword);

// shield
bool has_shield(void);
int get_shield(void);
void set_shield(int shield);

// rupees
int get_max_rupees(void);
void set_max_rupees(int max_rupees);

int get_rupees(void);
void set_rupees(int rupees);
void add_rupees(int rupees_to_add);
void remove_rupees(int rupees_to_remove);

// hearts
int get_max_hearts(void);
void set_max_hearts(int max_hearts);
void add_heart_container(void);

int get_hearts(void);
void set_hearts(int hearts);
void add_hearts(int hearts_to_add);
void remove_hearts(int hearts_to_remove);
void restore_all_hearts(void);
bool needs_hearts(void);

int get_nb_pieces_of_heart(void);
void add_piece_of_heart(void);

// magic
int get_max_magic(void);
void set_max_magic(int max_magic);

int get_magic(void);
void set_magic(int magic);
void add_magic(int magic_to_add);
void remove_magic(int magic_to_remove);
void restore_all_magic(void);
bool needs_magic(void);

bool is_magic_decreasing(void);
void start_removing_magic(uint32_t delay);
void stop_removing_magic(void);

// bombs
int get_max_bombs(void);
void set_max_bombs(int max_bombs);

int get_bombs(void);
void set_bombs(int bombs);
void add_bombs(int bombs_to_add);
void remove_bomb(void);
bool needs_bombs(void);

// arrows
int get_max_arrows(void);
void set_max_arrows(int max_arrows);

int get_arrows(void);
void set_arrows(int arrows);
void add_arrows(int arrows_to_add);
void remove_arrow(void);
bool needs_arrows(void);

// inventory items
int has_inventory_item(InventoryItemId item_id);
void give_inventory_item(InventoryItemId item_id);
void give_inventory_item(InventoryItemId item_id, int variant);
void remove_inventory_item(InventoryItemId item_id);

int get_inventory_item_amount(InventoryItemId item_id);
void set_inventory_item_amount(InventoryItemId item_id, int amount);
void add_inventory_item_amount(InventoryItemId item_id, int amount_to_add);
void remove_inventory_item_amount(InventoryItemId item_id, int amount_to_remove);

int get_inventory_item_maximum(InventoryItemId item_id);
bool has_inventory_item_maximum(InventoryItemId item_id);

// bottles
void add_bottle(void);
bool has_bottle(void);
bool has_empty_bottle(void);
InventoryItemId get_first_empty_bottle(void);
bool has_bottle_with(Treasure::Content content);
InventoryItemId get_first_bottle_with(Treasure::Content content);
InventoryItemId get_destination_bottle(void);
void set_bottle_content(InventoryItemId bottle_id, Treasure::Content content);
void set_bottle_empty(InventoryItemId bottle_id);

void found_fairy(void);
void found_water(void);
void found_water(InventoryItemId bottle_id);

// item assignments
InventoryItemId get_item_assigned(int slot);
void set_item_assigned(int slot, InventoryItemId item_id);

// quest status
bool has_world_map(void);
void add_world_map(void);

// small keys
bool are_small_keys_enabled(void);
int get_small_keys_variable(void);

bool has_small_key(void);
int get_small_keys(void);
void add_small_key(void);
void remove_small_key(void);

// ability to lift items
bool can_lift(int weight);
private:

Savegame *savegame; /**< the savegame encapsulated by this equipment object */
Game *game; /**< the current game (may be NULL when the savegame is loaded outside a game) */

// magic bar decrease handling
uint32_t magic_decrease_delay; /**< when the magic bar decreases with time,
* delay between two decreases of 1 magic point */
uint32_t next_magic_decrease_date; /**< date of the next decrease of 1 magic point */

// giving some bottle content to the player
bool giving_fairy; /**< indicates that the player is getting a fairy */
bool giving_water; /**< indicates that the player is getting water */
InventoryItemId destination_bottle_id; /**< id of the bottle where the content the player is getting will go*/

public:

// creation and destruction
Equipment(Savegame *savegame);
~Equipment(void);
void set_game(Game *game);

void update(void);

// tunic
int get_tunic(void);
void set_tunic(int tunic);

// sword
bool has_sword(void);
int get_sword(void);
void set_sword(int sword);

// shield
bool has_shield(void);
int get_shield(void);
void set_shield(int shield);

// rupees
int get_max_rupees(void);
void set_max_rupees(int max_rupees);

int get_rupees(void);
void set_rupees(int rupees);
void add_rupees(int rupees_to_add);
void remove_rupees(int rupees_to_remove);

// hearts
int get_max_hearts(void);
void set_max_hearts(int max_hearts);
void add_heart_container(void);

int get_hearts(void);
void set_hearts(int hearts);
void add_hearts(int hearts_to_add);
void remove_hearts(int hearts_to_remove);
void restore_all_hearts(void);
bool needs_hearts(void);

int get_nb_pieces_of_heart(void);
void add_piece_of_heart(void);

// magic
int get_max_magic(void);
void set_max_magic(int max_magic);

int get_magic(void);
void set_magic(int magic);
void add_magic(int magic_to_add);
void remove_magic(int magic_to_remove);
void restore_all_magic(void);
bool needs_magic(void);

bool is_magic_decreasing(void);
void start_removing_magic(uint32_t delay);
void stop_removing_magic(void);

// bombs
int get_max_bombs(void);
void set_max_bombs(int max_bombs);

int get_bombs(void);
void set_bombs(int bombs);
void add_bombs(int bombs_to_add);
void remove_bomb(void);
bool needs_bombs(void);

// arrows
int get_max_arrows(void);
void set_max_arrows(int max_arrows);

int get_arrows(void);
void set_arrows(int arrows);
void add_arrows(int arrows_to_add);
void remove_arrow(void);
bool needs_arrows(void);

// inventory items
int has_inventory_item(InventoryItemId item_id);
void give_inventory_item(InventoryItemId item_id);
void give_inventory_item(InventoryItemId item_id, int variant);
void remove_inventory_item(InventoryItemId item_id);

int get_inventory_item_amount(InventoryItemId item_id);
void set_inventory_item_amount(InventoryItemId item_id, int amount);
void add_inventory_item_amount(InventoryItemId item_id, int amount_to_add);
void remove_inventory_item_amount(InventoryItemId item_id, int amount_to_remove);

int get_inventory_item_maximum(InventoryItemId item_id);
bool has_inventory_item_maximum(InventoryItemId item_id);

// bottles
void add_bottle(void);
bool has_bottle(void);
bool has_empty_bottle(void);
InventoryItemId get_first_empty_bottle(void);
bool has_bottle_with(Treasure::Content content);
InventoryItemId get_first_bottle_with(Treasure::Content content);
InventoryItemId get_destination_bottle(void);
void set_bottle_content(InventoryItemId bottle_id, Treasure::Content content);
void set_bottle_empty(InventoryItemId bottle_id);

void found_fairy(void);
void found_water(void);
void found_water(InventoryItemId bottle_id);

// item assignments
InventoryItemId get_item_assigned(int slot);
void set_item_assigned(int slot, InventoryItemId item_id);

// quest status
bool has_world_map(void);
void add_world_map(void);

// small keys
bool are_small_keys_enabled(void);
int get_small_keys_variable(void);

bool has_small_key(void);
int get_small_keys(void);
void add_small_key(void);
void remove_small_key(void);

// ability to lift items
bool can_lift(int weight);
};

#endif

2 changes: 1 addition & 1 deletion include/Game.h
Expand Up @@ -89,7 +89,7 @@ class Game: public Screen {
public:

// creation and destruction
Game(Savegame *savegame);
Game(ZSDX *zsdx, Savegame *savegame);
~Game(void);

// global objects
Expand Down
2 changes: 1 addition & 1 deletion include/ResourceManager.h
Expand Up @@ -54,7 +54,7 @@ class ResourceManager {

static Surface * load_image(const ImageId &id);
static Surface * load_image(const ImageId &id, bool relative_to_sprites_dir);
// TODO flags for options relative_to_sprites_dir and language_specific
// TODO flags for options relative_to_sprites_dir and language_specific - but do this directly in Surface

static Tileset* get_tileset(TilesetId id);
static Map* get_map(MapId id);
Expand Down
2 changes: 1 addition & 1 deletion include/Savegame.h
Expand Up @@ -31,7 +31,7 @@ class Savegame {
* The engine uses strings and integers. The booleans are only used the maps.
*/
typedef struct SavedData {
char strings[64][64]; /**< 64 NULL-terminated strings of 64 characters each (4 Ko) */
char strings[64][64]; /**< 64 NULL-terminated strings of 64 characters each (4 Ko) */
uint32_t integers[2048]; /**< 2048 integers (8 Ko) */
uint32_t booleans[1024]; /**< 32768 boolean values (4 Ko) */

Expand Down

0 comments on commit ea6d8dd

Please sign in to comment.