global.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766
  1. //
  2. // Copyright (c) 2009, Wei Mingzhi <whistler_wmz@users.sf.net>.
  3. // All rights reserved.
  4. //
  5. // This file is part of SDLPAL.
  6. //
  7. // SDLPAL is free software: you can redistribute it and/or modify
  8. // it under the terms of the GNU General Public License as published by
  9. // the Free Software Foundation, either version 3 of the License, or
  10. // (at your option) any later version.
  11. //
  12. // This program is distributed in the hope that it will be useful,
  13. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. // GNU General Public License for more details.
  16. //
  17. // You should have received a copy of the GNU General Public License
  18. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. //
  20. #ifndef GLOBAL_H
  21. #define GLOBAL_H
  22. #include "common.h"
  23. #include "map.h"
  24. #include "ui.h"
  25. #ifdef __cplusplus
  26. extern "C"
  27. {
  28. #endif
  29. //
  30. // SOME NOTES ON "AUTO SCRIPT" AND "TRIGGER SCRIPT":
  31. //
  32. // Auto scripts are executed automatically in each frame.
  33. //
  34. // Trigger scripts are only executed when the event is triggered (player touched
  35. // an event object, player triggered an event script by pressing Spacebar).
  36. //
  37. // maximum number of players in party
  38. #define MAX_PLAYERS_IN_PARTY 3
  39. // total number of possible player roles
  40. #define MAX_PLAYER_ROLES 6
  41. // totally number of playable player roles
  42. #define MAX_PLAYABLE_PLAYER_ROLES 5
  43. // maximum entries of inventory
  44. #define MAX_INVENTORY 256
  45. // maximum items in a store
  46. #define MAX_STORE_ITEM 9
  47. // total number of magic attributes
  48. #define NUM_MAGIC_ELEMENTAL 5
  49. // maximum number of enemies in a team
  50. #define MAX_ENEMIES_IN_TEAM 5
  51. // maximum number of equipments for a player
  52. #define MAX_PLAYER_EQUIPMENTS 6
  53. // maximum number of magics for a player
  54. #define MAX_PLAYER_MAGICS 32
  55. // maximum number of scenes
  56. #define MAX_SCENES 300
  57. // maximum number of objects
  58. #define MAX_OBJECTS 600
  59. // maximum number of event objects (should be somewhat more than the original,
  60. // as there are some modified versions which has more)
  61. #define MAX_EVENT_OBJECTS 5500
  62. // maximum number of effective poisons to players
  63. #define MAX_POISONS 16
  64. // maximum number of level
  65. #define MAX_LEVELS 99
  66. // status of characters
  67. typedef enum tagSTATUS
  68. {
  69. kStatusConfused = 0, // attack friends randomly
  70. #ifdef PAL_CLASSIC
  71. kStatusParalyzed, // paralyzed
  72. #else
  73. kStatusSlow, // slower
  74. #endif
  75. kStatusSleep, // not allowed to move
  76. kStatusSilence, // cannot use magic
  77. kStatusPuppet, // for dead players only, continue attacking
  78. kStatusBravery, // more power for physical attacks
  79. kStatusProtect, // more defense value
  80. kStatusHaste, // faster
  81. kStatusDualAttack, // dual attack
  82. kStatusAll
  83. } STATUS;
  84. #ifndef PAL_CLASSIC
  85. #define kStatusParalyzed kStatusSleep
  86. #endif
  87. // body parts of equipments
  88. typedef enum tagBODYPART
  89. {
  90. kBodyPartHead = 0,
  91. kBodyPartBody,
  92. kBodyPartShoulder,
  93. kBodyPartHand,
  94. kBodyPartFeet,
  95. kBodyPartWear,
  96. kBodyPartExtra,
  97. } BODYPART;
  98. // state of event object, used by the sState field of the EVENTOBJECT struct
  99. typedef enum tagOBJECTSTATE
  100. {
  101. kObjStateHidden = 0,
  102. kObjStateNormal = 1,
  103. kObjStateBlocker = 2
  104. } OBJECTSTATE, *LPOBJECTSTATE;
  105. typedef enum tagTRIGGERMODE
  106. {
  107. kTriggerNone = 0,
  108. kTriggerSearchNear = 1,
  109. kTriggerSearchNormal = 2,
  110. kTriggerSearchFar = 3,
  111. kTriggerTouchNear = 4,
  112. kTriggerTouchNormal = 5,
  113. kTriggerTouchFar = 6,
  114. kTriggerTouchFarther = 7,
  115. kTriggerTouchFarthest = 8
  116. } TRIGGERMODE;
  117. typedef struct tagEVENTOBJECT
  118. {
  119. SHORT sVanishTime; // vanish time (?)
  120. WORD x; // X coordinate on the map
  121. WORD y; // Y coordinate on the map
  122. SHORT sLayer; // layer value
  123. WORD wTriggerScript; // Trigger script entry
  124. WORD wAutoScript; // Auto script entry
  125. SHORT sState; // state of this object
  126. WORD wTriggerMode; // trigger mode
  127. WORD wSpriteNum; // number of the sprite
  128. USHORT nSpriteFrames; // total number of frames of the sprite
  129. WORD wDirection; // direction
  130. WORD wCurrentFrameNum; // current frame number
  131. USHORT nScriptIdleFrame; // count of idle frames, used by trigger script
  132. WORD wSpritePtrOffset; // FIXME: ???
  133. USHORT nSpriteFramesAuto; // total number of frames of the sprite, used by auto script
  134. WORD wScriptIdleFrameCountAuto; // count of idle frames, used by auto script
  135. } EVENTOBJECT, *LPEVENTOBJECT;
  136. typedef struct tagSCENE
  137. {
  138. WORD wMapNum; // number of the map
  139. WORD wScriptOnEnter; // when entering this scene, execute script from here
  140. WORD wScriptOnTeleport; // when teleporting out of this scene, execute script from here
  141. WORD wEventObjectIndex; // event objects in this scene begins from number wEventObjectIndex + 1
  142. } SCENE, *LPSCENE;
  143. // object including system strings, players, items, magics, enemies and poison scripts.
  144. // system strings and players
  145. typedef struct tagOBJECT_PLAYER
  146. {
  147. WORD wReserved[2]; // always zero
  148. WORD wScriptOnFriendDeath; // when friends in party dies, execute script from here
  149. WORD wScriptOnDying; // when dying, execute script from here
  150. } OBJECT_PLAYER;
  151. typedef enum tagITEMFLAG
  152. {
  153. kItemFlagUsable = (1 << 0),
  154. kItemFlagEquipable = (1 << 1),
  155. kItemFlagThrowable = (1 << 2),
  156. kItemFlagConsuming = (1 << 3),
  157. kItemFlagApplyToAll = (1 << 4),
  158. kItemFlagSellable = (1 << 5),
  159. kItemFlagEquipableByPlayerRole_First = (1 << 6)
  160. } ITEMFLAG;
  161. // items
  162. typedef struct tagOBJECT_ITEM
  163. {
  164. WORD wBitmap; // bitmap number in BALL.MKF
  165. WORD wPrice; // price
  166. WORD wScriptOnUse; // script executed when using this item
  167. WORD wScriptOnEquip; // script executed when equipping this item
  168. WORD wScriptOnThrow; // script executed when throwing this item to enemy
  169. WORD wFlags; // flags
  170. } OBJECT_ITEM;
  171. typedef enum tagMAGICFLAG
  172. {
  173. kMagicFlagUsableOutsideBattle = (1 << 0),
  174. kMagicFlagUsableInBattle = (1 << 1),
  175. kMagicFlagUsableToEnemy = (1 << 3),
  176. kMagicFlagApplyToAll = (1 << 4),
  177. } MAGICFLAG;
  178. // magics
  179. typedef struct tagOBJECT_MAGIC
  180. {
  181. WORD wMagicNumber; // magic number, according to DATA.MKF #3
  182. WORD wReserved1; // always zero
  183. WORD wScriptOnSuccess; // when magic succeed, execute script from here
  184. WORD wScriptOnUse; // when use this magic, execute script from here
  185. WORD wReserved2; // always zero
  186. WORD wFlags; // flags
  187. } OBJECT_MAGIC;
  188. // enemies
  189. typedef struct tagOBJECT_ENEMY
  190. {
  191. WORD wEnemyID; // ID of the enemy, according to DATA.MKF #1.
  192. // Also indicates the bitmap number in ABC.MKF.
  193. WORD wResistanceToSorcery; // resistance to sorcery and poison (0 min, 10 max)
  194. WORD wScriptOnTurnStart; // script executed when turn starts
  195. WORD wScriptOnBattleEnd; // script executed when battle ends
  196. WORD wScriptOnReady; // script executed when the enemy is ready
  197. } OBJECT_ENEMY;
  198. // poisons (scripts executed in each round)
  199. typedef struct tagOBJECT_POISON
  200. {
  201. WORD wPoisonLevel; // level of the poison
  202. WORD wColor; // color of avatars
  203. WORD wPlayerScript; // script executed when player has this poison (per round)
  204. WORD wReserved; // always zero
  205. WORD wEnemyScript; // script executed when enemy has this poison (per round)
  206. } OBJECT_POISON;
  207. typedef union tagOBJECT
  208. {
  209. WORD rgwData[6];
  210. OBJECT_PLAYER player;
  211. OBJECT_ITEM item;
  212. OBJECT_MAGIC magic;
  213. OBJECT_ENEMY enemy;
  214. OBJECT_POISON poison;
  215. } OBJECT, *LPOBJECT;
  216. typedef struct tagSCRIPTENTRY
  217. {
  218. WORD wOperation; // operation code
  219. WORD rgwOperand[3]; // operands
  220. } SCRIPTENTRY, *LPSCRIPTENTRY;
  221. typedef struct tagINVENTORY
  222. {
  223. WORD wItem; // item object code
  224. USHORT nAmount; // amount of this item
  225. USHORT nAmountInUse; // in-use amount of this item
  226. } INVENTORY, *LPINVENTORY;
  227. typedef struct tagSTORE
  228. {
  229. WORD rgwItems[MAX_STORE_ITEM];
  230. } STORE, *LPSTORE;
  231. typedef struct tagENEMY
  232. {
  233. WORD wIdleFrames; // total number of frames when idle
  234. WORD wMagicFrames; // total number of frames when using magics
  235. WORD wAttackFrames; // total number of frames when doing normal attack
  236. WORD wIdleAnimSpeed; // speed of the animation when idle
  237. WORD wActWaitFrames; // FIXME: ???
  238. WORD wYPosOffset;
  239. WORD wAttackSound; // sound played when this enemy uses normal attack
  240. WORD wActionSound; // FIXME: ???
  241. WORD wMagicSound; // sound played when this enemy uses magic
  242. WORD wDeathSound; // sound played when this enemy dies
  243. WORD wCallSound; // sound played when entering the battle
  244. WORD wHealth; // total HP of the enemy
  245. WORD wExp; // How many EXPs we'll get for beating this enemy
  246. WORD wCash; // how many cashes we'll get for beating this enemy
  247. WORD wLevel; // this enemy's level
  248. WORD wMagic; // this enemy's magic number
  249. WORD wMagicRate; // chance for this enemy to use magic
  250. WORD wAttackEquivItem; // equivalence item of this enemy's normal attack
  251. WORD wAttackEquivItemRate;// chance for equivalence item
  252. WORD wStealItem; // which item we'll get when stealing from this enemy
  253. USHORT nStealItem; // total amount of the items which can be stolen
  254. WORD wAttackStrength; // normal attack strength
  255. WORD wMagicStrength; // magical attack strength
  256. WORD wDefense; // resistance to all kinds of attacking
  257. WORD wDexterity; // dexterity
  258. WORD wFleeRate; // chance for successful fleeing
  259. WORD wPoisonResistance; // resistance to poison
  260. WORD wElemResistance[NUM_MAGIC_ELEMENTAL]; // resistance to elemental magics
  261. WORD wPhysicalResistance; // resistance to physical attack
  262. WORD wDualMove; // whether this enemy can do dual move or not
  263. WORD wCollectValue; // value for collecting this enemy for items
  264. } ENEMY, *LPENEMY;
  265. typedef struct tagENEMYTEAM
  266. {
  267. WORD rgwEnemy[MAX_ENEMIES_IN_TEAM];
  268. } ENEMYTEAM, *LPENEMYTEAM;
  269. typedef WORD PLAYERS[MAX_PLAYER_ROLES];
  270. typedef struct tagPLAYERROLES
  271. {
  272. PLAYERS rgwAvatar; // avatar (shown in status view)
  273. PLAYERS rgwSpriteNumInBattle; // sprite displayed in battle (in F.MKF)
  274. PLAYERS rgwSpriteNum; // sprite displayed in normal scene (in MGO.MKF)
  275. PLAYERS rgwName; // name of player class (in WORD.DAT)
  276. PLAYERS rgwAttackAll; // whether player can attack everyone in a bulk or not
  277. PLAYERS rgwUnknown1; // FIXME: ???
  278. PLAYERS rgwLevel; // level
  279. PLAYERS rgwMaxHP; // maximum HP
  280. PLAYERS rgwMaxMP; // maximum MP
  281. PLAYERS rgwHP; // current HP
  282. PLAYERS rgwMP; // current MP
  283. WORD rgwEquipment[MAX_PLAYER_EQUIPMENTS][MAX_PLAYER_ROLES]; // equipments
  284. PLAYERS rgwAttackStrength; // normal attack strength
  285. PLAYERS rgwMagicStrength; // magical attack strength
  286. PLAYERS rgwDefense; // resistance to all kinds of attacking
  287. PLAYERS rgwDexterity; // dexterity
  288. PLAYERS rgwFleeRate; // chance of successful fleeing
  289. PLAYERS rgwPoisonResistance; // resistance to poison
  290. WORD rgwElementalResistance[NUM_MAGIC_ELEMENTAL][MAX_PLAYER_ROLES]; // resistance to elemental magics
  291. PLAYERS rgwUnknown2; // FIXME: ???
  292. PLAYERS rgwUnknown3; // FIXME: ???
  293. PLAYERS rgwUnknown4; // FIXME: ???
  294. PLAYERS rgwCoveredBy; // who will cover me when I am low of HP or not sane
  295. WORD rgwMagic[MAX_PLAYER_MAGICS][MAX_PLAYER_ROLES]; // magics
  296. PLAYERS rgwWalkFrames; // walk frame (???)
  297. PLAYERS rgwCooperativeMagic; // cooperative magic
  298. PLAYERS rgwUnknown5; // FIXME: ???
  299. PLAYERS rgwUnknown6; // FIXME: ???
  300. PLAYERS rgwDeathSound; // sound played when player dies
  301. PLAYERS rgwAttackSound; // sound played when player attacks
  302. PLAYERS rgwWeaponSound; // weapon sound (???)
  303. PLAYERS rgwCriticalSound; // sound played when player make critical hits
  304. PLAYERS rgwMagicSound; // sound played when player is casting a magic
  305. PLAYERS rgwCoverSound; // sound played when player cover others
  306. PLAYERS rgwDyingSound; // sound played when player is dying
  307. } PLAYERROLES, *LPPLAYERROLES;
  308. typedef enum tagMAGIC_TYPE
  309. {
  310. kMagicTypeNormal = 0,
  311. kMagicTypeAttackAll = 1, // draw the effect on each of the enemies
  312. kMagicTypeAttackWhole = 2, // draw the effect on the whole enemy team
  313. kMagicTypeAttackField = 3, // draw the effect on the battle field
  314. kMagicTypeApplyToPlayer = 4, // the magic is used on one player
  315. kMagicTypeApplyToParty = 5, // the magic is used on the whole party
  316. kMagicTypeTrance = 8, // trance the player
  317. kMagicTypeSummon = 9, // summon
  318. } MAGIC_TYPE;
  319. typedef struct tagMAGIC
  320. {
  321. WORD wEffect; // effect sprite
  322. WORD wType; // type of this magic
  323. WORD wXOffset;
  324. WORD wYOffset;
  325. WORD wSummonEffect; // summon effect sprite (in F.MKF)
  326. WORD wSpeed; // speed of the effect
  327. WORD wKeepEffect; // FIXME: ???
  328. WORD wSoundDelay; // delay of the SFX
  329. WORD wEffectTimes; // total times of effect
  330. WORD wShake; // shake screen
  331. WORD wWave; // wave screen
  332. WORD wUnknown; // FIXME: ???
  333. WORD wCostMP; // MP cost
  334. WORD wBaseDamage; // base damage
  335. WORD wElemental; // elemental (0 = No Elemental, last = poison)
  336. WORD wSound; // sound played when using this magic
  337. } MAGIC, *LPMAGIC;
  338. typedef struct tagBATTLEFIELD
  339. {
  340. WORD wScreenWave; // level of screen waving
  341. SHORT rgsMagicEffect[NUM_MAGIC_ELEMENTAL]; // effect of attributed magics
  342. } BATTLEFIELD, *LPBATTLEFIELD;
  343. // magics learned when level up
  344. typedef struct tagLEVELUPMAGIC
  345. {
  346. WORD wLevel; // level reached
  347. WORD wMagic; // magic learned
  348. } LEVELUPMAGIC, *LPLEVELUPMAGIC;
  349. typedef struct tagLEVELUPMAGIC_ALL
  350. {
  351. LEVELUPMAGIC m[MAX_PLAYABLE_PLAYER_ROLES];
  352. } LEVELUPMAGIC_ALL, *LPLEVELUPMAGIC_ALL;
  353. typedef struct tagENEMYPOS
  354. {
  355. struct {
  356. WORD x;
  357. WORD y;
  358. } pos[MAX_ENEMIES_IN_TEAM][MAX_ENEMIES_IN_TEAM];
  359. } ENEMYPOS, *LPENEMYPOS;
  360. // Exp. points needed for the next level
  361. typedef WORD LEVELUPEXP, *LPLEVELUPEXP;
  362. // game data which is available in data files.
  363. typedef struct tagGAMEDATA
  364. {
  365. LPEVENTOBJECT lprgEventObject;
  366. int nEventObject;
  367. SCENE rgScene[MAX_SCENES];
  368. OBJECT rgObject[MAX_OBJECTS];
  369. LPSCRIPTENTRY lprgScriptEntry;
  370. int nScriptEntry;
  371. LPSTORE lprgStore;
  372. int nStore;
  373. LPENEMY lprgEnemy;
  374. int nEnemy;
  375. LPENEMYTEAM lprgEnemyTeam;
  376. int nEnemyTeam;
  377. PLAYERROLES PlayerRoles;
  378. LPMAGIC lprgMagic;
  379. int nMagic;
  380. LPBATTLEFIELD lprgBattleField;
  381. int nBattleField;
  382. LPLEVELUPMAGIC_ALL lprgLevelUpMagic;
  383. int nLevelUpMagic;
  384. ENEMYPOS EnemyPos;
  385. LEVELUPEXP rgLevelUpExp[MAX_LEVELS + 1];
  386. WORD rgwBattleEffectIndex[10][2];
  387. } GAMEDATA, *LPGAMEDATA;
  388. typedef struct tagFILES
  389. {
  390. FILE *fpFBP; // battlefield background images
  391. FILE *fpMGO; // sprites in scenes
  392. FILE *fpBALL; // item bitmaps
  393. FILE *fpDATA; // misc data
  394. FILE *fpF; // player sprites during battle
  395. FILE *fpFIRE; // fire effect sprites
  396. FILE *fpRGM; // character face bitmaps
  397. FILE *fpSSS; // script data
  398. } FILES, *LPFILES;
  399. // player party
  400. typedef struct tagPARTY
  401. {
  402. WORD wPlayerRole; // player role
  403. SHORT x, y; // position
  404. WORD wFrame; // current frame number
  405. WORD wImageOffset; // FIXME: ???
  406. } PARTY, *LPPARTY;
  407. // player trail, used for other party members to follow the main party member
  408. typedef struct tagTRAIL
  409. {
  410. WORD x, y; // position
  411. WORD wDirection; // direction
  412. } TRAIL, *LPTRAIL;
  413. typedef struct tagEXPERIENCE
  414. {
  415. WORD wExp; // current experience points
  416. WORD wReserved;
  417. WORD wLevel; // current level
  418. WORD wCount;
  419. } EXPERIENCE, *LPEXPERIENCE;
  420. typedef struct tagALLEXPERIENCE
  421. {
  422. EXPERIENCE rgPrimaryExp[MAX_PLAYER_ROLES];
  423. EXPERIENCE rgHealthExp[MAX_PLAYER_ROLES];
  424. EXPERIENCE rgMagicExp[MAX_PLAYER_ROLES];
  425. EXPERIENCE rgAttackExp[MAX_PLAYER_ROLES];
  426. EXPERIENCE rgMagicPowerExp[MAX_PLAYER_ROLES];
  427. EXPERIENCE rgDefenseExp[MAX_PLAYER_ROLES];
  428. EXPERIENCE rgDexterityExp[MAX_PLAYER_ROLES];
  429. EXPERIENCE rgFleeExp[MAX_PLAYER_ROLES];
  430. } ALLEXPERIENCE, *LPALLEXPERIENCE;
  431. typedef struct tagPOISONSTATUS
  432. {
  433. WORD wPoisonID; // kind of the poison
  434. WORD wPoisonScript; // script entry
  435. } POISONSTATUS, *LPPOISONSTATUS;
  436. typedef struct tagGLOBALVARS
  437. {
  438. FILES f;
  439. GAMEDATA g;
  440. BYTE bCurrentSaveSlot; // current save slot (1-5)
  441. int iCurMainMenuItem; // current main menu item number
  442. int iCurSystemMenuItem; // current system menu item number
  443. int iCurInvMenuItem; // current inventory menu item number
  444. int iCurPlayingRNG; // current playing RNG animation
  445. BOOL fGameStart; // TRUE if the has just started
  446. BOOL fEnteringScene; // TRUE if entering a new scene
  447. BOOL fNeedToFadeIn; // TRUE if need to fade in when drawing scene
  448. BOOL fInBattle; // TRUE if in battle
  449. BOOL fAutoBattle; // TRUE if auto-battle
  450. #ifndef PAL_CLASSIC
  451. BYTE bBattleSpeed; // Battle Speed (1 = Fastest, 5 = Slowest)
  452. #endif
  453. WORD wLastUnequippedItem; // last unequipped item
  454. PLAYERROLES rgEquipmentEffect[MAX_PLAYER_EQUIPMENTS + 1]; // equipment effects
  455. WORD rgPlayerStatus[MAX_PLAYER_ROLES][kStatusAll]; // player status
  456. PAL_POS viewport; // viewport coordination
  457. PAL_POS partyoffset;
  458. WORD wLayer;
  459. WORD wMaxPartyMemberIndex;// max index of members in party (0 to MAX_PLAYERS_IN_PARTY - 1)
  460. PARTY rgParty[MAX_PLAYABLE_PLAYER_ROLES]; // player party
  461. TRAIL rgTrail[MAX_PLAYABLE_PLAYER_ROLES]; // player trail
  462. WORD wPartyDirection; // direction of the party
  463. WORD wNumScene; // current scene number
  464. WORD wNumPalette; // current palette number
  465. BOOL fNightPalette; // TRUE if use the darker night palette
  466. WORD wNumMusic; // current music number
  467. WORD wNumBattleMusic; // current music number in battle
  468. WORD wNumBattleField; // current battle field number
  469. WORD wCollectValue; // value of "collected" items
  470. WORD wScreenWave; // level of screen waving
  471. SHORT sWaveProgression;
  472. WORD wChaseRange;
  473. WORD wChasespeedChangeCycles;
  474. USHORT nFollower;
  475. DWORD dwCash; // amount of cash
  476. ALLEXPERIENCE Exp; // experience status
  477. POISONSTATUS rgPoisonStatus[MAX_POISONS][MAX_PLAYABLE_PLAYER_ROLES]; // poison status
  478. INVENTORY rgInventory[MAX_INVENTORY]; // inventory status
  479. LPOBJECTDESC lpObjectDesc;
  480. DWORD dwFrameNum;
  481. } GLOBALVARS, *LPGLOBALVARS;
  482. typedef struct tagSAVEDGAME
  483. {
  484. WORD wSavedTimes; // saved times
  485. WORD wViewportX, wViewportY; // viewport location
  486. WORD nPartyMember; // number of members in party
  487. WORD wNumScene; // scene number
  488. WORD wPaletteOffset;
  489. WORD wPartyDirection; // party direction
  490. WORD wNumMusic; // music number
  491. WORD wNumBattleMusic; // battle music number
  492. WORD wNumBattleField; // battle field number
  493. WORD wScreenWave; // level of screen waving
  494. WORD wBattleSpeed; // battle speed
  495. WORD wCollectValue; // value of "collected" items
  496. WORD wLayer;
  497. WORD wChaseRange;
  498. WORD wChasespeedChangeCycles;
  499. WORD nFollower;
  500. WORD rgwReserved2[3]; // unused
  501. DWORD dwCash; // amount of cash
  502. PARTY rgParty[MAX_PLAYABLE_PLAYER_ROLES]; // player party
  503. TRAIL rgTrail[MAX_PLAYABLE_PLAYER_ROLES]; // player trail
  504. ALLEXPERIENCE Exp; // experience data
  505. PLAYERROLES PlayerRoles;
  506. POISONSTATUS rgPoisonStatus[MAX_POISONS][MAX_PLAYABLE_PLAYER_ROLES]; // poison status
  507. INVENTORY rgInventory[MAX_INVENTORY]; // inventory status
  508. SCENE rgScene[MAX_SCENES];
  509. OBJECT rgObject[MAX_OBJECTS];
  510. EVENTOBJECT rgEventObject[MAX_EVENT_OBJECTS];
  511. } SAVEDGAME, *LPSAVEDGAME;
  512. extern LPGLOBALVARS gpGlobals;
  513. INT
  514. PAL_InitGlobals(
  515. VOID
  516. );
  517. VOID
  518. PAL_FreeGlobals(
  519. VOID
  520. );
  521. VOID
  522. PAL_SaveGame(
  523. LPCSTR szFileName,
  524. WORD wSavedTimes
  525. );
  526. VOID
  527. PAL_InitGameData(
  528. INT iSaveSlot
  529. );
  530. BOOL
  531. PAL_AddItemToInventory(
  532. WORD wObjectID,
  533. INT iNum
  534. );
  535. BOOL
  536. PAL_IncreaseHPMP(
  537. WORD wPlayerRole,
  538. SHORT sHP,
  539. SHORT sMP
  540. );
  541. INT
  542. PAL_GetItemAmount(
  543. WORD wItem
  544. );
  545. VOID
  546. PAL_UpdateEquipments(
  547. VOID
  548. );
  549. VOID
  550. PAL_CompressInventory(
  551. VOID
  552. );
  553. VOID
  554. PAL_RemoveEquipmentEffect(
  555. WORD wPlayerRole,
  556. WORD wEquipPart
  557. );
  558. VOID
  559. PAL_AddPoisonForPlayer(
  560. WORD wPlayerRole,
  561. WORD wPoisonID
  562. );
  563. VOID
  564. PAL_CurePoisonByKind(
  565. WORD wPlayerRole,
  566. WORD wPoisonID
  567. );
  568. VOID
  569. PAL_CurePoisonByLevel(
  570. WORD wPlayerRole,
  571. WORD wMaxLevel
  572. );
  573. BOOL
  574. PAL_IsPlayerPoisonedByLevel(
  575. WORD wPlayerRole,
  576. WORD wMinLevel
  577. );
  578. BOOL
  579. PAL_IsPlayerPoisonedByKind(
  580. WORD wPlayerRole,
  581. WORD wPoisonID
  582. );
  583. WORD
  584. PAL_GetPlayerAttackStrength(
  585. WORD wPlayerRole
  586. );
  587. WORD
  588. PAL_GetPlayerMagicStrength(
  589. WORD wPlayerRole
  590. );
  591. WORD
  592. PAL_GetPlayerDefense(
  593. WORD wPlayerRole
  594. );
  595. WORD
  596. PAL_GetPlayerDexterity(
  597. WORD wPlayerRole
  598. );
  599. WORD
  600. PAL_GetPlayerFleeRate(
  601. WORD wPlayerRole
  602. );
  603. WORD
  604. PAL_GetPlayerPoisonResistance(
  605. WORD wPlayerRole
  606. );
  607. WORD
  608. PAL_GetPlayerElementalResistance(
  609. WORD wPlayerRole,
  610. INT iAttrib
  611. );
  612. WORD
  613. PAL_GetPlayerBattleSprite(
  614. WORD wPlayerRole
  615. );
  616. WORD
  617. PAL_GetPlayerCooperativeMagic(
  618. WORD wPlayerRole
  619. );
  620. BOOL
  621. PAL_PlayerCanAttackAll(
  622. WORD wPlayerRole
  623. );
  624. BOOL
  625. PAL_AddMagic(
  626. WORD wPlayerRole,
  627. WORD wMagic
  628. );
  629. VOID
  630. PAL_RemoveMagic(
  631. WORD wPlayerRole,
  632. WORD wMagic
  633. );
  634. VOID
  635. PAL_SetPlayerStatus(
  636. WORD wPlayerRole,
  637. WORD wStatusID,
  638. WORD wNumRound
  639. );
  640. VOID
  641. PAL_RemovePlayerStatus(
  642. WORD wPlayerRole,
  643. WORD wStatusID
  644. );
  645. VOID
  646. PAL_ClearAllPlayerStatus(
  647. VOID
  648. );
  649. VOID
  650. PAL_PlayerLevelUp(
  651. WORD wPlayerRole,
  652. WORD wNumLevel
  653. );
  654. #ifdef __cplusplus
  655. }
  656. #endif
  657. #endif