Cleanup skilldex.h

See #42
This commit is contained in:
Alexander Batalov 2022-06-19 08:18:05 +03:00
parent d47522ed8a
commit ef24593371
2 changed files with 44 additions and 58 deletions

View File

@ -1,5 +1,6 @@
#include "skilldex.h" #include "skilldex.h"
#include "art.h"
#include "color.h" #include "color.h"
#include "core.h" #include "core.h"
#include "cycle.h" #include "cycle.h"
@ -8,9 +9,11 @@
#include "game.h" #include "game.h"
#include "game_mouse.h" #include "game_mouse.h"
#include "game_sound.h" #include "game_sound.h"
#include "geometry.h"
#include "interface.h" #include "interface.h"
#include "map.h" #include "map.h"
#include "memory.h" #include "memory.h"
#include "message.h"
#include "object.h" #include "object.h"
#include "platform_compat.h" #include "platform_compat.h"
#include "skill.h" #include "skill.h"
@ -23,11 +26,38 @@
#define SKILLDEX_WINDOW_RIGHT_MARGIN 4 #define SKILLDEX_WINDOW_RIGHT_MARGIN 4
#define SKILLDEX_WINDOW_BOTTOM_MARGIN 6 #define SKILLDEX_WINDOW_BOTTOM_MARGIN 6
#define SKILLDEX_SKILL_BUTTON_BUFFER_COUNT (SKILLDEX_SKILL_COUNT * 2)
typedef enum SkilldexFrm {
SKILLDEX_FRM_BACKGROUND,
SKILLDEX_FRM_BUTTON_ON,
SKILLDEX_FRM_BUTTON_OFF,
SKILLDEX_FRM_LITTLE_RED_BUTTON_UP,
SKILLDEX_FRM_LITTLE_RED_BUTTON_DOWN,
SKILLDEX_FRM_BIG_NUMBERS,
SKILLDEX_FRM_COUNT,
} SkilldexFrm;
typedef enum SkilldexSkill {
SKILLDEX_SKILL_SNEAK,
SKILLDEX_SKILL_LOCKPICK,
SKILLDEX_SKILL_STEAL,
SKILLDEX_SKILL_TRAPS,
SKILLDEX_SKILL_FIRST_AID,
SKILLDEX_SKILL_DOCTOR,
SKILLDEX_SKILL_SCIENCE,
SKILLDEX_SKILL_REPAIR,
SKILLDEX_SKILL_COUNT,
} SkilldexSkill;
static int skilldexWindowInit();
static void skilldexWindowFree();
// 0x51D43C // 0x51D43C
bool gSkilldexWindowIsoWasEnabled = false; static bool gSkilldexWindowIsoWasEnabled = false;
// 0x51D440 // 0x51D440
const int gSkilldexFrmIds[SKILLDEX_FRM_COUNT] = { static const int gSkilldexFrmIds[SKILLDEX_FRM_COUNT] = {
121, 121,
119, 119,
120, 120,
@ -39,7 +69,7 @@ const int gSkilldexFrmIds[SKILLDEX_FRM_COUNT] = {
// Maps Skilldex options into skills. // Maps Skilldex options into skills.
// //
// 0x51D458 // 0x51D458
const int gSkilldexSkills[SKILLDEX_SKILL_COUNT] = { static const int gSkilldexSkills[SKILLDEX_SKILL_COUNT] = {
SKILL_SNEAK, SKILL_SNEAK,
SKILL_LOCKPICK, SKILL_LOCKPICK,
SKILL_STEAL, SKILL_STEAL,
@ -51,32 +81,32 @@ const int gSkilldexSkills[SKILLDEX_SKILL_COUNT] = {
}; };
// 0x668088 // 0x668088
Size gSkilldexFrmSizes[SKILLDEX_FRM_COUNT]; static Size gSkilldexFrmSizes[SKILLDEX_FRM_COUNT];
// 0x6680B8 // 0x6680B8
unsigned char* gSkilldexButtonsData[SKILLDEX_SKILL_BUTTON_BUFFER_COUNT]; static unsigned char* gSkilldexButtonsData[SKILLDEX_SKILL_BUTTON_BUFFER_COUNT];
// skilldex.msg // skilldex.msg
// 0x6680F8 // 0x6680F8
MessageList gSkilldexMessageList; static MessageList gSkilldexMessageList;
// 0x668100 // 0x668100
MessageListItem gSkilldexMessageListItem; static MessageListItem gSkilldexMessageListItem;
// 0x668110 // 0x668110
unsigned char* gSkilldexFrmData[SKILLDEX_FRM_COUNT]; static unsigned char* gSkilldexFrmData[SKILLDEX_FRM_COUNT];
// 0x668128 // 0x668128
CacheEntry* gSkilldexFrmHandles[SKILLDEX_FRM_COUNT]; static CacheEntry* gSkilldexFrmHandles[SKILLDEX_FRM_COUNT];
// 0x668140 // 0x668140
int gSkilldexWindow; static int gSkilldexWindow;
// 0x668144 // 0x668144
unsigned char* gSkilldexWindowBuffer; static unsigned char* gSkilldexWindowBuffer;
// 0x668148 // 0x668148
int gSkilldexWindowOldFont; static int gSkilldexWindowOldFont;
// skilldex_select // skilldex_select
// 0x4ABFD0 // 0x4ABFD0
@ -111,7 +141,7 @@ int skilldexOpen()
} }
// 0x4AC054 // 0x4AC054
int skilldexWindowInit() static int skilldexWindowInit()
{ {
gSkilldexWindowOldFont = fontGetCurrent(); gSkilldexWindowOldFont = fontGetCurrent();
gSkilldexWindowIsoWasEnabled = false; gSkilldexWindowIsoWasEnabled = false;
@ -342,7 +372,7 @@ int skilldexWindowInit()
} }
// 0x4AC67C // 0x4AC67C
void skilldexWindowFree() static void skilldexWindowFree()
{ {
windowDestroy(gSkilldexWindow); windowDestroy(gSkilldexWindow);

View File

@ -1,34 +1,6 @@
#ifndef SKILLDEX_H #ifndef SKILLDEX_H
#define SKILLDEX_H #define SKILLDEX_H
#include "art.h"
#include "geometry.h"
#include "message.h"
#define SKILLDEX_SKILL_BUTTON_BUFFER_COUNT (SKILLDEX_SKILL_COUNT * 2)
typedef enum SkilldexFrm {
SKILLDEX_FRM_BACKGROUND,
SKILLDEX_FRM_BUTTON_ON,
SKILLDEX_FRM_BUTTON_OFF,
SKILLDEX_FRM_LITTLE_RED_BUTTON_UP,
SKILLDEX_FRM_LITTLE_RED_BUTTON_DOWN,
SKILLDEX_FRM_BIG_NUMBERS,
SKILLDEX_FRM_COUNT,
} SkilldexFrm;
typedef enum SkilldexSkill {
SKILLDEX_SKILL_SNEAK,
SKILLDEX_SKILL_LOCKPICK,
SKILLDEX_SKILL_STEAL,
SKILLDEX_SKILL_TRAPS,
SKILLDEX_SKILL_FIRST_AID,
SKILLDEX_SKILL_DOCTOR,
SKILLDEX_SKILL_SCIENCE,
SKILLDEX_SKILL_REPAIR,
SKILLDEX_SKILL_COUNT,
} SkilldexSkill;
typedef enum SkilldexRC { typedef enum SkilldexRC {
SKILLDEX_RC_ERROR = -1, SKILLDEX_RC_ERROR = -1,
SKILLDEX_RC_CANCELED, SKILLDEX_RC_CANCELED,
@ -42,22 +14,6 @@ typedef enum SkilldexRC {
SKILLDEX_RC_REPAIR, SKILLDEX_RC_REPAIR,
} SkilldexRC; } SkilldexRC;
extern bool gSkilldexWindowIsoWasEnabled;
extern const int gSkilldexFrmIds[SKILLDEX_FRM_COUNT];
extern const int gSkilldexSkills[SKILLDEX_SKILL_COUNT];
extern Size gSkilldexFrmSizes[SKILLDEX_FRM_COUNT];
extern unsigned char* gSkilldexButtonsData[SKILLDEX_SKILL_BUTTON_BUFFER_COUNT];
extern MessageList gSkilldexMessageList;
extern MessageListItem gSkilldexMessageListItem;
extern unsigned char* gSkilldexFrmData[SKILLDEX_FRM_COUNT];
extern CacheEntry* gSkilldexFrmHandles[SKILLDEX_FRM_COUNT];
extern int gSkilldexWindow;
extern unsigned char* gSkilldexWindowBuffer;
extern int gSkilldexWindowOldFont;
int skilldexOpen(); int skilldexOpen();
int skilldexWindowInit();
void skilldexWindowFree();
#endif /* SKILLDEX_H */ #endif /* SKILLDEX_H */