global.h 26 KB

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