123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767 |
- #ifndef GLOBAL_H
- #define GLOBAL_H
- #include "common.h"
- #include "map.h"
- #include "ui.h"
- #ifdef __cplusplus
- extern "C"
- {
- #endif
- #define MAX_PLAYERS_IN_PARTY 3
- #define MAX_PLAYER_ROLES 6
- #define MAX_PLAYABLE_PLAYER_ROLES 5
- #define MAX_INVENTORY 256
- #define MAX_STORE_ITEM 9
- #define NUM_MAGIC_ELEMENTAL 5
- #define MAX_ENEMIES_IN_TEAM 5
- #define MAX_PLAYER_EQUIPMENTS 6
- #define MAX_PLAYER_MAGICS 32
- #define MAX_SCENES 300
- #define MAX_OBJECTS 600
- #define MAX_EVENT_OBJECTS 5500
- #define MAX_POISONS 16
- #define MAX_LEVELS 99
- typedef enum tagSTATUS
- {
- kStatusConfused = 0,
- #ifdef PAL_CLASSIC
- kStatusParalyzed,
- #else
- kStatusSlow,
- #endif
- kStatusSleep,
- kStatusSilence,
- kStatusPuppet,
- kStatusBravery,
- kStatusProtect,
- kStatusHaste,
- kStatusDualAttack,
- kStatusAll
- } STATUS;
- #ifndef PAL_CLASSIC
- #define kStatusParalyzed kStatusSleep
- #endif
- typedef enum tagBODYPART
- {
- kBodyPartHead = 0,
- kBodyPartBody,
- kBodyPartShoulder,
- kBodyPartHand,
- kBodyPartFeet,
- kBodyPartWear,
- kBodyPartExtra,
- } BODYPART;
- typedef enum tagOBJECTSTATE
- {
- kObjStateHidden = 0,
- kObjStateNormal = 1,
- kObjStateBlocker = 2
- } OBJECTSTATE, *LPOBJECTSTATE;
- typedef enum tagTRIGGERMODE
- {
- kTriggerNone = 0,
- kTriggerSearchNear = 1,
- kTriggerSearchNormal = 2,
- kTriggerSearchFar = 3,
- kTriggerTouchNear = 4,
- kTriggerTouchNormal = 5,
- kTriggerTouchFar = 6,
- kTriggerTouchFarther = 7,
- kTriggerTouchFarthest = 8
- } TRIGGERMODE;
- typedef struct tagEVENTOBJECT
- {
- SHORT sVanishTime;
- WORD x;
- WORD y;
- SHORT sLayer;
- WORD wTriggerScript;
- WORD wAutoScript;
- SHORT sState;
- WORD wTriggerMode;
- WORD wSpriteNum;
- USHORT nSpriteFrames;
- WORD wDirection;
- WORD wCurrentFrameNum;
- USHORT nScriptIdleFrame;
- WORD wSpritePtrOffset;
- USHORT nSpriteFramesAuto;
- WORD wScriptIdleFrameCountAuto;
- } EVENTOBJECT, *LPEVENTOBJECT;
- typedef struct tagSCENE
- {
- WORD wMapNum;
- WORD wScriptOnEnter;
- WORD wScriptOnTeleport;
- WORD wEventObjectIndex;
- } SCENE, *LPSCENE;
- typedef struct tagOBJECT_PLAYER
- {
- WORD wReserved[2];
- WORD wScriptOnFriendDeath;
- WORD wScriptOnDying;
- } OBJECT_PLAYER;
- typedef enum tagITEMFLAG
- {
- kItemFlagUsable = (1 << 0),
- kItemFlagEquipable = (1 << 1),
- kItemFlagThrowable = (1 << 2),
- kItemFlagConsuming = (1 << 3),
- kItemFlagApplyToAll = (1 << 4),
- kItemFlagSellable = (1 << 5),
- kItemFlagEquipableByPlayerRole_First = (1 << 6)
- } ITEMFLAG;
- typedef struct tagOBJECT_ITEM
- {
- WORD wBitmap;
- WORD wPrice;
- WORD wScriptOnUse;
- WORD wScriptOnEquip;
- WORD wScriptOnThrow;
- WORD wFlags;
- } OBJECT_ITEM;
- typedef enum tagMAGICFLAG
- {
- kMagicFlagUsableOutsideBattle = (1 << 0),
- kMagicFlagUsableInBattle = (1 << 1),
- kMagicFlagUsableToEnemy = (1 << 3),
- kMagicFlagApplyToAll = (1 << 4),
- } MAGICFLAG;
- typedef struct tagOBJECT_MAGIC
- {
- WORD wMagicNumber;
- WORD wReserved1;
- WORD wScriptOnSuccess;
- WORD wScriptOnUse;
- WORD wReserved2;
- WORD wFlags;
- } OBJECT_MAGIC;
- typedef struct tagOBJECT_ENEMY
- {
- WORD wEnemyID;
-
- WORD wResistanceToSorcery;
- WORD wScriptOnTurnStart;
- WORD wScriptOnBattleEnd;
- WORD wScriptOnReady;
- } OBJECT_ENEMY;
- typedef struct tagOBJECT_POISON
- {
- WORD wPoisonLevel;
- WORD wColor;
- WORD wPlayerScript;
- WORD wReserved;
- WORD wEnemyScript;
- } OBJECT_POISON;
- typedef union tagOBJECT
- {
- WORD rgwData[6];
- OBJECT_PLAYER player;
- OBJECT_ITEM item;
- OBJECT_MAGIC magic;
- OBJECT_ENEMY enemy;
- OBJECT_POISON poison;
- } OBJECT, *LPOBJECT;
- typedef struct tagSCRIPTENTRY
- {
- WORD wOperation;
- WORD rgwOperand[3];
- } SCRIPTENTRY, *LPSCRIPTENTRY;
- typedef struct tagINVENTORY
- {
- WORD wItem;
- USHORT nAmount;
- USHORT nAmountInUse;
- } INVENTORY, *LPINVENTORY;
- typedef struct tagSTORE
- {
- WORD rgwItems[MAX_STORE_ITEM];
- } STORE, *LPSTORE;
- typedef struct tagENEMY
- {
- WORD wIdleFrames;
- WORD wMagicFrames;
- WORD wAttackFrames;
- WORD wIdleAnimSpeed;
- WORD wActWaitFrames;
- WORD wYPosOffset;
- WORD wAttackSound;
- WORD wActionSound;
- WORD wMagicSound;
- WORD wDeathSound;
- WORD wCallSound;
- WORD wHealth;
- WORD wExp;
- WORD wCash;
- WORD wLevel;
- WORD wMagic;
- WORD wMagicRate;
- WORD wAttackEquivItem;
- WORD wAttackEquivItemRate;
- WORD wStealItem;
- USHORT nStealItem;
- WORD wAttackStrength;
- WORD wMagicStrength;
- WORD wDefense;
- WORD wDexterity;
- WORD wFleeRate;
- WORD wPoisonResistance;
- WORD wElemResistance[NUM_MAGIC_ELEMENTAL];
- WORD wPhysicalResistance;
- WORD wDualMove;
- WORD wCollectValue;
- } ENEMY, *LPENEMY;
- typedef struct tagENEMYTEAM
- {
- WORD rgwEnemy[MAX_ENEMIES_IN_TEAM];
- } ENEMYTEAM, *LPENEMYTEAM;
- typedef WORD PLAYERS[MAX_PLAYER_ROLES];
- typedef struct tagPLAYERROLES
- {
- PLAYERS rgwAvatar;
- PLAYERS rgwSpriteNumInBattle;
- PLAYERS rgwSpriteNum;
- PLAYERS rgwName;
- PLAYERS rgwAttackAll;
- PLAYERS rgwUnknown1;
- PLAYERS rgwLevel;
- PLAYERS rgwMaxHP;
- PLAYERS rgwMaxMP;
- PLAYERS rgwHP;
- PLAYERS rgwMP;
- WORD rgwEquipment[MAX_PLAYER_EQUIPMENTS][MAX_PLAYER_ROLES];
- PLAYERS rgwAttackStrength;
- PLAYERS rgwMagicStrength;
- PLAYERS rgwDefense;
- PLAYERS rgwDexterity;
- PLAYERS rgwFleeRate;
- PLAYERS rgwPoisonResistance;
- WORD rgwElementalResistance[NUM_MAGIC_ELEMENTAL][MAX_PLAYER_ROLES];
- PLAYERS rgwUnknown2;
- PLAYERS rgwUnknown3;
- PLAYERS rgwUnknown4;
- PLAYERS rgwCoveredBy;
- WORD rgwMagic[MAX_PLAYER_MAGICS][MAX_PLAYER_ROLES];
- PLAYERS rgwWalkFrames;
- PLAYERS rgwCooperativeMagic;
- PLAYERS rgwUnknown5;
- PLAYERS rgwUnknown6;
- PLAYERS rgwDeathSound;
- PLAYERS rgwAttackSound;
- PLAYERS rgwWeaponSound;
- PLAYERS rgwCriticalSound;
- PLAYERS rgwMagicSound;
- PLAYERS rgwCoverSound;
- PLAYERS rgwDyingSound;
- } PLAYERROLES, *LPPLAYERROLES;
- typedef enum tagMAGIC_TYPE
- {
- kMagicTypeNormal = 0,
- kMagicTypeAttackAll = 1,
- kMagicTypeAttackWhole = 2,
- kMagicTypeAttackField = 3,
- kMagicTypeApplyToPlayer = 4,
- kMagicTypeApplyToParty = 5,
- kMagicTypeTrance = 8,
- kMagicTypeSummon = 9,
- } MAGIC_TYPE;
- typedef struct tagMAGIC
- {
- WORD wEffect;
- WORD wType;
- WORD wXOffset;
- WORD wYOffset;
- WORD wSummonEffect;
- WORD wSpeed;
- WORD wKeepEffect;
- WORD wSoundDelay;
- WORD wEffectTimes;
- WORD wShake;
- WORD wWave;
- WORD wUnknown;
- WORD wCostMP;
- WORD wBaseDamage;
- WORD wElemental;
- WORD wSound;
- } MAGIC, *LPMAGIC;
- typedef struct tagBATTLEFIELD
- {
- WORD wScreenWave;
- SHORT rgsMagicEffect[NUM_MAGIC_ELEMENTAL];
- } BATTLEFIELD, *LPBATTLEFIELD;
- typedef struct tagLEVELUPMAGIC
- {
- WORD wLevel;
- WORD wMagic;
- } LEVELUPMAGIC, *LPLEVELUPMAGIC;
- typedef struct tagLEVELUPMAGIC_ALL
- {
- LEVELUPMAGIC m[MAX_PLAYABLE_PLAYER_ROLES];
- } LEVELUPMAGIC_ALL, *LPLEVELUPMAGIC_ALL;
- typedef struct tagENEMYPOS
- {
- struct {
- WORD x;
- WORD y;
- } pos[MAX_ENEMIES_IN_TEAM][MAX_ENEMIES_IN_TEAM];
- } ENEMYPOS, *LPENEMYPOS;
- typedef WORD LEVELUPEXP, *LPLEVELUPEXP;
- typedef struct tagGAMEDATA
- {
- LPEVENTOBJECT lprgEventObject;
- int nEventObject;
- SCENE rgScene[MAX_SCENES];
- OBJECT rgObject[MAX_OBJECTS];
- LPSCRIPTENTRY lprgScriptEntry;
- int nScriptEntry;
- LPSTORE lprgStore;
- int nStore;
- LPENEMY lprgEnemy;
- int nEnemy;
- LPENEMYTEAM lprgEnemyTeam;
- int nEnemyTeam;
- PLAYERROLES PlayerRoles;
- LPMAGIC lprgMagic;
- int nMagic;
- LPBATTLEFIELD lprgBattleField;
- int nBattleField;
- LPLEVELUPMAGIC_ALL lprgLevelUpMagic;
- int nLevelUpMagic;
- ENEMYPOS EnemyPos;
- LEVELUPEXP rgLevelUpExp[MAX_LEVELS + 1];
- WORD rgwBattleEffectIndex[10][2];
- } GAMEDATA, *LPGAMEDATA;
- typedef struct tagFILES
- {
- FILE *fpFBP;
- FILE *fpMGO;
- FILE *fpBALL;
- FILE *fpDATA;
- FILE *fpF;
- FILE *fpFIRE;
- FILE *fpRGM;
- FILE *fpSSS;
- } FILES, *LPFILES;
- typedef struct tagPARTY
- {
- WORD wPlayerRole;
- SHORT x, y;
- WORD wFrame;
- WORD wImageOffset;
- } PARTY, *LPPARTY;
- typedef struct tagTRAIL
- {
- WORD x, y;
- WORD wDirection;
- } TRAIL, *LPTRAIL;
- typedef struct tagEXPERIENCE
- {
- WORD wExp;
- WORD wReserved;
- WORD wLevel;
- WORD wCount;
- } EXPERIENCE, *LPEXPERIENCE;
- typedef struct tagALLEXPERIENCE
- {
- EXPERIENCE rgPrimaryExp[MAX_PLAYER_ROLES];
- EXPERIENCE rgHealthExp[MAX_PLAYER_ROLES];
- EXPERIENCE rgMagicExp[MAX_PLAYER_ROLES];
- EXPERIENCE rgAttackExp[MAX_PLAYER_ROLES];
- EXPERIENCE rgMagicPowerExp[MAX_PLAYER_ROLES];
- EXPERIENCE rgDefenseExp[MAX_PLAYER_ROLES];
- EXPERIENCE rgDexterityExp[MAX_PLAYER_ROLES];
- EXPERIENCE rgFleeExp[MAX_PLAYER_ROLES];
- } ALLEXPERIENCE, *LPALLEXPERIENCE;
- typedef struct tagPOISONSTATUS
- {
- WORD wPoisonID;
- WORD wPoisonScript;
- } POISONSTATUS, *LPPOISONSTATUS;
- typedef struct tagGLOBALVARS
- {
- FILES f;
- GAMEDATA g;
- BYTE bCurrentSaveSlot;
- int iCurMainMenuItem;
- int iCurSystemMenuItem;
- int iCurInvMenuItem;
- int iCurPlayingRNG;
- BOOL fGameStart;
- BOOL fEnteringScene;
- BOOL fNeedToFadeIn;
- BOOL fInBattle;
- BOOL fAutoBattle;
- #ifndef PAL_CLASSIC
- BYTE bBattleSpeed;
- #endif
- WORD wLastUnequippedItem;
- PLAYERROLES rgEquipmentEffect[MAX_PLAYER_EQUIPMENTS + 1];
- WORD rgPlayerStatus[MAX_PLAYER_ROLES][kStatusAll];
- PAL_POS viewport;
- PAL_POS partyoffset;
- WORD wLayer;
- WORD wMaxPartyMemberIndex;
- PARTY rgParty[MAX_PLAYABLE_PLAYER_ROLES];
- TRAIL rgTrail[MAX_PLAYABLE_PLAYER_ROLES];
- WORD wPartyDirection;
- WORD wNumScene;
- WORD wNumPalette;
- BOOL fNightPalette;
- WORD wNumMusic;
- WORD wNumBattleMusic;
- WORD wNumBattleField;
- WORD wCollectValue;
- WORD wScreenWave;
- SHORT sWaveProgression;
- WORD wChaseRange;
- WORD wChasespeedChangeCycles;
- USHORT nFollower;
- DWORD dwCash;
- ALLEXPERIENCE Exp;
- POISONSTATUS rgPoisonStatus[MAX_POISONS][MAX_PLAYABLE_PLAYER_ROLES];
- INVENTORY rgInventory[MAX_INVENTORY];
- LPOBJECTDESC lpObjectDesc;
- DWORD dwFrameNum;
- } GLOBALVARS, *LPGLOBALVARS;
- typedef struct tagSAVEDGAME
- {
- WORD wSavedTimes;
- WORD wViewportX, wViewportY;
- WORD nPartyMember;
- WORD wNumScene;
- WORD wPaletteOffset;
- WORD wPartyDirection;
- WORD wNumMusic;
- WORD wNumBattleMusic;
- WORD wNumBattleField;
- WORD wScreenWave;
- WORD wBattleSpeed;
- WORD wCollectValue;
- WORD wLayer;
- WORD wChaseRange;
- WORD wChasespeedChangeCycles;
- WORD nFollower;
- WORD rgwReserved2[3];
- DWORD dwCash;
- PARTY rgParty[MAX_PLAYABLE_PLAYER_ROLES];
- TRAIL rgTrail[MAX_PLAYABLE_PLAYER_ROLES];
- ALLEXPERIENCE Exp;
- PLAYERROLES PlayerRoles;
- POISONSTATUS rgPoisonStatus[MAX_POISONS][MAX_PLAYABLE_PLAYER_ROLES];
- INVENTORY rgInventory[MAX_INVENTORY];
- SCENE rgScene[MAX_SCENES];
- OBJECT rgObject[MAX_OBJECTS];
- EVENTOBJECT rgEventObject[MAX_EVENT_OBJECTS];
- } SAVEDGAME, *LPSAVEDGAME;
- extern LPGLOBALVARS gpGlobals;
- INT
- PAL_InitGlobals(
- VOID
- );
- VOID
- PAL_FreeGlobals(
- VOID
- );
- VOID
- PAL_SaveGame(
- LPCSTR szFileName,
- WORD wSavedTimes
- );
- VOID
- PAL_InitGameData(
- INT iSaveSlot
- );
- BOOL
- PAL_AddItemToInventory(
- WORD wObjectID,
- INT iNum
- );
- BOOL
- PAL_IncreaseHPMP(
- WORD wPlayerRole,
- SHORT sHP,
- SHORT sMP
- );
- INT
- PAL_GetItemAmount(
- WORD wItem
- );
- VOID
- PAL_UpdateEquipments(
- VOID
- );
- VOID
- PAL_CompressInventory(
- VOID
- );
- VOID
- PAL_RemoveEquipmentEffect(
- WORD wPlayerRole,
- WORD wEquipPart
- );
- VOID
- PAL_AddPoisonForPlayer(
- WORD wPlayerRole,
- WORD wPoisonID
- );
- VOID
- PAL_CurePoisonByKind(
- WORD wPlayerRole,
- WORD wPoisonID
- );
- VOID
- PAL_CurePoisonByLevel(
- WORD wPlayerRole,
- WORD wMaxLevel
- );
- BOOL
- PAL_IsPlayerPoisonedByLevel(
- WORD wPlayerRole,
- WORD wMinLevel
- );
- BOOL
- PAL_IsPlayerPoisonedByKind(
- WORD wPlayerRole,
- WORD wPoisonID
- );
- WORD
- PAL_GetPlayerAttackStrength(
- WORD wPlayerRole
- );
- WORD
- PAL_GetPlayerMagicStrength(
- WORD wPlayerRole
- );
- WORD
- PAL_GetPlayerDefense(
- WORD wPlayerRole
- );
- WORD
- PAL_GetPlayerDexterity(
- WORD wPlayerRole
- );
- WORD
- PAL_GetPlayerFleeRate(
- WORD wPlayerRole
- );
- WORD
- PAL_GetPlayerPoisonResistance(
- WORD wPlayerRole
- );
- WORD
- PAL_GetPlayerElementalResistance(
- WORD wPlayerRole,
- INT iAttrib
- );
- WORD
- PAL_GetPlayerBattleSprite(
- WORD wPlayerRole
- );
- WORD
- PAL_GetPlayerCooperativeMagic(
- WORD wPlayerRole
- );
- BOOL
- PAL_PlayerCanAttackAll(
- WORD wPlayerRole
- );
- BOOL
- PAL_AddMagic(
- WORD wPlayerRole,
- WORD wMagic
- );
- VOID
- PAL_RemoveMagic(
- WORD wPlayerRole,
- WORD wMagic
- );
- VOID
- PAL_SetPlayerStatus(
- WORD wPlayerRole,
- WORD wStatusID,
- WORD wNumRound
- );
- VOID
- PAL_RemovePlayerStatus(
- WORD wPlayerRole,
- WORD wStatusID
- );
- VOID
- PAL_ClearAllPlayerStatus(
- VOID
- );
- VOID
- PAL_PlayerLevelUp(
- WORD wPlayerRole,
- WORD wNumLevel
- );
- #ifdef __cplusplus
- }
- #endif
- #endif
|