Cleanup stat.h

See #42
This commit is contained in:
Alexander Batalov 2022-06-18 19:05:10 +03:00
parent 13a7b5e743
commit 8515791ab0
2 changed files with 16 additions and 23 deletions

View File

@ -9,6 +9,7 @@
#include "interface.h" #include "interface.h"
#include "item.h" #include "item.h"
#include "memory.h" #include "memory.h"
#include "message.h"
#include "object.h" #include "object.h"
#include "perk.h" #include "perk.h"
#include "platform_compat.h" #include "platform_compat.h"
@ -23,8 +24,18 @@
#include <algorithm> #include <algorithm>
// Provides metadata about stats.
typedef struct StatDescription {
char* name;
char* description;
int frmId;
int minimumValue;
int maximumValue;
int defaultValue;
} StatDescription;
// 0x51D53C // 0x51D53C
StatDescription gStatDescriptions[STAT_COUNT] = { static StatDescription gStatDescriptions[STAT_COUNT] = {
{ NULL, NULL, 0, PRIMARY_STAT_MIN, PRIMARY_STAT_MAX, 5 }, { NULL, NULL, 0, PRIMARY_STAT_MIN, PRIMARY_STAT_MAX, 5 },
{ NULL, NULL, 1, PRIMARY_STAT_MIN, PRIMARY_STAT_MAX, 5 }, { NULL, NULL, 1, PRIMARY_STAT_MIN, PRIMARY_STAT_MAX, 5 },
{ NULL, NULL, 2, PRIMARY_STAT_MIN, PRIMARY_STAT_MAX, 5 }, { NULL, NULL, 2, PRIMARY_STAT_MIN, PRIMARY_STAT_MAX, 5 },
@ -66,7 +77,7 @@ StatDescription gStatDescriptions[STAT_COUNT] = {
}; };
// 0x51D8CC // 0x51D8CC
StatDescription gPcStatDescriptions[PC_STAT_COUNT] = { static StatDescription gPcStatDescriptions[PC_STAT_COUNT] = {
{ NULL, NULL, 0, 0, INT_MAX, 0 }, { NULL, NULL, 0, 0, INT_MAX, 0 },
{ NULL, NULL, 0, 1, PC_LEVEL_MAX, 1 }, { NULL, NULL, 0, 1, PC_LEVEL_MAX, 1 },
{ NULL, NULL, 0, 0, INT_MAX, 0 }, { NULL, NULL, 0, 0, INT_MAX, 0 },
@ -75,13 +86,13 @@ StatDescription gPcStatDescriptions[PC_STAT_COUNT] = {
}; };
// 0x66817C // 0x66817C
MessageList gStatsMessageList; static MessageList gStatsMessageList;
// 0x668184 // 0x668184
char* gStatValueDescriptions[PRIMARY_STAT_RANGE]; static char* gStatValueDescriptions[PRIMARY_STAT_RANGE];
// 0x6681AC // 0x6681AC
int gPcStatValues[PC_STAT_COUNT]; static int gPcStatValues[PC_STAT_COUNT];
// 0x4AED70 // 0x4AED70
int statsInit() int statsInit()

View File

@ -2,30 +2,12 @@
#define STAT_H #define STAT_H
#include "db.h" #include "db.h"
#include "message.h"
#include "obj_types.h" #include "obj_types.h"
#include "proto_types.h" #include "proto_types.h"
#include "stat_defs.h" #include "stat_defs.h"
#define STAT_ERR_INVALID_STAT (-5) #define STAT_ERR_INVALID_STAT (-5)
// Provides metadata about stats.
typedef struct StatDescription {
char* name;
char* description;
int frmId;
int minimumValue;
int maximumValue;
int defaultValue;
} StatDescription;
extern StatDescription gStatDescriptions[STAT_COUNT];
extern StatDescription gPcStatDescriptions[PC_STAT_COUNT];
extern MessageList gStatsMessageList;
extern char* gStatValueDescriptions[PRIMARY_STAT_RANGE];
extern int gPcStatValues[PC_STAT_COUNT];
int statsInit(); int statsInit();
int statsReset(); int statsReset();
int statsExit(); int statsExit();