finished adding content from CLIVAN; not tested yet
[k8-i-v-a-n.git] / src / game / game.h
blob12bd7c7b6fc32f0ebcfd90c0d54a5e7f8f481683
1 /*
3 * Iter Vehemens ad Necem (IVAN)
4 * Copyright (C) Timo Kiviluoto
5 * Released under the GNU General
6 * Public License
8 * See LICENSING which should be included
9 * along with this file for more details
13 #ifndef __GAME_H__
14 #define __GAME_H__
16 #include <ctime>
17 #include <map>
18 #include <stack>
19 #include <vector>
21 #include "femath.h"
22 #include "festring.h"
23 #include "ivandef.h"
26 #ifndef LIGHT_BORDER
27 # define LIGHT_BORDER 80
28 #endif
30 #define PLAYER game::GetPlayer()
33 class area;
34 class level;
35 class dungeon;
36 class felist;
37 class team;
38 class character;
39 class gamescript;
40 class item;
41 class outputfile;
42 class inputfile;
43 class worldmap;
44 class god;
45 class square;
46 class wsquare;
47 class lsquare;
48 class bitmap;
49 class festring;
50 class rain;
51 class liquid;
52 class entity;
53 class olterrain;
54 struct explosion;
56 typedef std::map<festring, sLong> valuemap;
57 typedef truth (*stringkeyhandler)(int, festring&);
58 typedef v2 (*positionkeyhandler)(v2, int);
59 typedef void (*positionhandler)(v2);
60 typedef void (*bitmapeditor)(bitmap*, truth);
63 struct homedata {
64 v2 Pos;
65 int Dungeon;
66 int Level;
67 int Room;
70 outputfile& operator<<(outputfile&, const homedata*);
71 inputfile& operator>>(inputfile&, homedata*&);
74 struct configid {
75 configid () {}
76 configid (int Type, int Config) : Type(Type), Config(Config) {}
77 bool operator < (const configid& CI) const { return memcmp(this, &CI, sizeof(configid)) < 0; }
79 int Type NO_ALIGNMENT;
80 int Config NO_ALIGNMENT;
83 outputfile& operator<<(outputfile&, const configid&);
84 inputfile& operator>>(inputfile&, configid&);
87 struct dangerid {
88 dangerid () : NakedDanger(0), EquippedDanger(0) {}
89 dangerid (double NakedDanger, double EquippedDanger) : NakedDanger(NakedDanger), EquippedDanger(EquippedDanger) {}
90 double NakedDanger;
91 double EquippedDanger;
94 outputfile& operator<<(outputfile&, const dangerid&);
95 inputfile& operator>>(inputfile&, dangerid&);
98 struct ivantime {
99 int Day;
100 int Hour;
101 int Min;
105 struct massacreid {
106 massacreid () {}
107 massacreid (int Type, int Config, cfestring &Name) : Type(Type), Config(Config), Name(Name) { }
108 bool operator < (const massacreid &) const;
110 int Type;
111 int Config;
112 festring Name;
115 inline bool massacreid::operator<(const massacreid& MI) const
117 if(Type != MI.Type)
118 return Type < MI.Type;
120 if(Config != MI.Config)
121 return Config < MI.Config;
123 return Name < MI.Name;
126 outputfile& operator<<(outputfile&, const massacreid&);
127 inputfile& operator>>(inputfile&, massacreid&);
130 struct killreason {
131 killreason () {}
132 killreason (cfestring &String, int Amount) : String(String), Amount(Amount) {}
134 festring String;
135 int Amount;
138 outputfile& operator<<(outputfile&, const killreason&);
139 inputfile& operator>>(inputfile&, killreason&);
142 struct killdata {
143 killdata (int Amount=0, double DangerSum=0) : Amount(Amount), DangerSum(DangerSum) {}
145 int Amount;
146 double DangerSum;
147 std::vector<killreason> Reason;
150 outputfile& operator<<(outputfile&, const killdata&);
151 inputfile& operator>>(inputfile&, killdata&);
154 typedef std::map<configid, dangerid> dangermap;
155 typedef std::map<feuLong, character*> characteridmap;
156 typedef std::map<feuLong, item*> itemidmap;
157 typedef std::map<feuLong, entity*> trapidmap;
158 typedef std::map<massacreid, killdata> massacremap;
159 typedef std::map<feuLong, feuLong> boneidmap;
160 typedef std::vector<item*> itemvector;
161 typedef std::vector<itemvector> itemvectorvector;
162 typedef std::vector<character*> charactervector;
165 class quitrequest {};
166 class areachangerequest {};
169 enum ArgTypes {
170 FARG_UNDEFINED,
171 FARG_STRING,
172 FARG_NUMBER
175 struct FuncArg {
176 FuncArg () : type(FARG_UNDEFINED), sval(""), ival(0) {}
177 FuncArg (cfestring &aVal) : type(FARG_STRING), sval(aVal), ival(0) {}
178 FuncArg (sLong aVal) : type(FARG_NUMBER), sval(""), ival(aVal) {}
180 ArgTypes type;
181 festring sval;
182 sLong ival;
186 class game {
187 public:
188 static truth Init(cfestring& = CONST_S(""));
189 static void DeInit();
190 static void Run();
191 static int GetMoveCommandKey(int);
192 static cv2 GetMoveVector(int I) { return MoveVector[I]; }
193 static cv2 GetRelativeMoveVector(int I) { return RelativeMoveVector[I]; }
194 static cv2 GetBasicMoveVector(int I) { return BasicMoveVector[I]; }
195 static cv2 GetLargeMoveVector(int I) { return LargeMoveVector[I]; }
196 static area* GetCurrentArea() { return CurrentArea; }
197 static level* GetCurrentLevel() { return CurrentLevel; }
198 static uChar*** GetLuxTable() { return LuxTable; }
199 static character* GetPlayer() { return Player; }
200 static void SetPlayer(character*);
201 static v2 GetCamera() { return Camera; }
202 static void UpdateCameraX();
203 static void UpdateCameraY();
204 static truth IsLoading() { return Loading; }
205 static void SetIsLoading(truth What) { Loading = What; }
206 static truth ForceJumpToPlayerBe() { return JumpToPlayerBe; }
207 static void SetForceJumpToPlayerBe(truth What) { JumpToPlayerBe = What; }
208 static level* GetLevel(int);
209 static void InitLuxTable();
210 static void DeInitLuxTable();
211 static cchar* Insult();
212 static truth TruthQuestion(cfestring&, int = 0, int = 0);
213 static void DrawEverything();
214 static truth Save(cfestring& = SaveName(""));
215 static int Load(cfestring& = SaveName(""));
216 static truth IsRunning() { return Running; }
217 static void SetIsRunning(truth What) { Running = What; }
218 static void UpdateCameraX(int);
219 static void UpdateCameraY(int);
220 static int GetCurrentLevelIndex() { return CurrentLevelIndex; }
221 static int GetMoveCommandKeyBetweenPoints(v2, v2);
222 static void DrawEverythingNoBlit(truth = false);
223 static god* GetGod(int I) { return God[I]; }
224 static cchar* GetAlignment(int I) { return Alignment[I]; }
225 static void ApplyDivineTick();
226 static void ApplyDivineAlignmentBonuses(god*, int, truth);
227 static v2 GetDirectionVectorForKey(int);
228 static festring SaveName(cfestring& = CONST_S(""));
229 static void ShowLevelMessage();
230 static double GetMinDifficulty();
231 static void TriggerQuestForGoldenEagleShirt();
232 static void CalculateGodNumber();
233 static void IncreaseTick() { ++Tick; }
234 static feuLong GetTick() { return Tick; }
235 static festring GetAutoSaveFileName() { return AutoSaveFileName; }
236 static int DirectionQuestion(cfestring&, truth = true, truth = false);
237 static void RemoveSaves(truth = true);
238 static truth IsInWilderness() { return InWilderness; }
239 static void SetIsInWilderness(truth What) { InWilderness = What; }
240 static worldmap* GetWorldMap() { return WorldMap; }
241 static void SetAreaInLoad(area* What) { AreaInLoad = What; }
242 static void SetSquareInLoad(square* What) { SquareInLoad = What; }
243 static area* GetAreaInLoad() { return AreaInLoad; }
244 static square* GetSquareInLoad() { return SquareInLoad; }
245 static int GetLevels();
246 static dungeon* GetCurrentDungeon() { return Dungeon[CurrentDungeonIndex]; }
247 static dungeon* GetDungeon(int I) { return Dungeon[I]; }
248 static int GetCurrentDungeonIndex() { return CurrentDungeonIndex; }
249 static void InitDungeons();
250 static truth OnScreen(v2);
251 static void DoEvilDeed(int);
252 static void SaveWorldMap(cfestring& = SaveName(""), truth = true);
253 static worldmap* LoadWorldMap(cfestring& = SaveName(""));
254 static void UpdateCamera();
255 static feuLong CreateNewCharacterID(character*);
256 static feuLong CreateNewItemID(item*);
257 static feuLong CreateNewTrapID(entity*);
258 static team* GetTeam(int I) { return Team[I]; }
259 static int GetTeams() { return Teams; }
260 static void Hostility(team*, team*);
261 static void CreateTeams();
262 static festring StringQuestion(cfestring&, col16, festring::sizetype, festring::sizetype, truth, stringkeyhandler = 0);
263 static sLong NumberQuestion(cfestring&, int, truth = false);
264 static feuLong IncreaseLOSTick();
265 static feuLong GetLOSTick() { return LOSTick; }
266 static void SendLOSUpdateRequest() { LOSUpdateRequested = true; }
267 static void RemoveLOSUpdateRequest() { LOSUpdateRequested = false; }
268 static character* GetPetrus() { return Petrus; }
269 static void SetPetrus(character* What) { Petrus = What; }
270 static truth HandleQuitMessage();
271 static int GetDirectionForVector(v2);
272 static cchar* GetVerbalPlayerAlignment();
273 static void CreateGods();
274 static int GetScreenXSize() { return 42; }
275 static int GetScreenYSize() { return 26; }
276 static v2 CalculateScreenCoordinates(v2);
277 static void BusyAnimation();
278 static void BusyAnimation(bitmap*, truth);
279 static v2 PositionQuestion(cfestring&, v2, positionhandler = 0, positionkeyhandler = 0, truth = true);
280 static void LookHandler(v2);
281 static int AskForKeyPress(cfestring&);
282 static void AskForEscPress(cfestring &Topic);
283 static truth AnimationController();
284 static gamescript* GetGameScript() { return GameScript; }
285 static void InitScript();
286 static valuemap& GetGlobalValueMap() { return GlobalValueMap; }
287 static void InitGlobalValueMap();
288 static void LoadGlobalValueMap (inputfile &SaveFile);
289 static void TextScreen(cfestring&, v2 = ZERO_V2, col16 = 0xFFFF, truth = true, truth = true, bitmapeditor = 0);
290 static void SetCursorPos(v2 What) { CursorPos = What; }
291 static truth DoZoom() { return Zoom; }
292 static void SetDoZoom(truth What) { Zoom = What; }
293 static int KeyQuestion(cfestring&, int, int, ...);
294 static v2 LookKeyHandler(v2, int);
295 static v2 NameKeyHandler(v2, int);
296 static void End(festring, truth = true, truth = true);
297 static int CalculateRoughDirection(v2);
298 static sLong ScrollBarQuestion(cfestring&, sLong, sLong, sLong, sLong, sLong, col16, col16, col16, void (*)(sLong) = 0);
299 static truth IsGenerating() { return Generating; }
300 static void SetIsGenerating(truth What) { Generating = What; }
301 static void CalculateNextDanger();
302 static int Menu(bitmap*, v2, cfestring&, cfestring&, col16, cfestring& = "", cfestring& = "");
303 static void InitDangerMap();
304 static const dangermap& GetDangerMap();
305 static truth TryTravel(int, int, int, truth = false, truth = true);
306 static truth LeaveArea(charactervector&, truth, truth);
307 static void EnterArea(charactervector&, int, int);
308 static int CompareLights(col24, col24);
309 static int CompareLightToInt(col24, col24);
310 static void CombineLights(col24&, col24);
311 static col24 CombineConstLights(col24, col24);
312 static truth IsDark(col24);
313 static void SetStandardListAttributes(felist&);
314 static double GetAveragePlayerArmStrengthExperience() { return AveragePlayerArmStrengthExperience; }
315 static double GetAveragePlayerLegStrengthExperience() { return AveragePlayerLegStrengthExperience; }
316 static double GetAveragePlayerDexterityExperience() { return AveragePlayerDexterityExperience; }
317 static double GetAveragePlayerAgilityExperience() { return AveragePlayerAgilityExperience; }
318 static void InitPlayerAttributeAverage();
319 static void UpdatePlayerAttributeAverage();
320 static void CallForAttention(v2, int);
321 static character* SearchCharacter(feuLong);
322 static item* SearchItem(feuLong);
323 static entity* SearchTrap(feuLong);
324 static void AddCharacterID(character*, feuLong);
325 static void RemoveCharacterID(feuLong);
326 static void AddItemID(item*, feuLong);
327 static void RemoveItemID(feuLong);
328 static void UpdateItemID(item*, feuLong);
329 static void AddTrapID(entity*, feuLong);
330 static void RemoveTrapID(feuLong);
331 static void UpdateTrapID(entity*, feuLong);
332 static int GetStoryState() { return StoryState; }
333 static void SetStoryState(int What) { StoryState = What; }
334 static int GetMondedrPass () { return MondedrPass; }
335 static void SetMondedrPass (int What) { MondedrPass = What; }
336 static int GetRingOfThieves () { return RingOfThieves; }
337 static void SetRingOfThieves (int What) { RingOfThieves = What; }
338 static int GetMasamune () { return Masamune; }
339 static void SetMasamune (int What) { Masamune = What; }
340 static int GetMuramasa () { return Muramasa; }
341 static void SetMuramasa (int What) { Muramasa = What; }
342 static int GetLoricatusHammer () { return LoricatusHammer; }
343 static void SetLoricatusHammer (int What) { LoricatusHammer = What; }
344 static int GetLiberator () { return Liberator; }
345 static void SetLiberator (int What) { Liberator = What; }
346 static int GetOmmelBloodMission() { return OmmelBloodMission; }
347 static void SetOmmelBloodMission(int What) { OmmelBloodMission = What; }
348 static int GetRegiiTalkState() { return RegiiTalkState; }
349 static void SetRegiiTalkState(int What) { RegiiTalkState = What; }
350 static void SetIsInGetCommand(truth What) { InGetCommand = What; }
351 static truth IsInGetCommand() { return InGetCommand; }
352 static festring GetHomeDir();
353 static festring GetSaveDir();
354 static festring GetGameDir();
355 static festring GetBoneDir();
356 static truth PlayerWasHurtByExplosion() { return PlayerHurtByExplosion; }
357 static void SetPlayerWasHurtByExplosion(truth What) { PlayerHurtByExplosion = What; }
358 static void SetCurrentArea(area* What) { CurrentArea = What; }
359 static void SetCurrentLevel(level* What) { CurrentLevel = What; }
360 static void SetCurrentWSquareMap(wsquare*** What) { CurrentWSquareMap = What; }
361 static void SetCurrentLSquareMap(lsquare*** What) { CurrentLSquareMap = What; }
362 static festring& GetDefaultPolymorphTo() { return DefaultPolymorphTo; }
363 static festring& GetDefaultSummonMonster() { return DefaultSummonMonster; }
364 static festring& GetDefaultChangeMaterial() { return DefaultChangeMaterial; }
365 static festring& GetDefaultDetectMaterial() { return DefaultDetectMaterial; }
366 static void SignalDeath(ccharacter*, ccharacter*, festring);
367 static void DisplayMassacreLists();
368 static void DisplayMassacreList(const massacremap&, cchar*, sLong);
369 static truth MassacreListsEmpty();
370 #ifdef WIZARD
371 static void ActivateWizardMode() { WizardMode = true; }
372 static void DeactivateWizardMode() { WizardMode = false; }
373 static truth WizardModeIsActive() { return WizardMode; }
374 static void SeeWholeMap();
375 static int GetSeeWholeMapCheatMode() { return SeeWholeMapCheatMode; }
376 static truth GoThroughWallsCheatIsActive() { return GoThroughWallsCheat; }
377 static void GoThroughWalls() { GoThroughWallsCheat = !GoThroughWallsCheat; }
378 #else
379 static truth WizardModeIsActive() { return false; }
380 static int GetSeeWholeMapCheatMode() { return 0; }
381 static truth GoThroughWallsCheatIsActive() { return false; }
382 #endif
383 static truth WizardModeIsReallyActive() { return WizardMode; }
384 static void CreateBone();
385 static int GetQuestMonstersFound() { return QuestMonstersFound; }
386 static void SignalQuestMonsterFound() { ++QuestMonstersFound; }
387 static void SetQuestMonstersFound(int What) { QuestMonstersFound = What; }
388 static truth PrepareRandomBone(int);
389 static boneidmap& GetBoneItemIDMap() { return BoneItemIDMap; }
390 static boneidmap& GetBoneCharacterIDMap() { return BoneCharacterIDMap; }
391 static double CalculateAverageDanger(const charactervector&, character*);
392 static double CalculateAverageDangerOfAllNormalEnemies();
393 static character* CreateGhost();
394 static truth TooGreatDangerFound() { return TooGreatDangerFoundTruth; }
395 static void SetTooGreatDangerFound(truth What) { TooGreatDangerFoundTruth = What; }
396 static void CreateBusyAnimationCache();
397 static sLong GetScore();
398 static truth TweraifIsFree();
399 static truth IsXMas();
400 static int AddToItemDrawVector(const itemvector&);
401 static void ClearItemDrawVector();
402 static void ItemEntryDrawer(bitmap*, v2, uInt);
403 static int AddToCharacterDrawVector(character*);
404 static void ClearCharacterDrawVector();
405 static void CharacterEntryDrawer(bitmap*, v2, uInt);
406 static void GodEntryDrawer(bitmap*, v2, uInt);
407 static itemvectorvector& GetItemDrawVector() { return ItemDrawVector; }
408 static charactervector& GetCharacterDrawVector() { return CharacterDrawVector; }
409 static truth IsSumoWrestling() { return SumoWrestling; }
410 static void SetIsSumoWrestling(truth What) { SumoWrestling = What; }
411 static truth AllowHostilities() { return !SumoWrestling; }
412 static truth AllBodyPartsVanish() { return SumoWrestling; }
413 static truth TryToEnterSumoArena();
414 static truth TryToExitSumoArena();
415 static truth EndSumoWrestling(int);
416 static character* GetSumo();
417 static cfestring& GetPlayerName() { return PlayerName; }
418 static rain* ConstructGlobalRain();
419 static void SetGlobalRainLiquid(liquid* What) { GlobalRainLiquid = What; }
420 static void SetGlobalRainSpeed(v2 What) { GlobalRainSpeed = What; }
421 static truth PlayerIsSumoChampion() { return PlayerSumoChampion; }
422 static truth PlayerIsSolicitusChampion() { return PlayerSolicitusChampion; }
423 static void MakePlayerSolicitusChampion() { PlayerSolicitusChampion = true; }
424 static v2 GetSunLightDirectionVector();
425 static int CalculateMinimumEmitationRadius(col24);
426 static feuLong IncreaseSquarePartEmitationTicks();
427 static cint GetLargeMoveDirection(int I) { return LargeMoveDirection[I]; }
428 static bool Wish(character*, cchar*, cchar*, bool canAbort=false);
429 static festring DefaultQuestion(festring, festring&, stringkeyhandler = 0);
430 static void GetTime(ivantime&);
431 static sLong GetTurn() { return Turn; }
432 static void IncreaseTurn() { ++Turn; }
433 static int GetTotalMinutes() { return Tick * 60 / 2000; }
434 static truth PolymorphControlKeyHandler(int, festring&);
435 static feuLong* GetEquipmentMemory() { return EquipmentMemory; }
436 static truth PlayerIsRunning();
437 static void SetPlayerIsRunning(truth What) { PlayerRunning = What; }
438 static truth FillPetVector(cchar*);
439 static truth CommandQuestion();
440 static void NameQuestion();
441 static v2 CommandKeyHandler(v2, int);
442 static void CommandScreen(cfestring&, feuLong, feuLong, feuLong&, feuLong&);
443 static truth CommandAll();
444 static double GetDangerFound() { return DangerFound; }
445 static void SetDangerFound(double What) { DangerFound = What; }
446 static col16 GetAttributeColor(int);
447 static void UpdateAttributeMemory();
448 static void InitAttributeMemory();
449 static void TeleportHandler(v2);
450 static void PetHandler(v2);
451 static truth SelectPet(int);
452 static double GetGameSituationDanger();
453 static olterrain* GetMonsterPortal() { return MonsterPortal; }
454 static void SetMonsterPortal(olterrain* What) { MonsterPortal = What; }
455 static truth GetCausePanicFlag() { return CausePanicFlag; }
456 static void SetCausePanicFlag(truth What) { CausePanicFlag = What; }
457 static sLong GetTimeSpent();
458 static void AddSpecialCursor(v2, int);
459 static void RemoveSpecialCursors();
460 static void LearnAbout(god*);
461 static truth PlayerKnowsAllGods();
462 static void AdjustRelationsToAllGods(int);
463 static void SetRelationsToAllGods(int);
464 static void ShowDeathSmiley(bitmap*, truth);
465 static void SetEnterImage(cbitmap* What) { EnterImage = What; }
466 static void SetEnterTextDisplacement (v2 What) { EnterTextDisplacement = What; }
468 static int ListSelector (int defsel, cfestring &title, ...); // defsel<0: first
469 static int ListSelectorArray (int defsel, cfestring &title, const char *items[]); // defsel<0: first
471 static char GetAbnormalMoveKey (int idx);
472 static void SetAbnormalMoveKey (int idx, char ch);
474 static truth CheckDropLeftover (item *i);
476 static void ClearEventData ();
477 // return 'true' if event is 'eaten'
478 static truth RunOnEvent (cfestring &ename);
479 static truth RunOnCharEvent (character *who, cfestring &ename);
480 static truth RunOnItemEvent (item *what, cfestring &ename);
482 static truth RunAllowScriptStr (cfestring &str);
484 static festring ldrGetVar (inputfile *fl, cfestring &name);
486 private:
487 static truth RunOnEventStr (cfestring &name, cfestring &str);
488 static truth GetWord (festring &w);
489 static void SkipBlock (truth brcEaten);
490 static void UpdateCameraCoordinate (int &, int, int, int);
491 static truth DoOnEvent (truth brcEaten, truth AllowScript=false);
492 static int ParseFuncArgs (cfestring &types, std::vector<FuncArg> &args, inputfile *fl=0, truth noterm=false);
494 private:
495 static cchar* const Alignment[];
496 static god** God;
497 static int CurrentLevelIndex;
498 static int CurrentDungeonIndex;
499 static cint MoveNormalCommandKey[];
500 static int MoveAbnormalCommandKey[];
501 static cv2 MoveVector[];
502 static cv2 RelativeMoveVector[];
503 static cv2 BasicMoveVector[];
504 static cv2 LargeMoveVector[];
505 static uChar*** LuxTable;
506 static truth Running;
507 static character* Player;
508 static v2 Camera;
509 static feuLong Tick;
510 static festring AutoSaveFileName;
511 static truth InWilderness;
512 static worldmap* WorldMap;
513 static area* AreaInLoad;
514 static square* SquareInLoad;
515 static dungeon** Dungeon;
516 static feuLong NextCharacterID;
517 static feuLong NextItemID;
518 static feuLong NextTrapID;
519 static team** Team;
520 static feuLong LOSTick;
521 static truth LOSUpdateRequested;
522 static character* Petrus;
523 static truth Loading;
524 static truth JumpToPlayerBe;
525 static gamescript* GameScript;
526 static valuemap GlobalValueMap;
527 static v2 CursorPos;
528 static truth Zoom;
529 static truth Generating;
530 static dangermap DangerMap;
531 static int NextDangerIDType;
532 static int NextDangerIDConfigIndex;
533 static double AveragePlayerArmStrengthExperience;
534 static double AveragePlayerLegStrengthExperience;
535 static double AveragePlayerDexterityExperience;
536 static double AveragePlayerAgilityExperience;
537 static characteridmap CharacterIDMap;
538 static itemidmap ItemIDMap;
539 static trapidmap TrapIDMap;
540 static int Teams;
541 static int Dungeons;
542 static int StoryState;
543 static int MondedrPass;
544 static int RingOfThieves;
545 static int Masamune;
546 static int Muramasa;
547 static int LoricatusHammer;
548 static int Liberator;
549 static int OmmelBloodMission;
550 static int RegiiTalkState;
551 static truth InGetCommand;
552 static truth PlayerHurtByExplosion;
553 static area* CurrentArea;
554 static level* CurrentLevel;
555 static wsquare*** CurrentWSquareMap;
556 static lsquare*** CurrentLSquareMap;
557 static festring DefaultPolymorphTo;
558 static festring DefaultSummonMonster;
559 static festring DefaultWish;
560 static festring DefaultChangeMaterial;
561 static festring DefaultDetectMaterial;
562 static massacremap PlayerMassacreMap;
563 static massacremap PetMassacreMap;
564 static massacremap MiscMassacreMap;
565 static sLong PlayerMassacreAmount;
566 static sLong PetMassacreAmount;
567 static sLong MiscMassacreAmount;
568 static truth WizardMode;
569 static int SeeWholeMapCheatMode;
570 static truth GoThroughWallsCheat;
571 static int QuestMonstersFound;
572 static boneidmap BoneItemIDMap;
573 static boneidmap BoneCharacterIDMap;
574 static truth TooGreatDangerFoundTruth;
575 static bitmap* BusyAnimationCache[32];
576 static itemvectorvector ItemDrawVector;
577 static charactervector CharacterDrawVector;
578 static truth SumoWrestling;
579 static festring PlayerName;
580 static liquid* GlobalRainLiquid;
581 static v2 GlobalRainSpeed;
582 static sLong GlobalRainTimeModifier;
583 static truth PlayerSumoChampion;
584 static truth PlayerSolicitusChampion;
585 static feuLong SquarePartEmitationTick;
586 static cint LargeMoveDirection[];
587 static sLong Turn;
588 static feuLong EquipmentMemory[MAX_EQUIPMENT_SLOTS];
589 static truth PlayerRunning;
590 static character* LastPetUnderCursor;
591 static charactervector PetVector;
592 static double DangerFound;
593 static int OldAttribute[ATTRIBUTES];
594 static int NewAttribute[ATTRIBUTES];
595 static int LastAttributeChangeTick[ATTRIBUTES];
596 static int NecroCounter;
597 static int CursorData;
598 static olterrain* MonsterPortal;
599 static truth CausePanicFlag;
600 static time_t TimePlayedBeforeLastLoad;
601 static time_t LastLoad;
602 static time_t GameBegan;
603 static std::vector<v2> SpecialCursorPos;
604 static std::vector<int> SpecialCursorData;
605 static truth PlayerHasReceivedAllGodsKnownBonus;
606 static cbitmap* EnterImage;
607 static v2 EnterTextDisplacement;
609 static std::stack<inputfile *> mFEStack;
611 public:
612 static character *mChar;
613 static ccharacter *mActor;
614 static ccharacter *mSecondActor;
615 static item *mItem;
616 static int mResult;
619 inline void game::CombineLights(col24& L1, col24 L2)
621 if(L2)
623 if(L1)
625 sLong Red1 = L1 & 0xFF0000, Red2 = L2 & 0xFF0000;
626 sLong New = Red1 >= Red2 ? Red1 : Red2;
627 sLong Green1 = L1 & 0xFF00, Green2 = L2 & 0xFF00;
628 New |= Green1 >= Green2 ? Green1 : Green2;
629 sLong Blue1 = L1 & 0xFF, Blue2 = L2 & 0xFF;
630 L1 = Blue1 >= Blue2 ? New | Blue1 : New | Blue2;
632 else
633 L1 = L2;
637 inline col24 game::CombineConstLights(col24 L1, col24 L2)
639 CombineLights(L1, L2);
640 return L1;
643 inline truth game::IsDark(col24 Light)
645 return !Light
646 || ((Light & 0xFF0000) < (LIGHT_BORDER << 16)
647 && (Light & 0x00FF00) < (LIGHT_BORDER << 8)
648 && (Light & 0x0000FF) < LIGHT_BORDER);
651 inline int game::CompareLights(col24 L1, col24 L2)
653 if(L1)
655 if((L1 & 0xFF0000) > (L2 & 0xFF0000)
656 || (L1 & 0x00FF00) > (L2 & 0x00FF00)
657 || (L1 & 0x0000FF) > (L2 & 0x0000FF))
658 return 1;
659 else if((L1 & 0xFF0000) == (L2 & 0xFF0000)
660 || (L1 & 0x00FF00) == (L2 & 0x00FF00)
661 || (L1 & 0x0000FF) == (L2 & 0x0000FF))
662 return 0;
663 else
664 return -1;
666 else
667 return -int(!!L2);
670 inline v2 game::CalculateScreenCoordinates(v2 Pos)
672 return v2((Pos.X - Camera.X + 1) << 4, (Pos.Y - Camera.Y + 2) << 4);
675 #endif