global.h 26 KB

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