terrains separated
[k8-i-v-a-n.git] / src / game / game.h
blobf2b66544e07e920bc47775cfce1fed46e8ec4b32
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 void SetIsInGetCommand(truth What) { InGetCommand = What; }
347 static truth IsInGetCommand() { return InGetCommand; }
348 static festring GetHomeDir();
349 static festring GetSaveDir();
350 static festring GetGameDir();
351 static festring GetBoneDir();
352 static truth PlayerWasHurtByExplosion() { return PlayerHurtByExplosion; }
353 static void SetPlayerWasHurtByExplosion(truth What) { PlayerHurtByExplosion = What; }
354 static void SetCurrentArea(area* What) { CurrentArea = What; }
355 static void SetCurrentLevel(level* What) { CurrentLevel = What; }
356 static void SetCurrentWSquareMap(wsquare*** What) { CurrentWSquareMap = What; }
357 static void SetCurrentLSquareMap(lsquare*** What) { CurrentLSquareMap = What; }
358 static festring& GetDefaultPolymorphTo() { return DefaultPolymorphTo; }
359 static festring& GetDefaultSummonMonster() { return DefaultSummonMonster; }
360 static festring& GetDefaultChangeMaterial() { return DefaultChangeMaterial; }
361 static festring& GetDefaultDetectMaterial() { return DefaultDetectMaterial; }
362 static void SignalDeath(ccharacter*, ccharacter*, festring);
363 static void DisplayMassacreLists();
364 static void DisplayMassacreList(const massacremap&, cchar*, sLong);
365 static truth MassacreListsEmpty();
366 #ifdef WIZARD
367 static void ActivateWizardMode() { WizardMode = true; }
368 static void DeactivateWizardMode() { WizardMode = false; }
369 static truth WizardModeIsActive() { return WizardMode; }
370 static void SeeWholeMap();
371 static int GetSeeWholeMapCheatMode() { return SeeWholeMapCheatMode; }
372 static truth GoThroughWallsCheatIsActive() { return GoThroughWallsCheat; }
373 static void GoThroughWalls() { GoThroughWallsCheat = !GoThroughWallsCheat; }
374 #else
375 static truth WizardModeIsActive() { return false; }
376 static int GetSeeWholeMapCheatMode() { return 0; }
377 static truth GoThroughWallsCheatIsActive() { return false; }
378 #endif
379 static truth WizardModeIsReallyActive() { return WizardMode; }
380 static void CreateBone();
381 static int GetQuestMonstersFound() { return QuestMonstersFound; }
382 static void SignalQuestMonsterFound() { ++QuestMonstersFound; }
383 static void SetQuestMonstersFound(int What) { QuestMonstersFound = What; }
384 static truth PrepareRandomBone(int);
385 static boneidmap& GetBoneItemIDMap() { return BoneItemIDMap; }
386 static boneidmap& GetBoneCharacterIDMap() { return BoneCharacterIDMap; }
387 static double CalculateAverageDanger(const charactervector&, character*);
388 static double CalculateAverageDangerOfAllNormalEnemies();
389 static character* CreateGhost();
390 static truth TooGreatDangerFound() { return TooGreatDangerFoundTruth; }
391 static void SetTooGreatDangerFound(truth What) { TooGreatDangerFoundTruth = What; }
392 static void CreateBusyAnimationCache();
393 static sLong GetScore();
394 static truth TweraifIsFree();
395 static truth IsXMas();
396 static int AddToItemDrawVector(const itemvector&);
397 static void ClearItemDrawVector();
398 static void ItemEntryDrawer(bitmap*, v2, uInt);
399 static int AddToCharacterDrawVector(character*);
400 static void ClearCharacterDrawVector();
401 static void CharacterEntryDrawer(bitmap*, v2, uInt);
402 static void GodEntryDrawer(bitmap*, v2, uInt);
403 static itemvectorvector& GetItemDrawVector() { return ItemDrawVector; }
404 static charactervector& GetCharacterDrawVector() { return CharacterDrawVector; }
405 static truth IsSumoWrestling() { return SumoWrestling; }
406 static void SetIsSumoWrestling(truth What) { SumoWrestling = What; }
407 static truth AllowHostilities() { return !SumoWrestling; }
408 static truth AllBodyPartsVanish() { return SumoWrestling; }
409 static truth TryToEnterSumoArena();
410 static truth TryToExitSumoArena();
411 static truth EndSumoWrestling(int);
412 static character* GetSumo();
413 static cfestring& GetPlayerName() { return PlayerName; }
414 static rain* ConstructGlobalRain();
415 static void SetGlobalRainLiquid(liquid* What) { GlobalRainLiquid = What; }
416 static void SetGlobalRainSpeed(v2 What) { GlobalRainSpeed = What; }
417 static truth PlayerIsSumoChampion() { return PlayerSumoChampion; }
418 static truth PlayerIsSolicitusChampion() { return PlayerSolicitusChampion; }
419 static void MakePlayerSolicitusChampion() { PlayerSolicitusChampion = true; }
420 static v2 GetSunLightDirectionVector();
421 static int CalculateMinimumEmitationRadius(col24);
422 static feuLong IncreaseSquarePartEmitationTicks();
423 static cint GetLargeMoveDirection(int I) { return LargeMoveDirection[I]; }
424 static bool Wish(character*, cchar*, cchar*, bool canAbort=false);
425 static festring DefaultQuestion(festring, festring&, stringkeyhandler = 0);
426 static void GetTime(ivantime&);
427 static sLong GetTurn() { return Turn; }
428 static void IncreaseTurn() { ++Turn; }
429 static int GetTotalMinutes() { return Tick * 60 / 2000; }
430 static truth PolymorphControlKeyHandler(int, festring&);
431 static feuLong* GetEquipmentMemory() { return EquipmentMemory; }
432 static truth PlayerIsRunning();
433 static void SetPlayerIsRunning(truth What) { PlayerRunning = What; }
434 static truth FillPetVector(cchar*);
435 static truth CommandQuestion();
436 static void NameQuestion();
437 static v2 CommandKeyHandler(v2, int);
438 static void CommandScreen(cfestring&, feuLong, feuLong, feuLong&, feuLong&);
439 static truth CommandAll();
440 static double GetDangerFound() { return DangerFound; }
441 static void SetDangerFound(double What) { DangerFound = What; }
442 static col16 GetAttributeColor(int);
443 static void UpdateAttributeMemory();
444 static void InitAttributeMemory();
445 static void TeleportHandler(v2);
446 static void PetHandler(v2);
447 static truth SelectPet(int);
448 static double GetGameSituationDanger();
449 static olterrain* GetMonsterPortal() { return MonsterPortal; }
450 static void SetMonsterPortal(olterrain* What) { MonsterPortal = What; }
451 static truth GetCausePanicFlag() { return CausePanicFlag; }
452 static void SetCausePanicFlag(truth What) { CausePanicFlag = What; }
453 static sLong GetTimeSpent();
454 static void AddSpecialCursor(v2, int);
455 static void RemoveSpecialCursors();
456 static void LearnAbout(god*);
457 static truth PlayerKnowsAllGods();
458 static void AdjustRelationsToAllGods(int);
459 static void SetRelationsToAllGods(int);
460 static void ShowDeathSmiley(bitmap*, truth);
461 static void SetEnterImage(cbitmap* What) { EnterImage = What; }
462 static void SetEnterTextDisplacement (v2 What) { EnterTextDisplacement = What; }
464 static int ListSelector (int defsel, cfestring &title, ...); // defsel<0: first
465 static int ListSelectorArray (int defsel, cfestring &title, const char *items[]); // defsel<0: first
467 static char GetAbnormalMoveKey (int idx);
468 static void SetAbnormalMoveKey (int idx, char ch);
470 static truth CheckDropLeftover (item *i);
472 static void ClearEventData ();
473 // return 'true' if event is 'eaten'
474 static truth RunOnEvent (cfestring &ename);
475 static truth RunOnCharEvent (character *who, cfestring &ename);
476 static truth RunOnItemEvent (item *what, cfestring &ename);
478 static truth RunAllowScriptStr (cfestring &str);
480 static festring ldrGetVar (inputfile *fl, cfestring &name);
482 private:
483 static truth RunOnEventStr (cfestring &name, cfestring &str);
484 static truth GetWord (festring &w);
485 static void SkipBlock (truth brcEaten);
486 static void UpdateCameraCoordinate (int &, int, int, int);
487 static truth DoOnEvent (truth brcEaten, truth AllowScript=false);
488 static int ParseFuncArgs (cfestring &types, std::vector<FuncArg> &args, inputfile *fl=0, truth noterm=false);
490 private:
491 static cchar* const Alignment[];
492 static god** God;
493 static int CurrentLevelIndex;
494 static int CurrentDungeonIndex;
495 static cint MoveNormalCommandKey[];
496 static int MoveAbnormalCommandKey[];
497 static cv2 MoveVector[];
498 static cv2 RelativeMoveVector[];
499 static cv2 BasicMoveVector[];
500 static cv2 LargeMoveVector[];
501 static uChar*** LuxTable;
502 static truth Running;
503 static character* Player;
504 static v2 Camera;
505 static feuLong Tick;
506 static festring AutoSaveFileName;
507 static truth InWilderness;
508 static worldmap* WorldMap;
509 static area* AreaInLoad;
510 static square* SquareInLoad;
511 static dungeon** Dungeon;
512 static feuLong NextCharacterID;
513 static feuLong NextItemID;
514 static feuLong NextTrapID;
515 static team** Team;
516 static feuLong LOSTick;
517 static truth LOSUpdateRequested;
518 static character* Petrus;
519 static truth Loading;
520 static truth JumpToPlayerBe;
521 static gamescript* GameScript;
522 static valuemap GlobalValueMap;
523 static v2 CursorPos;
524 static truth Zoom;
525 static truth Generating;
526 static dangermap DangerMap;
527 static int NextDangerIDType;
528 static int NextDangerIDConfigIndex;
529 static double AveragePlayerArmStrengthExperience;
530 static double AveragePlayerLegStrengthExperience;
531 static double AveragePlayerDexterityExperience;
532 static double AveragePlayerAgilityExperience;
533 static characteridmap CharacterIDMap;
534 static itemidmap ItemIDMap;
535 static trapidmap TrapIDMap;
536 static int Teams;
537 static int Dungeons;
538 static int StoryState;
539 static int MondedrPass;
540 static int RingOfThieves;
541 static int Masamune;
542 static int Muramasa;
543 static int LoricatusHammer;
544 static int Liberator;
545 static truth InGetCommand;
546 static truth PlayerHurtByExplosion;
547 static area* CurrentArea;
548 static level* CurrentLevel;
549 static wsquare*** CurrentWSquareMap;
550 static lsquare*** CurrentLSquareMap;
551 static festring DefaultPolymorphTo;
552 static festring DefaultSummonMonster;
553 static festring DefaultWish;
554 static festring DefaultChangeMaterial;
555 static festring DefaultDetectMaterial;
556 static massacremap PlayerMassacreMap;
557 static massacremap PetMassacreMap;
558 static massacremap MiscMassacreMap;
559 static sLong PlayerMassacreAmount;
560 static sLong PetMassacreAmount;
561 static sLong MiscMassacreAmount;
562 static truth WizardMode;
563 static int SeeWholeMapCheatMode;
564 static truth GoThroughWallsCheat;
565 static int QuestMonstersFound;
566 static boneidmap BoneItemIDMap;
567 static boneidmap BoneCharacterIDMap;
568 static truth TooGreatDangerFoundTruth;
569 static bitmap* BusyAnimationCache[32];
570 static itemvectorvector ItemDrawVector;
571 static charactervector CharacterDrawVector;
572 static truth SumoWrestling;
573 static festring PlayerName;
574 static liquid* GlobalRainLiquid;
575 static v2 GlobalRainSpeed;
576 static sLong GlobalRainTimeModifier;
577 static truth PlayerSumoChampion;
578 static truth PlayerSolicitusChampion;
579 static feuLong SquarePartEmitationTick;
580 static cint LargeMoveDirection[];
581 static sLong Turn;
582 static feuLong EquipmentMemory[MAX_EQUIPMENT_SLOTS];
583 static truth PlayerRunning;
584 static character* LastPetUnderCursor;
585 static charactervector PetVector;
586 static double DangerFound;
587 static int OldAttribute[ATTRIBUTES];
588 static int NewAttribute[ATTRIBUTES];
589 static int LastAttributeChangeTick[ATTRIBUTES];
590 static int NecroCounter;
591 static int CursorData;
592 static olterrain* MonsterPortal;
593 static truth CausePanicFlag;
594 static time_t TimePlayedBeforeLastLoad;
595 static time_t LastLoad;
596 static time_t GameBegan;
597 static std::vector<v2> SpecialCursorPos;
598 static std::vector<int> SpecialCursorData;
599 static truth PlayerHasReceivedAllGodsKnownBonus;
600 static cbitmap* EnterImage;
601 static v2 EnterTextDisplacement;
603 static std::stack<inputfile *> mFEStack;
605 public:
606 static character *mChar;
607 static ccharacter *mActor;
608 static ccharacter *mSecondActor;
609 static item *mItem;
610 static int mResult;
613 inline void game::CombineLights(col24& L1, col24 L2)
615 if(L2)
617 if(L1)
619 sLong Red1 = L1 & 0xFF0000, Red2 = L2 & 0xFF0000;
620 sLong New = Red1 >= Red2 ? Red1 : Red2;
621 sLong Green1 = L1 & 0xFF00, Green2 = L2 & 0xFF00;
622 New |= Green1 >= Green2 ? Green1 : Green2;
623 sLong Blue1 = L1 & 0xFF, Blue2 = L2 & 0xFF;
624 L1 = Blue1 >= Blue2 ? New | Blue1 : New | Blue2;
626 else
627 L1 = L2;
631 inline col24 game::CombineConstLights(col24 L1, col24 L2)
633 CombineLights(L1, L2);
634 return L1;
637 inline truth game::IsDark(col24 Light)
639 return !Light
640 || ((Light & 0xFF0000) < (LIGHT_BORDER << 16)
641 && (Light & 0x00FF00) < (LIGHT_BORDER << 8)
642 && (Light & 0x0000FF) < LIGHT_BORDER);
645 inline int game::CompareLights(col24 L1, col24 L2)
647 if(L1)
649 if((L1 & 0xFF0000) > (L2 & 0xFF0000)
650 || (L1 & 0x00FF00) > (L2 & 0x00FF00)
651 || (L1 & 0x0000FF) > (L2 & 0x0000FF))
652 return 1;
653 else if((L1 & 0xFF0000) == (L2 & 0xFF0000)
654 || (L1 & 0x00FF00) == (L2 & 0x00FF00)
655 || (L1 & 0x0000FF) == (L2 & 0x0000FF))
656 return 0;
657 else
658 return -1;
660 else
661 return -int(!!L2);
664 inline v2 game::CalculateScreenCoordinates(v2 Pos)
666 return v2((Pos.X - Camera.X + 1) << 4, (Pos.Y - Camera.Y + 2) << 4);
669 #endif