data dirs renamed
[k8-i-v-a-n.git] / Doc / Obsolete / Main.txt
bloba1f8faeabfa7479365d1a72eb606b8df99ea527f
1 ----------------------------------------------------------------------------
3           Iter Vehemens ad Necem main executable source documentation
5 ----------------------------------------------------------------------------
7 Classes:
8 --------
10 area (area.h)
11 -------------
13 Basic container of squares. In addition to square data, this hold FlagMap,
14 a 2D-map containing flags used for level generation and Memorized, a bitmap
15 with all memorized terrain blitted here for safekeeping. Base class for level
16 and worldmap.
18 Functions:
20 area(ushort XSize, ushort YSize)
22         Creates a new area of given size. The squares are not initialized
23         in any way, however.
25 ~area()
27         Destroys the area and its components.
29 Save(std::ofstream* SaveFile)
31         Saves the area and its contents to a file as an uncompressed
32         bytesream.
34 area(std::ifstream* SaveFile)
36         Creates a new area and loads its contents from a file.
38 RemoveCharacter(vector Pos)
40         Removes a character from the square pointed by Pos.
42 AddCharacter(vector Pos, character* Guy)
44         Adds Guy to square in Pos.
46 vector RandomSquare(const bool Walkablility)
48         Returns coordinates of a random square with overterrain
49         of specified Walkability. Crashes horribly if one is not found.
51 ushort CFlag(const vector Pos)
53         Return contents of FlagMap in position Pos. Used mainly
54         by level generation code.
56 square* operator [] (vector Pos)
57 square* CSquare(vector Pos)
59         Returns square in position Pos.
61 ushort CXSize()
62 ushort CYSize()
64         Return the width and height of the area map.
66 bitmap* CMemorized()
68         Return a pointer to the Memorized bitmap.
70 character (char.h)
71 ------------------
73 The base class for all character types, derived from object.
75 Functions:
77 character(material** Material, vector BitmapPos, ushort Size,
78           ushort Agility, ushort Strength, ushort Endurance,
79           ushort Perception, uchar Relations);
81         Constructs the character. Material must point to a pointer to the
82         correct material. BitmapPos is discarded. Relations must be in
83         the range either HOSTILE (0), NEUTRAL (1) or FRIEND (2), for
84         it determines the initial relation to the player character.
85         Note: "character" is an abstract class. You must call this
86         constructor from derived concrete classes only!
88 ~character()
90         Destructs the character.
92 character(std::ifstream* SaveFile, ushort MaterialQuantity = 1)
94         Loads a character from a savefile. MaterialQuantity is discarded.
96 DrawToTileBuffer()
98         Draws the character to igraph's TileBuffer, from where it's
99         blitted to DOUBLEBUFFER once time is rigth.
101 Act()
103         The basic command for character to do something. Called every
104         tick.
106 bool Hit(character* Enemy)
108         Commands the character to hit someone. Normally called only by
109         TryMove(), when the character tries to move over someone.
110         Return false if hit was canceled by some reason.
112 uchar TakeHit(ushort Speed, short Success, float WeaponStrength,
113               character* Enemy)
115         Called by Hit(). This determines the success of the hit and
116         damage caused based on parameters and characters' attributes.
117         Returns either HAS_HIT (0), HAS_BLOCKED (1), HAS_DODGED (2) or
118         HAS_DIED (3).
120 bool Consume()
122         Called by GetPlayerCommand(), asks the player what he wants
123         to consume and such. Returns false if action was cancelled.
125 Hunger()
127         Called by Act(), this function handles nutrition consuming,
128         "You are getting hungry." messages and starvation death.
130 bool TryMove(vector MoveTo)
132         Tries to move somewhere or hit something. Returns false
133         on cancel.
135 bool Drop()
137         Displays the drop dialog. Returns false if nothing was dropped.
139 bool ConsumeItem(int ToBeEaten, stack* ItemsStack)
141         Tries to consume an item. Called by Consume(). False means cancel.
143 Regenerate()
145         Called by Act(), this handles turnly HP regeneration.
147 Move(vector MoveTo, bool TeleportMove = false)
149         An actual move, this handles lightning and LOS changes and
150         replacing the character. However this does nothing if
151         the character is overburdened and TeleportMove is false.
153 bool ShowInventory()
155         Shows the inventory list. Always returns false.
157 bool PickUp()
159         Shows the pickup dialog. Returns false on cancel.
161 bool Quit()
163         Asks whether the player wishes to quit. If no, returns false.
164         If yes, exits to main menu.
166 bool Wield()
168         Shows the wield dialog. Returns false on cancel.
170 Die()
172         Drops all items, creates a corpse of the character, possibly
173         updates lights, sends the character to game::Hell and exits
174         if this == Player and no cheats prevent this. Does nothing
175         if character is already dead.
177 bool OpenItem()
179         Shows the open item dialog. Returns false on cancel.
181 ReceiveSound(char* Pointer, short Success, float ScreamStrength)
183         Adds string pointed by Pointer to messages if this == Player
184         and causes appropriate damage to the character based on the
185         parameters.
187 item*  CWielded()
189         Return pointer to currently wielded item or 0 if character is in
190         melee mode.
192 stack* CStack()
194         Return pointer to the character's inventory stack.
196 ushort CEmitation()
198         Calculates the character's light emulation in range 0-511.
200 vector CPos()
202         Returns the position of the square under the character. If such
203         doesn't exist, crashes terribly.
205 bool CHasActed()
207         Has Act() of this character been called during this tick?
209 ushort CStrength()
210 ushort CAgility()
211 ushort CEndurance()
212 ushort CPerception()
213 ushort CSize()
215         Returns the attribute in question.
217 short CHP()
218 long CNP()
220         Returns Hit Points and Nutrition Points (how far the character is
221         from starvation).
223 SSquareUnder(square* Square)
225         Set SquareUnder to Square.
227 SHasActed(bool HA)
229         HasActed determines whether the character has acted during this
230         tick. This sets it to HA.
232 bool WearArmor()
234         Shows the wear armor dialog. Return false if not applicable
235         to the class or cancellation was detected.
237 item* CTorsoArmor()
239         Return the item worn over torso, or 0 for nothing.
241 bool ConsumeItemType(uchar Type)
243         Returns whether this individual character can consume an item
244         of consume type Type. (like MEAT etc.)
246 ReceiveBulimiaDamage()
248         Calculates an NP limit based on character's size and causes
249         overeating damage based on how much NP value is over it.
251 ReceiveNutrition(long SizeOfEffect)
252 ReceiveFireDamage(long SizeOfEffect)
253 ReceiveSchoolFoodEffect(long)
254 ReceiveOmleUrineEffect(long)
255 ReceivePepsiEffect(long SizeOfEffect)
256 Darkness(long SizeOfEffect)
258         Various effect functions called from material::EatEffect().
260 uchar CRelations()
262         Returns current relation towards the player character,
263         either HOSTILE (0), NEUTRAL (1) or FRIEND (2).
265 AddBlockMessage(character* Enemy)
267         Adds a message that Enemy has blocked the this character's attack,
268         i.e. hit was successful but did zero damage.
270 AddDodgeMessage(character* Enemy)
272         Adds a message explaining that Enemy has dodged this character's
273         attack, i.e. the character missed and did zero damage.
275 AddHitMessage(character* Enemy, const bool Critical = false)
277         Adds a message informing the that this character has hit the
278         Enemy succesfully and did a positive amount of damage.
279         Critical must determine whether the hit was critical (double
280         damage, automatic hit) or not.
282 uchar GetSex()
284         Returns whether character is MALE (1) of FEMALE (2), something
285         UNDEFINED (0), or something between the three like TRANSSEXUAL (3).
287 BeTalkedTo(character* Talker)
289         Triggers an event tied to conversation between this character and
290         Talker.
292 bool Talk()
294         The character is asked whom he/she/it wants to talk to and
295         perhaps calls BeTalkedTo. Called by GetPlayerCommand. False
296         as return means cancel.
298 bool GoUp()
299 bool GoDown()
301         Functions tied to '<' and '>'. False is returned if level
302         doesn't change.
304 bool Open()
305 bool Close()
307         The character is asked what he/she/it wants to open or
308         close. Called by GetPlayerCommand. False as return means cancel.
310 bool NOP()
312         The player rests one turn, reducing nutrition consuming.
313         Always returns true.
315 ushort CalculateArmorModifier()
317         Return a percentage number between 1-100 specifying how much damage
318         the character receives from hits.
320 ApplyExperience()
322         Called by Act(). Checks whether the character has gained/lost
323         enough attributal experience to alter primary attributes,
324         and adjusts them if needed.
326 bool HasHeadOfElpuri()
327 bool HasPerttusNut()
328 bool HasMaakotkaShirt()
330         Self-explanatory.
332 bool Save()
334         Asks whether the character wants to save and quit. Called by
335         GetPlayerCommand. False as return means cancel.
337 bool Read()
339         Shows the read dialog. False as return means cancel.
341 bool ReadItem(int ToBeRead, stack* ItemsStack)
343         Called by bool Read(). Tries to read an item. Returns false on
344         unsuccess.
346 uchar GetBurdenState(ulong Mass = 0)
348         Returns either UNBURDENED (3), BURDENED (2), STRESSED (1), or
349         OVERLOADED (0) based on Mass and character's strength. If
350         Mass is zero, uses character's current inventory weigth
351         instead.
353 bool Dip()
355         Shows the dip dialog. Returns false on cancel.
357 Save(std::ofstream* SaveFile)
359         Saves the character's data to SaveFile.
361 bool WizardMode()
362 bool RaiseStats()
363 bool LowerStats()
364 bool SeeWholeMap()
365 bool WalkThroughWalls()
367         Functions tied to corresponding Wizard Mode keys. False
368         means no effect took place.
370 bool IncreaseGamma()
371 bool DecreaseGamma()
372 bool IncreaseSoftGamma()
373 bool DecreaseSoftGamma()
375         Self-explanatory. Called by GetPlayerCommand. Always return
376         false.
378 float CWeaponStrength()
379 float CAttackStrength()
381         Returns the weaponstrength of melee attack or wielded item.
382         Functions are equal which is insane.
384 bool ShowKeyLayout()
385 bool Look()
387         Functions tied to '?' and 'l'. Always return false.
389 long CStrengthExperience()
390 long CEnduranceExperience()
391 long CAgilityExperience()
392 long CPerceptionExperience()
393 ushort CRegenerationCounter()
394 square* CSquareUnder()
395 levelsquare* CLevelSquareUnder()
396 long CAP()
397 bool CFainted()
398 long CAPsToBeEaten()
400         Return their corresponding data fields.
402 float CDifficulty()
404         Calculates the current Difficulty of the player, used by monster
405         generation code.
407 bool Engrave(std::string What)
409         Engraves What to the square under. Crashes horribly if one doesn't
410         exits. Returns true without exception.
412 bool WhatToEngrave()
414         Function tied to 'E'. Always returns false which is terribly wrong.
416 MoveRandomly()
418         AI function that moves the character randomly to any available
419         directions that aren't blocked, or alternatively sits still.
421 SWielded(item* Something)
423 SMaterial(ushort Where, material* What)
425 SHP(short What)
426 SStrengthExperience(long What)
427 SAgilityExperience(long What)
428 SEnduranceExperience(long What)
429 SPerceptionExperience(long What)
430 SAP(long What)
431 SFainted(bool What)
432 SNP(long What)
433 SRelations(uchar What)
434 SStrength(ushort What)
435 SEndurance(ushort What)
436 SAgility(ushort What)
437 SPerception(ushort What)
438 SRegenerationCounter(long What)
439 SConsumingCurrently(ushort What)
440 SAPsToBeEaten(long What)
442         Set their data fields to What.
444 bool TestForPickup(item* ToBeTested)
446         AI function that tests whether the character would become burdened
447         or worse when picking ToBeTested up.
449 bool CanWield()
450 bool CanWear()
452         Self-explanatory.
454 bool WearItem(item* ToBeWorn)
456         Tries to wear the item ToBeWorn. Returns false if unsuccessful.
458 bool OpenPos(vector APos)
460         Called by bool Open(), this tries to open the overterrain in APos.
461         False means he/she/it cannot or wants not.
463 bool Pray()
465         Shows the pray dialog. False is returned on cancel.
467 SpillBlood(uchar HowMuch)
469         Spills blood on SquareUnder.
471 HealFully(character* ToBeHealed)
473         AI function that heals ToBeHealed fully, if the character can.
475 bool Kick()
477         Function tied to 'k'. Returns false if illegal key was pressed
478         when asking direction.
480 bool ScreenShot()
482         Saves DOUBLEBUFFER to a dib-format bmp-file "Scrshot.bmp".
483         Returns false.
485 bool Offer()
487         Shows the offer dialog. Returns false on cancellation,
488         sacrifice rejection and not doing this on an altar.
490 ushort LOSRange()
492         Returns how far the character can see, in tiles, based on
493         perception.
495 ushort LOSRangeLevelSquare()
497         Returns the square of the preseding.
499 long Score()
501         Calculates the score of the player character.
503 long AddScoreEntry(std::string Description, float Multiplier = 1)
505         Adds the player character to high score list. Description must
506         contain the cause of death. Score is multiplied by Multiplier,
507         which is used mainly on victorious games.
509 bool CheckDeath(std::string Msg)
511         Kills the character if HP is low enough, and calls AddScoreEntry()
512         if this == game::CPlayer(). Returns true on death, false otherwise.
514 ulong Danger()
516         Returns the danger level of the monster, used by monster generation
517         code.
519 bool Charmable()
521         Returns whether the character can be charmed and turned to NEUTRAL
522         by MP3s and etc.
524 bool CheckBulimia()
526         Returns whether the character has already surpassed his/her/its
527         NP limit, based on size.
529 bool CheckIfConsumable(ushort Index)
531         Checks whether an item in character's inventory of index Index
532         is consumable.
534 bool DrawMessageHistory()
536         Self-explanatory. Returns false.
538 bool Throw()
540         Shows the throw dialog. False means cancellation.
542 bool ThrowItem(uchar Direction, item* ToBeThrown)
544         Throws an item to Direction (0-7, index of direction vector).
545         Returns false if the item did not move anywhere for some reason.
547 HasBeenHitByItem(item* Thingy, float Speed, bool CanBeSeen)
549         Called by item::HitCharacter(). Calculates damage the Thingy caused
550         and adds a message of the event if its position CanBeSeen.
552 bool Catches(item* Thingy, float, bool CanBeSeen)
554         Called by item::HitCharacter(). The character tries to catch a
555         flying item, like a dog catching a bone. Returns true if
556         successful.
558 bool DodgesFlyingItem(item*, float Speed, bool)
560         Called by item::HitCharacter(). Returns whether the character
561         can dodge an item flying at Speed.
563 ulong CBloodColor()
565         Returns the color of character's blood.
567 ContinueEating()
569         Called by Act every tick the character is eating. Handles
570         stopping consume after too much time etc.
572 StopEating()
574         Stops eating something. Called by ContinueEating().
576 Vomit(ushort HowMuch)
578         Forces the character to vomit as much as HowMuch.
580 character* Clone()
582         Creates a clone of the character and returns a pointer to it.
583         Used by character generation system.
585 character* Load(std::ifstream* SaveFile, ushort MaterialQuantity = 1)
587         Creates a character of this type and loads its data fields
588         from SaveFile via character(std::ifstream* SaveFile,
589         ushort MaterialQuantity). MaterialQuantity is discarded.
591 ushort Possibility()
593         Returns whether it is possible for the character to appear
594         randomly in the dungeon. Zero means not, non-zero yes.
596 bool Apply()
598         Shows the apply dialog.
600 GetPlayerCommand()
602         Called by Act, this waits for the user's proper keypress and calls
603         the tied function, which returns either true or false. If true,
604         function returns, if false, it waits for another command.
606 GetAICommand()
608         Basic AI function run each turn, called by Act.
610 Charge(character* Target)
612         Commands the character to move towards the target or hit it
613         if they are adjacent to each other.
615 float GetMeleeStrength()
617         Returns weaponstrength of hands, teeth, pepsi vomit, etc.
618         that is used if nothing is wielded.
620 HostileAICommand()
621 NeutralAICommand()
622 FriendAICommand()
624         GetAICommand() calls the one associated with the current relation
625         to player character. Call things like Charge or HealFully etc.
627 std::string ThirdPersonWeaponHitVerb(const bool Critical)
628 std::string ThirdPersonMeleeHitVerb(const bool Critical)
629 std::string FirstPersonHitVerb(character*, const bool Critical)
630 std::string AICombatHitVerb(character*, const bool Critical)
632         Called by AddHitMessage as appropriate. See that function body
633         for more information.
635 std::string NormalFirstPersonHitVerb(const bool Critical)
636 std::string NormalThirdPersonHitVerb(const bool Critical)
637 std::string FirstPersonBiteVerb(const bool Critical)
638 std::string ThirdPersonBiteVerb(const bool Critical)
639 std::string FirstPersonPSIVerb(const bool Critical)
640 std::string ThirdPersonPSIVerb(const bool Critical)
641 std::string FirstPersonBrownSlimeVerb(const bool Critical)
642 std::string ThirdPersonBrownSlimeVerb(const bool Critical)
643 std::string FirstPersonPepsiVerb(const bool Critical)
644 std::string ThirdPersonPepsiVerb(const bool Critical)
646         Called by the preseding four functions, these handle different
647         hit messages based on character's type.
649 derived characters (character.h)
650 --------------------------------
652 The actual character classes instantiated in the game, and their
653 abstract bases such as humanoid. Functions are same as in character.
655 command (command.h)
656 -------------------
658 A class that contains information of one command, including the key that
659 triggers it and the character function that is tied to it.
661 Functions:
662 ----------
664 command(bool (character::*LinkedFunction)(void), std::string Description,
665         char Key)
667         Constructs the command. Description is the one that appears in
668         ShowKeyLayout list.
670 bool (character::*CLinkedFunction(void))()
671 std::string CDescription()
672 char CKey()
674         Return the associated data components.
676 game (game.h)
677 -------------
679 The garbage can of all global functions and variables. This holds class
680 prototypes, message system, pointers to areas and player and many
681 tiny key, string, god etc. routines that can't be put into any well-defined
682 category.
684 Functions:
685 ----------
687 Init(std::string Name = "")
689         Inits the game. Called by Main and LoadMenu. Name is the player's
690         name used for loading, if it's empty, it is asked from user.
692 DeInit()
694         Deinitializes the game and frees all memory allocated for levels
695         and player.
697 Run()
699         The Main Loop of the game, called by Main and LoadMenu.
701 const int Menu(std::string sMS)
703         Shows a menu like the main menu. sMS must contain all menu choices,
704         distinquished from each other by '\r' letter.
706 int* CMoveCommandKey()
708         Returns a pointer to MoveCommandKey, which is an array containing
709         all eight direction keys.
711 const vector* CMoveVector()
713         Returns a pointer to MoveVector, which is an array containing
714         all eight direction vectors in the same order as in MoveCommandKey.
716 level* CCurrentLevel()
718         Self-explanatory.
720 bool FlagHandler(ushort CX, ushort CY, ushort OX, ushort OY)
722         Used by LOS system. The LOS code draws lines beginning from player
723         and calls this function for each coordinate pair. CX and CY are
724         current coordinates, OX and OY the origo (player) coordnates.
725         This updates the pointed squares Flag (whether it can be seen)
726         and item memory. Returns false if the square is blocked and
727         linedrawing must be terminated.
729 bool DoLine(int X1, int Y1, int X2, int Y2,
730             bool (*Proc)(ushort, ushort, ushort, ushort))
732         "Draws" a line from X1:Y1 to X2:Y2, that is, calculates the route
733         between them coordinate by coordinate and calls Proc() with each
734         coordinates as arguments. Proc is usually FlagHandler or alike.
736 ushort*** CLuxTable()
738         Returns a pointer to the LuxTable. See "light.txt" for more
739         information.
741 ushort* CLuxTableSize()
743         Return a pointer to LuxTableSize. See "light.txt" for more
744         information.
746 Quit()
748         Quits the game, i.e. set the Running boolean, that determines
749         whether Run() will continue, to false.
751 character* CPlayer()
753         Returns pointer to the player character. Probably the most
754         used function in the game, but there's no macro.
756 SPlayer(character* NP)
758         Sets NP to be the new Player.
760 vector CCamera()
762         Returns the Camera vector, i.e. vector that tells the coordinates of
763         the square at the top left corner of the display.
765 UpDateCameraX()
766 UpDateCameraY()
768         Updates the Camera vector based on Player's position. Called from
769         different places, so different functions.
771 level* CLevel(ushort Index)
773         Returns level identified by Index.
775 character* game::CreateMonster(ushort Index)
776 item* game::CreateItem(ushort Index)
778         Creates a monster or item with Type() Index. Used by their "Balanced"
779         equalents and Load functions.
781 InitLuxTable()
782 DeInitLuxTable()
784         Create and free the LuxTable and LuxTableSize. DeInitLuxTable()
785         is called automatically on exit. For more information, see
786         "light.txt".
788 character* BalancedCreateMonster()
789 item* BalancedCreateItem()
791         The main character and item generation functions.
793 const char* Insult()
795         Returns a pointer to a random insult string, like "navastater".
797 bool BoolQuestion(std::string String, char DefaultAnswer = 0,
798                   int OtherKeyForTrue = 0, int (*Key)(void) = game::GetKey)
800         Displays a message String on the top bar, and waits for either 'y',
801         'Y', 'n' or 'N' to be pressed. If DefaultAnswer is zero, any
802         illegal key is interpreted as a rejection, if non-zero and non-two,
803         as an acceptance, if two, there's no default answer and so
804         the question is repeated until a proper answer is given.
805         If OtherKeyForTrue is pressed on any of these modes, it counts
806         as yes. Key is the getkey method used in the question. The function
807         return true if the answer was yes, false otherwise.
809 const char* PersonalPronoun(uchar Index)
810 const char* PossessivePronoun(uchar Index)
812         Pass either UNDEFINED (0), MALE (1) or FEMALE (2) to these
813         to get a proper pronoun suited for the sex, like "she" or "its".
815 DrawEverything(bool EmptyMsg = true)
816 DrawEverythingWithDebug(bool EmptyMsg = true)
818         In game, draw everything there is draw, like messages, game screen,
819         information panel etc. The second function is obsolete and does
820         the same as the first. If EmptyMsg is true, EMPTY_MESSAGES
821         is called after drawing the messages.
823 DrawEverythingNoBlit(bool EmptyMsg = true)
825         Same as above, except graphics::BlitDBToScreen() is not called
826         afterwards.
828 StoryScreen(const char* Text, bool GKey = true)
830         Displays Text in the center of a black screen, dividing it up into
831         lines if '\n' characters are present, and waits for keypress if
832         GKey is true.
834 bool Save(std::string SaveName = game::SaveName())
835 bool Load(std::string SaveName = game::SaveName())
837         Save and load the game from a set of files with a body SaveName.
839 material* CreateRandomSolidMaterial(ulong Volume)
841         Self-explanatory. Mainly used for golems and such.
843 material* CreateMaterial(ushort Index, ulong Volume)
845         Creates a material of Type() Index with volume Volume.
847 groundterrain* LoadGroundTerrain(std::ifstream* SaveFile)
848 overterrain* LoadOverTerrain(std::ifstream* SaveFile)
849 material* LoadMaterial(std::ifstream* SaveFile)
850 item* game::LoadItem(std::ifstream* SaveFile)
851 character* game::LoadCharacter(std::ifstream* SaveFile)
853         Loading functions for various classes. Btw, three first are VERY
854         badly coded!
856 bool CRunning()
858         Is the game still running...
860 EnableWizardMode()
861 SeeWholeMap()
862 GoThroughWalls()
864         Enables the Wizard Mode or toggles the other two, without
865         questioning anything.
867 bool CWizardMode()
868 bool CSeeWholeMapCheat()
869 bool CGoThroughWallsCheat()
871         Returns whether these modes are on or off.
873 uchar EditGamma(short Value)
875         Adds Value to Gamma and corrects its boundaries. Hardware Gamma
876         isn't working now, so this is quite useless.
878 bool EmitationHandler(ushort CX, ushort CY, ushort OX, ushort OY)
879 bool NoxifyHandler(ushort CX, ushort CY, ushort OX, ushort OY)
881         Handlers used with DoLine, mainly by the lighting system.
882         See "light.txt".
884 int GetKey()
885 int MonsGetKey()
887         Call getkey and return the result. Both are obsolete and were once
888         used for speed measurement correction.
890 UpdateCameraXWithPos(ushort Coord)
891 UpdateCameraYWithPos(ushort Coord)
893         Update camera coordinates with Coords. Never called simultaneously,
894         so different functions.
896 std::string StringQuestion(const char* String, ushort MaxLetters)
898         Displays String on the screen and waits for the user to input
899         a string, which is returned once terminated by the Enter key.
900         The user is however not allowed to make the string longer
901         than MaxLetters. Calls DrawEverythingNoBlit() before doing
902         anything, so don't use before the game is surely initialized.
904 bool KeyIsOK(char Key)
906         Return false if Key is a command key, true otherwise.
908 SCurrent(ushort What)
910         Sets the index of current level to What. Make sure that the level
911         is loaded before using it though.
913 ushort CCurrent()
915         Returns the index of the current level.
917 ushort CLevels()
919         Returns the total amount of levels in game.
921 int GetMoveCommandKey(vector A, vector B)
923         Return the key that is tied to a MoveVector equaling (A - B).
924         Returns 0xFF if such is not found.
926 god* CGod(uchar Index)
928         Returns the god that has index of Index in the array of the
929         divine ones.
931 std::string CAlignment(uchar Index)
933         Returns a string corresponding the Alignment Index. This must
934         be in the range of 0-10, 0 returning "L++" and 10 "C--".
936 ApplyDivineTick()
938         Called every turn, this decreases the time one has to wait
939         until praying is possible (if its non-zero).
941 ApplyDivineAlignmentBonuses(god* CompareTarget, bool Good)
943         Called when a either sacrifising or praying to CompareTarget.
944         Adjusts the relation of other gods based on Alignment difference
945         and whether the deed was considered Good by CompareTarget.
947 SendToHell(character* PassedAway)
949         Sends character to the Hell array. Called by character::Die().
950         (it cannot just delete the character, since other functions
951         concerning it may still be called during that tick)
953 BurnHellsContents()
955         Deletes all contents of the Hell array. Called at the end of
956         tick and at the end of game.
958 vector GetDirectionVectorForKey(ushort Key)
960         Returns the MoveVector associated with Key or vector(0,0)
961         if there is none.
963 vector AskForDirectionVector()
965         Waits for a key and returns GetDirectionVectorForKey(PressedKey).
967 std::string StringQuestionWithClear(std::string String, ushort MaxLetters)
969         Like StringQuestion, but clears the screen before asking anything
970         instead of calling DrawEverythingNoBlit().
972 std::string CPlayerName()
973 SPlayerName(std::string What)
975         Self-explanatory.
977 std::string SaveName()
979         Returns the player's name, resized to eight letters if necessary,
980         with spaces replaced with '_' letters.
982 bool EyeHandler(ushort CX, ushort CY, ushort OX, ushort OY)
984         Used with DoLine to determine if a ray of light can cross the
985         line without intervention.
987 long GodScore()
989         Returns the highest relation value one has with any god.
991 ShowLevelMessage()
993         Shows the message associated with CCurrentLevel(), and removes
994         it afterwards.
996 float Difficulty()
998         Calculates the true difficulty level for monster generation
999         algorithm, based on Player's difficulty and the Current level.
1001 TriggerQuestForMaakotkaShirt()
1003         Self-explanatory.
1005 CalculateGodNumber()
1007         Calculates the total amount of gods in game.
1009 SGodNumber(uchar What)
1011         Sets the amount of gods to What. Called by CalculateGodNumber().
1013 uchar CGodNumber()
1015         Returns the total amount of gods in game, as calculated before.
1017 long CBaseScore()
1019         At the beginning of the game, Player's initial score is saved
1020         to BaseScore to be substracted from the final score. This
1021         returns the value in question.
1023 Turn()
1025         Increases the Turn counter by one.
1027 float CSoftGamma()
1029         Returns SoftGamma, a value between 0-2, that is multiplied by
1030         luminance before all lighted draws.
1032 EditSoftGamma(float E)
1034         E is added to SoftGamma with a boundary check.
1036 WhatToLoadMenu()
1038         Shows the load menu, and loads, runs and kills the game if a
1039         savefile is actually chosen.
1041 ulong CTurns()
1043         Returns the number of turns that have passed since the beginning
1044         of the game.
1046 std::string CAutoSaveFileName()
1048         Returns the default autosave filename body.
1050 uchar DirectionQuestion(std::string Topic, uchar DefaultAnswer = 8,
1051                         bool RequireAnswer = true)
1053         Displays Topic and waits for a keypress. If the pressed key
1054         is a direction key, returns it's index in the MoveCommandKey
1055         array. If it is not, and DefaultAnswer is a correct direction
1056         key index, it returns DefaultAnswer. If it is not, and
1057         RequireAnswer is false, it returns 0xFF. If it is not,
1058         function will forcefully wait as long as a correct key
1059         is received.
1061 command** CCommand()
1063         Returns a pointer to the command map.
1065 const character* const CCharacterPrototype(const ushort Index)
1066 prototypecontainer<character>& CCharacterPrototype()
1067 const item* const CItemPrototype(const ushort Index)
1068 prototypecontainer<item>& CItemPrototype()
1070         Various self-explanatory functions for accessing character and item
1071         prototypes.
1073 SaveLevel(std::string SaveName = SaveName(), ushort Index = CCurrent(),
1074           bool DeleteAfterwards = true)
1076         Saves the level of Index to a file with name Savename + ".l" + Index,
1077         and deletes it afterwards if wanted. Be sure the level actually
1078         exists and is not deleted.
1080 LoadLevel(std::string SaveName = SaveName(), ushort Index = CCurrent())
1082         Loads the level of Index from a file with name Savename + ".l" +
1083         Index.
1085 RemoveSaves()
1087         Removes all saves with SaveName() or AutoSaveName() as a filename
1088         body.
1090 item* CreateItem(std::string What)
1092         Tries to create an item of name What. If such doesn't exist
1093         or cannot otherwise be created this way, returns 0.
1095 const unsigned int CountChars(const char cSF,std::string sSH)
1097         Counts how many cSFs there are in sSH.
1099 game::globalmessagingsystem (game.h)
1100 ------------------------------------
1102 Excluding error messages and such, this handles all messages from the game
1103 to the player, i.e. those displayed in the upper message bar of the game
1104 screen.
1106 Functions:
1108 globalmessagingsystem()
1110         Initializes the system.
1112 AddMessage(const char* Format, ...)
1114         Adds a message to the messagebuffer and to the message history.
1115         The Format is processed equally like printf() does it. This is a
1116         very common function, so a macro ADD_MESSAGE is provided for
1117         convenience.
1119 Draw()
1121         Draws messages to the message bar. Macro DRAW_MESSAGES is provided.
1123 Empty()
1125         Empties the messagebuffer. Macro EMPTY_MESSAGES is provided.
1127 const char* CBuffer()
1129         Returns a pointer to the buffer.
1131 DrawMessageHistory()
1133         Self-explanatory.
1135 Format()
1137         Cleans the message history.
1139 game::panel (game.h)
1140 --------------------
1142 A class containing routines (well, one routine ;) for handling the
1143 information panel on the bottom of the game display screen.
1145 Functions:
1147 Draw()
1149         Self-explanatory.
1151 god (god.h)
1152 -----------
1154 The most divine of all classes, this holds relation to player,
1155 prayer timer, and praying functions, which are overloaded by derived
1156 gods to achieve most complicated and powerful effects.
1158 Functions:
1160 god()
1162         Initializes the god.
1164 Pray()
1166         Based on Timer and Relation, this determines whether the
1167         the prayer has a good or bad effect, calls the proper
1168         function and adjusts relations. Called by the pray dialog.
1170 std::string Name()
1172         Returns the name of the god.
1174 std::string Description()
1176         Returns a general description of god's profession.
1178 uchar Alignment()
1180         Returns the alignment of the god, in range 0-10, 0 meaning L++
1181         and 10 C--.
1183 std::string CompleteDescription()
1185         Returns the complete description used by the pray dialog, including
1186         alignment, name and profession.
1188 ApplyDivineTick()
1190         Called by the game function of same name, this decreases Timer
1191         by one if its above zero.
1193 AdjustRelation(god* Competitor, bool Good)
1195         If Competitor is prayed upon or a sacrifice is made for Him/Her,
1196         adjusts the relation of this god to player, based on whether the
1197         deed was Good and Competitor was pleased by it, and the
1198         alignment difference between Competitor and this. If it's
1199         zero or very low and Good is true, relation is increased,
1200         otherwise almost always decreased.
1202 AdjustRelation(short Amount)
1204         Adds Amount to Relation, clipping the result to the range of
1205         -1000 to +1000 if necessary.
1207 AdjustTimer(long Amount)
1209         Adds Amount to timer, clipping the result to the range of
1210         0 to 1000000000 if necessary.
1212 Save(std::ofstream* SaveFile)
1213 Load(std::ifstream* SaveFile)
1215         Save and load the Relation and Timer fields.
1217 SRelation(short Value)
1218 STimer(long Value)
1220         Sets Relation or Timer to Value without clipping.
1222 uchar BasicAlignment()
1224         Returns either GOOD (0), NEUTRAL (1) or EVIL (2) in order to
1225         determine material alignment bonuses/penalties applied while
1226         sacrifying.
1228 short CRelation()
1230         Returns Relation.
1232 PrintRelation()
1234         Adds a message explaining how much the god likes you after
1235         sacrifice.
1237 PrayGoodEffect()
1238 PrayBadEffect()
1240         The fun ones, called by Pray(). All variants of these automatically
1241         suspect that player is the object of their effects.
1243 bool ReceiveOffer(item* Sacrifice)
1245         Called by the offer dialog, determines if the current god wants and
1246         can receive Sacrifice. If so, calculates the effect, displays
1247         appropriate messages and return true. Otherwise returns false.
1249 independency (independ.h)
1250 -------------------------
1252 The most fundamental base class for independent things, that is those
1253 classes which are not used only for containing others, like stack
1254 and level, and can be contained in a single square, like all objects
1255 and worldmap terrains. It holds the basic name, drawing and saving
1256 interface for all these.
1258 Functions:
1260 independency(void)
1261 independency(std::ifstream*)
1262 ~independency(void)
1264         Currently do nothing.
1266 std::string Name(uchar Case)
1268         Returns the whole name of the independent being, according to
1269         Case, which can be one of the following:
1271         UNARTICLED (0)  no article is ever added
1272         DEFINITE   (2)  "the" is (usually) added to the name
1273         INDEFINITE (6)  "a" or "an" is (usually) added to the name
1275         You can also specify the flag PLURAL (1) if you wish to. This
1276         function is overridden by very numerous classes that don't want
1277         to use the standard procedure.
1279 Save(std::ofstream* SaveFile)
1281         The fundamental save, that outputs the result of Type() to SaveFile.
1283 std::string NameSingular(void)
1284 std::string NamePlural(void)
1286         Protected procedures that return the plain body of the thing's name
1287         and its plural name. Should be overloaded by every single derived
1288         class unless there are very good reasons to do otherwise.
1290 std::string CNameSingular(void)
1291 std::string CNamePlural(void)
1293         Just return the preseding in public.
1295 std::string NameNormal(uchar Case, std::string Article)
1296 std::string NameProperNoun(uchar Case)
1298         Two basic name modes. The first is used for things like "a lamp",
1299         the second for things like "Bill Gates the ElDeR cHaOs GoD".
1301 DrawToTileBuffer()
1303         Self-explanatory.
1305 ushort Type()
1307         Returns the numeric type of the independency. For save system usage
1308         only! (it's quite evil, y' know)
1310 vector CBitmapPos()
1312         Returns the coordinates of this thing's picture in its respective
1313         graphics file.
1315 item (item.h)
1316 -------------
1318 The base class for all item types, derived from object.
1320 Functions:
1322 item(ushort Size2, bool CreateMaterials)
1324         Constructs an item of size Size2. If CreateMaterials is false, item
1325         doesn't initialize its own materials, that is, it must be a base
1326         class
1327         for some other item that does this by itself.
1329 item(std::ifstream* SaveFile, ushort MaterialQuantity = 1)
1331         Creates and loads an item from SaveFile. MaterialQuantity is
1332         discarded.
1334 PositionedDrawToTileBuffer(uchar LevelSquarePosition)
1336         A special DrawToTileBuffer, this is called by
1337         stack::PositionedDrawToTileBuffer. It handles not only items that are
1338         on the floor but those that hang from the wall. LevelSquarePosition
1339         must be either DOWN (0), LEFT (1), UP (2), RIGHT (3) or CENTER (4),
1340         determining the position where the item should be drawn and the picture
1341         used for the draw.
1343 ulong CWeight()
1345         Calculates the weigth of the item, based on its materials' CWeigths.
1347 bool CanBeRead(character* Reader)
1349         Returns whether Reader can read this particular item.
1351 bool Consume(character* Consumer, float Amount = 100)
1353         Forces Consumer to consume the item, at least its eatable parts.
1354         If Amount is less than 100, only a percentage of eatable materials
1355         specified by Amount is consumed. False means the item could not
1356         be consumed.
1358 bool Read(character* Reader)
1360         Triggers the event that is associated with reading this particlular
1361         item. False as return means the item was not read for some reason.
1363 bool Consumable(character* Eater)
1365         Returns whether the item is consumable by Eater.
1367 ushort CEmitation(void)
1369         Returns the total emitation of the item. See "light.txt".
1371 short CalculateOfferValue(char GodAlignment)
1373         Calculates the total offer value, based on GodAlignment,
1374         which must be either GOOD (0), NEUTRAL (1) or EVIL (2).
1376 bool Destroyable(void)
1378         Self-explanatory. Usually true for quest items.
1380 bool Fly(uchar Direction, ushort Force, stack* Start, bool Hostile = true)
1382         Handles all aspects of getting an item up to the air from
1383         the Start stack, flying it all the way in the specified
1384         Direction as long as there's Force to hold it above
1385         ground. If Hostile is true, any character that the item
1386         passes during its flight will become hostile, even if not
1387         hit. If the item flew to nowhere, i.e. it landed on the square
1388         of former lift off, false is returned.
1390 bool HitCharacter(character* Dude, float Speed, bool CanBeSeen)
1392         Called by Fly. This does not actually hit the character,
1393         but test whether the item was catched, missed the character
1394         or hit him/her/it, and calls respective character functions.
1395         True is returned if the item's movement was stopped.
1397 ushort PrepareForConsuming(character* Consumer, stack* Stack)
1399         Called before consuming items, this must return the index of
1400         item-to-be-consumed in Stack, or 0xFFFF if it isn't there.
1402 float GetWeaponStrength()
1404         Calculates the weaponstrength of the item based on its form
1405         modifier and materials.
1407 DrawToTileBuffer()
1409         Calls PositionedDrawToTileBuffer(CENTER).
1411 vector GetInHandsPic()
1413         Retrieves the human.pcx coordinates of the picture that is
1414         maskedblitted above any humanoid wielding that particular item.
1416 uchar GetConsumeType()
1418         Returns its main material's consumetype.
1420 ushort TryToOpen(stack* Stack)
1422         Tries to open the item, places whatever was removed from inside
1423         it to Stack, and returns the index of the new item in it.
1425 ushort GetArmorValue()
1427         Returns a number from 1-100, which is a percentage that any
1428         damage caused to the creature wearing this item must be
1429         multiplied by.
1431 bool IsHeadOfElpuri()
1432 bool IsPerttusNut()
1433 bool IsMaakotkaShirt()
1435         Self-explanatory.
1437 ReceiveHitEffect(character* Enemy, character*)
1439         Called after a succesful hit, this handles special effects
1440         that occur when this item hits Enemy, excluding damage.
1442 bool CanBeDippedInto(item*)
1444         Returns whether this item can be dipped into anything.
1446 DipInto(item* DipTo)
1448         Dips this to DipTo.
1450 material* BeDippedInto()
1452         Returns some dipping material for purposes of DipInto.
1454 bool CanBeDipped()
1456         Can this item be dipped? Don't ask how it differs from
1457         CanBeDippedInto, though ;)
1459 bool CanBeWorn()
1461         Self-explanatory.
1463 SMaterial(ushort Where, material* What)
1465         Sets material of index Where to What.
1467 item* BetterVersion()
1469         Returns a better version of the item for magical
1470         transformations.
1472 ImpactDamage(ushort, bool IsShown, stack* ItemStack)
1474         Function that is applied to the item itself when it hits something
1475         solid, like a wall.
1477 float OfferModifier()
1479         Value of all sacrifices of this type is multiplied by this number.
1481 long Score()
1483         Bonus that is added to player's score when the game ends with this
1484         item in his/her/its inventory (before victory modifiers).
1486 bool DogWillCatchAndConsume()
1488         If thrown at it.
1490 uchar GetDipMaterialNumber()
1492         Returns the index of dipping material. Currently not used.
1494 item* Clone()
1496         Clones the item. Used by the prototype system.
1498 item* Load(std::ifstream* SaveFile)
1500         Loads an item of same type from SaveFile. Used by the prototype
1501         system.
1503 ushort Possibility()
1505         Item's possibility to appear randomly in the dungeon. Zero for
1506         none. The true possibility is this Possibility divided by
1507         the total sum of Possibilities of all item types.
1509 bool CanBeWished()
1511         Self-explanatory.
1513 item* CreateWishedItem()
1515         If wishing this item will yield a different type item,
1516         return it from here. If not, return zero.
1518 bool Apply(character* User)
1520         Self-explanatory.
1522 ushort CFormModifier()
1524         Multiplier applied when calculating weaponstrength of the item.
1526 level (level.h)
1527 ---------------
1529 A basic dungeon level consisting of levelsquares, derived from area.
1531 Functions:
1533 level(ushort XSize, ushort YSize, ushort Index)
1535         Creates an empty level of specified size. All squares are initialized
1536         to dungeon wall squares. Index must be the level's index in game's
1537         level array.
1539 ~level()
1541         Destroys the level and deletes all it's contents.
1543 ExpandPossibleRoute(const vector Origo, const vector Target,
1544                     const bool XMode)
1546         Used by the route system, this is a recursive function that sets the
1547         ON_POSSIBLE_ROUTE flag for the Origo square, calculates the direction
1548         where Target is from Origo's point of view, and calls itseld again
1549         with that square as the Origo, if the ON_POSSIBLE_ROUTE and the
1550         FORBIDDEN flag are NOT set on it. If either is, however, it tries
1551         the closest direction, or not-so-closest if it is also blocked. If
1552         all directions are blocked, it just returns. When calculating the
1553         order of directions to be tried out, diagonal directions are always
1554         ignored, directions changing the x-coordinate are preferred if XMode
1555         is set, and vice versa. The process is terminated immediately when the
1556         ON_POSSIBLE_ROUTE flag is set in Target square.
1558 ExpandStillPossibleRoute(const vector Origo, const vector Target,
1559                          const bool XMode)
1561         Same as above, except this toggles on the STILL_ON_POSSIBLE_ROUTE flag
1562         for each square it touches, and ON_POSSIBLE_ROUTE must be set
1563         and STILL_ON_POSSIBLE_ROUTE must not be set on all of these squares.
1565 GenerateTunnel(const vector From, const vector Target, const bool XMode)
1567         Generates a tunnel from From to Target, in the following way:
1568         First it calls ExpandPossibleRoute with From as the Origo,
1569         and then goes through all squares with ON_POSSIBLE_ROUTE flag set,
1570         removing the flag and trying if ExpandStillPossibleRoute()
1571         still can reach the Target. Alluseless squares on the path are
1572         removed and those that are essential changed to walkable floor.
1573         This is a slow, but guaranteed way to reach the target. Target and
1574         XMode are passed to all Expands called.
1576 PutStairs(const vector Pos)
1578         Puts stairs to specified Pos and adds it to level's KeyPoint array.
1580 Generate()
1582         Generates the level using the only currently implemented generation
1583         algorithm. It creates a random amount of rooms via MakeRoom(),
1584         attaches all KeyPoints to the main dungeon via AttachPos() and
1585         randomizes the level's initial items.
1587 AttachPos(const vector What)
1589         Attaches the square on coordinates What to the main dungeon
1590         via GenerateTunnel().
1592 CreateRandomTunnel()
1594         Creates a random tunnel, attached to the main dungeon but
1595         ending to a completely random place (except rooms of course).
1596         Currently not used by the generation code.
1598 CreateItems(const ushort Amount)
1600         Self-explanatory. The items are generated via
1601         game::BalancedCreateItem().
1603 CreateMonsters(const ushort Amount)
1605         Self-explanatory. Currently not used.
1607 vector CreateDownStairs()
1609         Creates downstairs to a random but sensible position, attaches
1610         it, calls PutStairs on the level beneath, and returns the position
1611         of these new stairs.
1613 bool MakeRoom(const vector Pos, const vector Size,
1614               const bool AltarPossible = true, uchar DivineOwner = 0)
1616         Creates a room to the level. Pos marks the upper left corner of the
1617         room. Size includes walls, so smaller than (3,3) rooms are not made.
1618         Function checks that it won't be too close to borders and is neither
1619         above any other rooms, stairs, vital tunnels and such. When the room
1620         is made, a door is created for it, added to the level's Door dynarray
1621         and attached to some other random door. If AltarPossible is true,
1622         an altar of random alignment may be created in the room. If
1623         DivineOwner is non-zero, no prayer can be made in the room except
1624         to the deity of that particular index. The function returns true
1625         if the room was made successfuly.
1627 HandleCharacters()
1629         Sends all squares a command to handle their characters.
1631 EmptyFlags()
1633         Empties the Flag boolean of every square on the level.
1635 PutPlayer(const bool)
1637         Puts player into a random, walkable position on the level.
1639 PutPlayerAround(vector Pos)
1641         Puts player on a walkable position somewhere around Pos.
1643 Save(std::ofstream* SaveFile)
1645         Self-explanatory.
1647 level(std::ifstream* SaveFile, ushort Index)
1649         Creates a level and loads its contents from SaveFile. Index must be
1650         the level's index in game's level array.
1652 Luxify()
1654         Calls the Emitate function of all squares.
1656 FastAddCharacter(vector Pos, character* Guy)
1658         Adds Guy to Pos, without updating lights.
1660 Draw()
1662         Draws the level and it's contents. Or at least those that are not
1663         outside the borders of the display screen.
1665 UpdateLOS()
1667         When this is called, if any given square on the level is currently seen
1668         by the player, its Flag is set to true, otherwise false.
1670 GenerateNewMonsters(ushort HowMany)
1672         See CIdealPopulation(). Uses game::BalancedCreateMonster() as its
1673         monster generator.
1675 levelsquare* CLevelSquare(vector Pos)
1677         Self-explanatory.
1679 dynarray<vector, uchar>* CKeyPoint()
1681         Returns a pointer to the KeyPoint dynarray.
1683 ushort CPopulation()
1685         Returns roughly the total amount of character's on the level.
1687 ushort CIdealPopulation()
1689         If CPopulation() is below this, GenerateNewMonsters() will advance
1690         it towards this when called.
1692 bitmap* CFluidBuffer()
1694         Returns a pointer to the FluidBuffer, where blood, vomit and such
1695         are stored.
1697 levelsquare (lsquare.h)
1698 -----------------------
1700 A square that appears in levels only and has some special procedures
1701 like lighting that plain squares don't have a chance to enjoy of.
1702 Derived from square.
1704 Functions:
1706 levelsquare(level* MotherLevel, vector Pos)
1707 ~levelsquare()
1709         Construct and destruct the levelsquare. MotherLevel is the level
1710         where the square is located and Pos is its position in it.
1712 HandleCharacters()
1714         Command its Character to Act().
1716 SignalEmitationIncrease(ushort EmitationUpdate)
1717 SignalEmitationDecrease(ushort EmitationUpdate)
1718 ushort CalculateEmitation()
1719 Emitate()
1720 ReEmitate()
1721 Noxify()
1722 ForceEmitterNoxify()
1723 ForceEmitterEmitation()
1724 NoxifyEmitter()
1725 uchar CalculateBitMask(vector Dir)
1726 AlterLuminance(vector Dir, ushort AiL)
1727 ushort CLuminance()
1729         See "light.txt".
1731 DrawToTileBuffer()
1733         Draws everything on the square to the TileBuffer, with the
1734         exception of the Character.
1736 UpdateMemorizedAndDraw()
1738         Self-explanatory.
1740 bool Open(character* Opener)
1741 bool Close(character* Closer)
1743         Pass these commands to overterrain, and return whatever the return.
1745 bool Save(std::ofstream* SaveFile)
1747         Saves the square to SaveFile.
1749 levelsquare(level* MotherLevel, std::ifstream* SaveFile, vector Pos)
1751         Creates and loads the levelsquare. See the normal constructor for
1752         parameter info.
1754 SpillFluid(uchar Amount, ulong Color, ushort Lumpiness = 3,
1755            ushort Variation = 32)
1757         Spills some liquid substance to the square, creating little
1758         puddles of specified Color to its position in MotherLevel's
1759         FluidBuffer. Amount is the amount of these puddles, Lumpiness
1760         influences their size (bigger means, roughly, bigger, but in
1761         no occasion larger than 3x3), and Variation affects the color
1762         variation across them.
1764 AddCharacter(character* Guy)
1766         Adds Guy onto the square and updates lightning if necessary.
1768 FastAddCharacter(character* Guy)
1770         Adds Guy onto the square but never updates lights.
1772 Clean()
1774         Deletes the entire contents of the square's Stack and SideStacks.
1776 RemoveCharacter()
1778         Removes the Character currently standing on the square, updating
1779         light if necessary. (Character isn't deleted, just set to zero)
1781 UpdateItemMemory()
1783         Updates RememberedItems, that is, a short text containing a
1784         description of what is lying on the square, like "many items".
1786 CanBeSeen()
1788         Returns whether this square can be seen by the player.
1790 Kick(ushort Strength, uchar KickWay)
1792         Called when the contents of square is kicked. Forwards parameters
1793         to Stack.
1795 bool CanBeSeenFrom(vector FromPos)
1797         Self-explanatory.
1799 SRememberedItems(std::string What)
1800 std::string CRememberedItems()
1802         Set RememberedItems (see UpdateItemMemory()) to What and
1803         return them.
1805 bool Dig(character* DiggerCharacter, item* DiggerItem)
1807         Called when DiggerCharacter tries to dig the square with
1808         a pick-axe or similiar as DiggerItem. Returns whether
1809         this was successful or not.
1811 char CanBeDigged(character* DiggerCharacter, item* DiggerItem)
1813         Quite obvious. Returns zero or two if it isn't, one if it is.
1815 stack* CStack()
1817         Returns a pointer to the square's primary stack.
1819 EmptyFlag()
1820 SetFlag()
1821 bool RetrieveFlag()
1823         Flag handlers. Flag determines whether the player can
1824         currently see the square.
1826 stack* CSideStack(uchar Index)
1828         Returns a pointer to the wanted SideStack, that is a stack
1829         attached to the side of an impassable square. Index must
1830         be either DOWN (0), LEFT (1), UP (2) or RIGHT (3).
1832 ushort CEmitation()
1833 SEmitation(ushort What)
1835         Returns and sets Emitation, which is used as a backup
1836         emitation value from the last call to CalculateEmitation().
1837         See "light.txt".
1839 std::string CEngraved()
1841         Returns whatever is engraved here, or "" if there's nothing.
1843 bool Engrave(std::string What)
1845         Sets the Engraved string to What and returns true.
1847 uchar CDivineOwner()
1848 SDivineOwner(uchar NDO)
1850         Return and set the DivineOwner, which is the index of the owner
1851         deity in the divine god array, or zero for none. No other
1852         god can be prayed upon on this particular square.
1854 level* CMotherLevel()
1856         Return a pointer to the level where the square is.
1858 levelsquare::emitter (lsquare.h)
1859 --------------------------------
1861 Emitter is a simple struct that contains information about an emitter,
1862 which is shedding light upon a particular levelsquare. See "light.txt"
1863 for more knowledge about emitters.
1865 Functions:
1867 emitter(vector Pos, ushort DilatedEmitation)
1869         Creates a new emitter with the given attributes.
1871 emitter()
1873         Creates an unitialized new emitter.
1875 bool operator==(emitter& AE)
1877         Operator for comparing two emitters. Doesn't care about anything
1878         else than the Pos vector.
1880 emitter& operator=(emitter& AE)
1882         Copies all data from AE to the emitter.
1884 terrain (terrain.h)
1885 -------------------
1887 Terrain includes every terrain type from walls to altars. The class is divided
1888 to two larger sub-classes overterrain and groundterrain.
1890 Functions:
1892 bool CanBeDigged()
1894         Returns true if the square can be digged.
1896 bool CanBeOffered()
1898         Returns true if the terrain is capable of accepting offering.
1900 bool CanBeOpened()
1902         Returns true if the terrain can be opened.
1904 levelsquare* CLevelSquareUnder()
1906         Returns the levelsquareunder which currently means using CSquareUnder()
1907         and converting the resulting pointer into a levelsquare pointer.
1909 bool Close(character* Closer)
1911         Look at Open(character* Opener)
1913 vector CPos()
1915         Returns the position of the terrain.
1917 square* CSquareUnder()
1919         Returns the square under this particular terrain.
1921 uchar CVisualFlags()
1923         Returns the Visual Flags
1925 terrain(material** Material2, vector)
1927         Constructor of terrain. Material2 is the pointer to the pointer of
1928         the material and vector is not used.
1930 SSquareUnder(square* Square)
1932         Square is placed in SquareUnder
1934 bool Open(character* Opener)
1936         Tries to open the terrain. The function return true if the square could
1937         be opened and false if not. Opener is the pointer to the character that
1938         is trying  to open the terrain.
1940 HandleVisualEffects()
1942         Randomizes the plausible visual flags on.
1944 uchar OKVisualEffects()
1946         Returns the Visual Flags that can be set for the current square.
1948 groundterrain (terrain.h)
1949 -------------------------
1951 Basic ground terrain, like a floor. Drawn below overterrain. Functions don't
1952 differ from terrain in any way.
1954 overterrain (terrain.h)
1955 -----------------------
1957 This is positioned above groundterrain during the draw. I will list
1958 differences to terrain.
1960 Functions:
1962 CIsWalkable()
1964         Returns true if the square is walkable, else false.
1966 uchar COwnerGod()
1968         Returns the index of the owning god.
1970 MakeNotWalkable()
1971 MakeWalkable()
1973         Names of the functions tell everything.
1975 overterrain(material** Material, vector BitmapPos, bool IW)
1977         Create the overterrain. Material is a pointer to the pointer of
1978         the staring material, BitmapPos is discarded and IW tells whether
1979         the square is walkable or not (true = walkable).
1981 ShowDigMessage(character* Who, item*)
1983         Adds a message explaining the user if the terrain can be digged and
1984         whether the digging is successful or not. Who is the digger and item*
1985         is pointer to the item that is used for digging.
1987 square (square.h)
1988 -------------------
1990 A rectangular area on the level, the smallest indivisible place where
1991 individual terrains, characters and such can be contained.
1993 Functions:
1995 square(area* MotherArea, vector Pos)
1997         Constructor for square. MotherArea is the area in which the square is 
1998         created in. Position is the square's position.
2000 Save(std::ofstream* SaveFile)
2002         Saves the square to SafeFile.
2004 square(area* MotherArea, std::ifstream* SaveFile, vector Pos)
2006         Constructor for square. MotherArea is the area in which the square is
2007         created in. SaveFile is the file from which the square should be
2008         loaded from. Pos is the square's position.
2010 DrawCheat()
2012         Blits the square to the tilebuffer using the "see whole map" cheat.
2014 DrawMemorized()
2016         Draws the square from the players "memory".
2018 AddCharacter(character* Guy)
2020         Guy points to a character that should be added to the square. The
2021         name of this function is slightly misleading, because a square
2022         can currently have only 1 character.
2024 RemoveCharacter()
2026         Removes the character in the square. (however the character is not 
2027         deleted, the pointer is only set to 0)
2029 ChangeTerrain(groundterrain* NewGround, overterrain* NewOver)
2031         Changes the terrains of the square.
2033 SCharacter(character* What )
2035         Character is replaced with What.
2037 character* CCharacter(void)
2039         Returns the Character currently standing (or whatever) on the square.
2040         Zero means there is no one there.
2042 bool CKnown()
2044         Returns true if the square is known to the player otherwise the
2045         function return false. If Known is false, the square will not be
2046         drawn on the screen.
2048 vector CPos(void)
2050         Return the potion of the square as a vector.
2052 SKnown(bool What)
2054         Changes the Known-status of the square to What. If Known is false,
2055         the square will not be drawn on the screen.
2057 SOverTerrain(overterrain* What)
2059         Changes the OverTerrain to What.
2061 ushort CPopulation(void)
2063         Returns the amount of characters in the square. (currently 1 or 0)
2065 SGroundTerrain(groundterrain* What)
2067         Changes the GroundTerrain to What.
2069 SOverTerrain(overterrain* What)
2071         Changes the OverTerrain to What.
2073 area* CMotherArea(void)
2074         Returns the pointer to the area where the square is.
2076 ushort CPopulation(void)
2077         Returns the amount of characters in the square. (currently 1 or 0)
2079 material (material.h)
2080 ---------------------
2082 Material is a class for handling effects that depend on the material type
2083 and amount of some part of an individual object.
2085 Functions:
2087 material(ulong Volume)
2089         Constructor of material. Volume is volume of the material to be
2090         created.
2092 material(std::ifstream* SaveFile)
2094         Loads material's data from SaveFile. 
2096 uchar CFleshColor(void)
2098         Returns the color of the material when it is used as flesh.
2100 uchar CItemColor(void)
2102         Returns the color of the material when it is used as a material for
2103         an item.
2105 std::string Name(uchar Case = 0)
2107         Returns the whole name of the material, according to
2108         Case, which can be either of the following:
2110         UNARTICLED (0)  no article is ever added
2111         INDEFINITE (6)  "a" or "an" is (usually) added to the name
2113 ushort GetHitValue()
2115         Returns the hitvalue of the item, which increses the weaponstrength
2116         of an item made of it.
2118 uchar CConsumeType()
2120         Returns the consume type of the item.
2122 ulong CVolume()
2124         Returns the volume of the material.
2126 ulong CWeight()
2128         Returns the weight of the material.
2130 ushort GetDensity()
2132         Returns the density of the material.
2134 uchar EffectType()
2136         Returns the type of effect this material has on a character.
2138 ushort Type()
2140         Return the type of the item. Note: this is evil, so don't use this
2141         outside the save system if possible.
2143 ushort TakeDipVolumeAway()
2145         Takes some of the volume of the item away and then returns
2146         the volume of the material that has been taken away.
2148 void Save(std::ofstream* SaveFile)
2150         Saves the material into SaveFile.
2152 ushort CArmorValue(void)
2154         Returns the armor value of the material. See item::GetArmorValue().
2156 SVolume(ulong What)
2158         Volume of the material is set to What.
2160 ushort CEmitation(void)
2162         Returns the light emitation of the material. See "light.txt".
2164 ushort OfferValue(void)
2166         The value of offering this material a gram.
2168 uchar Alignment(void)
2170         Returns the alignment of this material. Affects value of offers.
2171         Possible alignments are:
2172                 GOOD    (1)
2173                 NEUTRAL (2)
2174                 EVIL    (3)
2176 EatEffect(character* Eater, float Amount, float NPModifier)
2177         Eater recives an eat effect of this material.
2178         Amount is the percent of the whole Volume that 
2179         the character has eaten. NPModifier is a number
2180         that is used to multiply the actual amount, which
2181         is used by some items.
2184 HitEffect(character* Enemy)
2186         If the material somehow affects the Enemy then this function handles
2187         it.
2189 short NutritionValue()
2191         Returns the nutrion value of the item. The amount is
2192         in NPs per 1000 grams. 
2194 MinusAmount(float Amount)
2195         decreases the volume of the material by Amount percent.
2197 NormalFoodEffect(character* Eater, float Amount, float NPModifier)
2199         Eater reseives the normal food effect. Amount is the percent of the
2200         volume that is going to be eaten and NPModifier is floating point
2201         number that is used to multiply this volume. NPModifier is used by
2202         some items.
2204 prototypecontainer<class ProtoType> (proto.h)
2205 ---------------------------------------------
2207 A template class that contains a prototype vector, an array of type
2208 ProtoType* including a pointer to each and every concrete class derived
2209 from ProtoType. The first and last elements must always be zero.
2210 Used by the game's generation and save systems.
2212 Functions:
2214 prototypecontainer()
2216         Creates the container and sets its first element to zero.
2218 Add(const ushort Index, ProtoType* Proto)
2220         Adds Proto to the position determined by Index, resizing the
2221         array and setting its last element to zero if obligatory.
2223 const ProtoType* const Access(ushort Index) const
2224 const ProtoType* const operator [] (ushort Index) const
2226         Returns the prototype of specified Index, so that inspectors
2227         like cloning functions and such may be called through it.
2229 worldmapsquare (wsquare.h)
2230 --------------------------
2232 A square that appears on the worldmap only and WILL have some
2233 special routines like handling border tiles while drawing terrain
2234 etc. that its sister, levelsquare, doesn't have. Functions
2235 are so highly under construction that they won't be documented.
2237 stack (stack.h)
2238 ---------------
2240 stack(square* SqureUnder)
2242         Stack's constructor. SquareUnder is surprisingly the square
2243         under the stack.
2245 stack(std::ifstream* SaveFile)
2247         Saves the stack to SaveFile.
2249 PositionedDrawToTileBuffer(uchar LevelSquarePosition)
2251         Draws the stack to the right place on the TileBuffer.   
2252         LevelSquarePosition is passed to item::PositionedDrawToTileBuffer().
2253         Refer to it if you need to know what it does.
2255 ushort AddItem(item* ToBeAdded)
2257         Adds ToBeAdded to the stack and then returns the index of ToBeAdded.
2258         Updates lights if needed.
2260 ushort FastAddItem(item* ToBeAdded)
2262         Same as the above, but does not update lights.
2264 item* RemoveItem(ushort Index)
2266         Removes item number Index and then returns a pointer to that item.
2267         Updates lights if needed.
2269 FastRemoveItem(ushort Index)
2271         Just removes the number Index item and does not update lights.
2273 Clean()
2275         Deletes all items of the stack.
2277 ushort MoveItem(ushort Index, stack* MoveTo)
2279         Moves item number Index to the stack that MoveTo is pointing at.
2280         Then returns the new index of the item in question. Updates
2281         lights if needed.
2283 Optimize(ushort OptimizeBoundary)
2285         Optimizes the stack if there are more than OptimizeBoundary
2286         zero pointers. Optimizing means all of these are removed.
2287         Note: The game does not support zero pointers correctly.
2288         Use zero as the OptimizeBoundary always!
2290 ushort DrawContents(const char* Topic)
2292         Draws the contents on the screen as a neatly organized list and
2293         waits for keypress. The Topic is also displayed on the screen.
2294         The list uses list::Draw and returns the same things as it does.
2296 ushort CEmitation()
2298         Returns the total emitation of all the items in the stack.
2300 ulong stack::SumOfMasses()
2302         Returns the sum of the masses in this stack.
2304 Save(std::ofstream* SaveFile)
2306         Saves the stack in SaveFile.
2308 stack::stack(std::ifstream* SaveFile)
2310         Constructor of stack that loads itself from SaveFile.
2312 ushort SearchItem(item* ToBeSearched)
2314         Searches for item ToBeSearched in the stack and then returns its
2315         index, or 0xFFFF if it was not found.
2317 void stack::Move(levelsquare* To)
2319         Moves the whole stack to levelsquare To and updates lights if
2320         necessary.
2322 vector CPos(void)
2324         Returns the position of the stack.
2326 ushort ConsumableItems(character* Eater)
2328         Returns the number of consumable items (for Eater).
2330 ushort DrawConsumableContents(const char* Topic, character* Eater)
2332         Makes a list out of the consumable items (for Eater) and then returns what ever
2333         list::Draw() returns. 
2335 DeletePointers()
2337         All pointers to items are set to 0
2339 ushort FindItem(item* ToBeSearched)
2341         Returns the index of ToBeSearched, or 0xFFFF if it isn't found in the stack.
2343 Kick(ushort Strength, bool ShowOnScreen, uchar Direction)
2345         Strength is the strength of the kick. If ShowOnScreen is true kick messages are
2346         displayed on screen. Direction is the vector in which direction the kick is going. 
2348 long Score()
2350         Calculates the total score value of all the items in the stack.
2352 SSquareUnder(square* Square)
2354         SquareUnder is set to Square.
2356 item** CItem()
2358         A pointer to the item* array.
2360 item* CItem(ushort I)
2362         Returns a pointer to the item which has the index of I.
2364 ushort CItems(void)
2366         Returns the number of items in this stack.
2368 levelsquare* CLevelSquareUnder(void)
2370         Returns the pointer to the levelsquare under the stack.
2372 SEmitation(ushort What)
2374         Sets the Emitation to What.
2376 ushort CNonExistent()
2378         Returns the amount of pointers (which is stored in NonExistent) that are 0.
2380 SNonExistent(ushort What)
2382         Sets NonExistent to What.
2384 object (object.h)
2385 -----------------
2387 A basic object is build up from different materials. Derived from independency.
2389 Functions:
2391 object()
2393         The default constructor which doesn't do anything.
2395 object(std::ifstream* SaveFile)
2397         Creates and loads the object from SaveFile.
2399 Save(std::ofstream* SaveFile)
2401         Saves the object to SaveFile.
2403 InitMaterials(ushort Materials, ...);
2405         Initilizes Materials-amount of materials.
2407         Example: InitMaterials(2, Material2, Material3)
2408         where Material2 and Material3 are pointers to 
2409         materials.
2411 InitMaterials(material* FirstMaterial)
2413         Initilize only material FirstMaterial.
2415 ushort CEmitation()
2417         Returns the emitation of the object.
2419 std::string NameArtifact(uchar Case, uchar DefaultMaterial)
2420         
2421         Returns the name of the item like an artifact type of item.
2422         DefaultMaterial is the Index of the normal material from which 
2423         this object is made up. If its made of something else,
2424         the material name is shown, otherwise not.
2426 std::string NameWithMaterial(uchar Case)
2428         Returns the name of the object with the name of Material[0]
2429         attached. (Case works like case normally works.)
2431 std::string NameHandleDefaultMaterial(uchar Case, std::string Article,
2432                                       uchar DefaultMaterial)
2434         If the material is the DefaultMaterial this function returns what
2435         ever NameNormal returns with Case and Article as parameters. If the
2436         material is not the Default Material this function returns what
2437         NameWithMaterial returns with Case as parameter.
2439 std::string object::NameContainer(uchar Case)
2441         Returns the name of a container object (for example: cans). Case works
2442         like case normally works.
2444 std::string NameSized(uchar Case, std::string Article, ushort LillaBorder, 
2445                       ushort StoraBorder)
2447         Returns the name of item with size categorizing adjectives. 
2448         Case works like case normally works. Article is the article
2449         for this. LillaBorder is the maximum size for the object
2450         to be considered small. StoraBorder is the maximum size
2451         for an object to be considered large.
2453 std::string NameThingsThatAreLikeLumps(uchar Case, std::string Article)
2455         Case works like case normally works. Article is the possible article.
2457 EraseMaterials(void)
2459         Deletes all materials from this object.
2461 material* CMaterial(ushort Index)
2463         Returns the material that has the index of Index.
2465 ushort CSize()
2466         
2467         Returns the size of the object.
2469 ushort CMaterials(void)
2470         
2471         Returns the number of materials in this object.
2473 ----------------------------------------------------------------------------
2475 End of document.