Cleanup skill.h

See #42
This commit is contained in:
Alexander Batalov 2022-06-19 08:28:29 +03:00
parent ed33eee731
commit a2da6fa26c
2 changed files with 31 additions and 38 deletions

View File

@ -10,6 +10,7 @@
#include "game_config.h" #include "game_config.h"
#include "interface.h" #include "interface.h"
#include "item.h" #include "item.h"
#include "message.h"
#include "object.h" #include "object.h"
#include "palette.h" #include "palette.h"
#include "party_member.h" #include "party_member.h"
@ -25,10 +26,32 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#define SKILLS_MAX_USES_PER_DAY (3)
#define REPAIRABLE_DAMAGE_FLAGS_LENGTH (5)
#define HEALABLE_DAMAGE_FLAGS_LENGTH (5)
typedef struct SkillDescription {
char* name;
char* description;
char* attributes;
int frmId;
int defaultValue;
int statModifier;
int stat1;
int stat2;
int field_20;
int experience;
int field_28;
} SkillDescription;
static void _show_skill_use_messages(Object* obj, int skill, Object* a3, int a4, int a5);
static int skillGetFreeUsageSlot(int skill);
// Damage flags which can be repaired using "Repair" skill. // Damage flags which can be repaired using "Repair" skill.
// //
// 0x4AA2F0 // 0x4AA2F0
const int gRepairableDamageFlags[REPAIRABLE_DAMAGE_FLAGS_LENGTH] = { static const int gRepairableDamageFlags[REPAIRABLE_DAMAGE_FLAGS_LENGTH] = {
DAM_BLIND, DAM_BLIND,
DAM_CRIP_ARM_LEFT, DAM_CRIP_ARM_LEFT,
DAM_CRIP_ARM_RIGHT, DAM_CRIP_ARM_RIGHT,
@ -39,7 +62,7 @@ const int gRepairableDamageFlags[REPAIRABLE_DAMAGE_FLAGS_LENGTH] = {
// Damage flags which can be healed using "Doctor" skill. // Damage flags which can be healed using "Doctor" skill.
// //
// 0x4AA304 // 0x4AA304
const int gHealableDamageFlags[HEALABLE_DAMAGE_FLAGS_LENGTH] = { static const int gHealableDamageFlags[HEALABLE_DAMAGE_FLAGS_LENGTH] = {
DAM_BLIND, DAM_BLIND,
DAM_CRIP_ARM_LEFT, DAM_CRIP_ARM_LEFT,
DAM_CRIP_ARM_RIGHT, DAM_CRIP_ARM_RIGHT,
@ -48,7 +71,7 @@ const int gHealableDamageFlags[HEALABLE_DAMAGE_FLAGS_LENGTH] = {
}; };
// 0x51D118 // 0x51D118
SkillDescription gSkillDescriptions[SKILL_COUNT] = { static SkillDescription gSkillDescriptions[SKILL_COUNT] = {
{ NULL, NULL, NULL, 28, 5, 4, STAT_AGILITY, STAT_INVALID, 1, 0, 0 }, { NULL, NULL, NULL, 28, 5, 4, STAT_AGILITY, STAT_INVALID, 1, 0, 0 },
{ NULL, NULL, NULL, 29, 0, 2, STAT_AGILITY, STAT_INVALID, 1, 0, 0 }, { NULL, NULL, NULL, 29, 0, 2, STAT_AGILITY, STAT_INVALID, 1, 0, 0 },
{ NULL, NULL, NULL, 30, 0, 2, STAT_AGILITY, STAT_INVALID, 1, 0, 0 }, { NULL, NULL, NULL, 30, 0, 2, STAT_AGILITY, STAT_INVALID, 1, 0, 0 },
@ -81,15 +104,15 @@ int _gStealCount = 0;
int _gStealSize = 0; int _gStealSize = 0;
// 0x667F98 // 0x667F98
int _timesSkillUsed[SKILL_COUNT][SKILLS_MAX_USES_PER_DAY]; static int _timesSkillUsed[SKILL_COUNT][SKILLS_MAX_USES_PER_DAY];
// 0x668070 // 0x668070
int gTaggedSkills[NUM_TAGGED_SKILLS]; static int gTaggedSkills[NUM_TAGGED_SKILLS];
// skill.msg // skill.msg
// //
// 0x668080 // 0x668080
MessageList gSkillsMessageList; static MessageList gSkillsMessageList;
// 0x4AA318 // 0x4AA318
int skillsInit() int skillsInit()
@ -471,7 +494,7 @@ int skillGetFrmId(int skill)
} }
// 0x4AAC2C // 0x4AAC2C
void _show_skill_use_messages(Object* obj, int skill, Object* a3, int a4, int criticalChanceModifier) static void _show_skill_use_messages(Object* obj, int skill, Object* a3, int a4, int criticalChanceModifier)
{ {
if (obj != gDude) { if (obj != gDude) {
return; return;
@ -1112,7 +1135,7 @@ int skillGetGameDifficultyModifier(int skill)
} }
// 0x4ABE44 // 0x4ABE44
int skillGetFreeUsageSlot(int skill) static int skillGetFreeUsageSlot(int skill)
{ {
for (int slot = 0; slot < SKILLS_MAX_USES_PER_DAY; slot++) { for (int slot = 0; slot < SKILLS_MAX_USES_PER_DAY; slot++) {
if (_timesSkillUsed[skill][slot] == 0) { if (_timesSkillUsed[skill][slot] == 0) {

View File

@ -2,42 +2,14 @@
#define SKILL_H #define SKILL_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 "skill_defs.h" #include "skill_defs.h"
#define SKILLS_MAX_USES_PER_DAY (3)
#define REPAIRABLE_DAMAGE_FLAGS_LENGTH (5)
#define HEALABLE_DAMAGE_FLAGS_LENGTH (5)
typedef struct SkillDescription {
char* name;
char* description;
char* attributes;
int frmId;
int defaultValue;
int statModifier;
int stat1;
int stat2;
int field_20;
int experience;
int field_28;
} SkillDescription;
extern const int gRepairableDamageFlags[REPAIRABLE_DAMAGE_FLAGS_LENGTH];
extern const int gHealableDamageFlags[HEALABLE_DAMAGE_FLAGS_LENGTH];
extern SkillDescription gSkillDescriptions[SKILL_COUNT];
extern int _gIsSteal; extern int _gIsSteal;
extern int _gStealCount; extern int _gStealCount;
extern int _gStealSize; extern int _gStealSize;
extern int _timesSkillUsed[SKILL_COUNT][SKILLS_MAX_USES_PER_DAY];
extern int gTaggedSkills[NUM_TAGGED_SKILLS];
extern MessageList gSkillsMessageList;
int skillsInit(); int skillsInit();
void skillsReset(); void skillsReset();
void skillsExit(); void skillsExit();
@ -60,11 +32,9 @@ char* skillGetName(int skill);
char* skillGetDescription(int skill); char* skillGetDescription(int skill);
char* skillGetAttributes(int skill); char* skillGetAttributes(int skill);
int skillGetFrmId(int skill); int skillGetFrmId(int skill);
void _show_skill_use_messages(Object* obj, int skill, Object* a3, int a4, int a5);
int skillUse(Object* obj, Object* a2, int skill, int a4); int skillUse(Object* obj, Object* a2, int skill, int a4);
int skillsPerformStealing(Object* a1, Object* a2, Object* item, bool isPlanting); int skillsPerformStealing(Object* a1, Object* a2, Object* item, bool isPlanting);
int skillGetGameDifficultyModifier(int skill); int skillGetGameDifficultyModifier(int skill);
int skillGetFreeUsageSlot(int skill);
int skillUpdateLastUse(int skill); int skillUpdateLastUse(int skill);
int skillsUsageSave(File* stream); int skillsUsageSave(File* stream);
int skillsUsageLoad(File* stream); int skillsUsageLoad(File* stream);