nexus/save.c

1138 lines
28 KiB
C
Raw Normal View History

2010-12-07 18:34:26 +11:00
#include <assert.h>
2010-12-02 12:17:54 +11:00
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
2011-02-01 06:16:13 +11:00
#include <unistd.h>
#include <sqlite3.h>
2010-12-02 12:17:54 +11:00
#include "defs.h"
2011-02-01 06:16:13 +11:00
#include "flag.h"
#include "io.h"
2010-12-02 12:17:54 +11:00
#include "lf.h"
#include "map.h"
#include "move.h"
#include "nexus.h"
#include "objects.h"
#include "save.h"
* [+] make vending machines use this container code instead. - [+] don't say "you see a few things" if one of them is footsteps * [+] IFMONSTER code failing....because flags are now SORTED!!! - [+] tumble - askcoords is letting us pick a cell we don't have lof to. * [+] assign a name to lfs once you hire them * [+] coloured msgtext - [+] make min dam reduction from AR be AR/5. - [+] safebox - [+] if intelligent, prompt before walking into RESTRICTMOVEMENT with no getsweaker (val1) * [+] make fire / ice damage mor elike netheck - [+] towns should have gates on EVERY side - [+] forest cells outside town gates need to be CLEARED. (maybe turn to dirt) - [+] fix up knock targetting to include magical barriers - [+] say "open a bag?" not "operate a bag?" * [+] implement immunetodisease - [+] sort known skills in @s. - [+] better damage bonus when attacking someone who is asleep - [+] practive firearms/throwing * [+] need objecttype->size * [+] containers * [+] change guns so you have to reload them. ("operate") - [+] crash when loading map with water - [+] SAVE OBJECT CONTENTSk - [+] monsters with jobs aren't getting start items - [+] shopkeeper has shotgun - [+] bug: monster keeps swapping between shotgun and flail - [+] when hiring, remember failure. * [+] Inn - [+] bug: pets fighting!!! then they all turn on you. never make allies get angry unless the attacker is the player * [+] hiring npcs - [+] chat to pet: "stay close" or "keep your distance" - [+] new 'furniture' obclass - [+] allow for 'randomshop' regiontype * [+] add enchantment school - [+] cast a scroll of mending on itself. CRASH. * [+] lessengravity should make you jump better and get knocked back further - [+] boostgrav/lessengrav cancel out each other. * [+] CRASH when you fall down a hole and die. - [+] problem: master gravitation doesn't let us cast levitat. getspellschoolknown() should return the HIGHEST known skill, not the first. * [+] bug: dregion is null?!??! * [+] dig a pit, if you cleared out land below, you just stay down there. - [+] potion of leveitation - [+] warning msg when levitate is about to expire * [+] if you fall upwards to the surface... * [+] if you are ever on the surface while levitating.... - [+] BUG: cna't go up stairs to surface anymore!!!!! - [+] get hungry LOTS more quickly when you start sprinting * [+] monk slow metabolism psionic pell. - [+] fix buf with lore giving LESS accuracy instead of more. - [+] food shop - [+] wand of digging not identified if you dig upwards * [+] when you make ah ole in the roof, objects above should fall through right away * [+] all towns should have: - [+] give monks more psionics spells. - [+] sk_throwing skill - [+] make calm animals use spellpower * [+] add wisdom * [+] need to save region data along with maps * [+] COMBINE armour evasion and accuracy penalty!!! * [+] make armour reduce accuracy as well (unless you have 'armour' skill) - [+] landmine trap * [+] make friendly monsters of same raceclass swap ammo - [+] rename 'pull' to 'suck' to avoid confusion with pull metal * [+] food to fix blindness - [+] potion of coffee * [+] genericise statbrackets * [+] tumble ability * [+] simplify spell power * [+] shopkeeprs should be allowed to pursue targets outside of the shop. - [+] give shopkeepers a shotgun * [+] make F_RNDHOSTILE be able to ahve a random chance. * [+] if you randomly generate food in a shop, still give it a price. - [+] if peaceful humanoid walks into you, "sorry!" - [+] sayphrase(lf, SP_SORRY, vol) - [+] only let you recruit jobs with j_recruitable - [+] CRASH - summon "monk" - [+] dogs, - [+] chickens, - [+] drunks, * [+] village objects - [+] change armourrating AGAIN. instead of a percentage, make it a number. - [+] rename inn to "pub", since you can't sleep there. * [+] random speech code * [+] genericise sayphrase text based on lf's job * [+] monks - add rest of abliities - [+] add fiengdeath ability to some monsters
2011-07-14 07:40:28 +10:00
#include "text.h"
- [+] thrown objects taking no damage due to hardness * [+] DIETY is slow. - [+] map bug - from 0,0, walk NE (off top edge). i end up at 0,0 again!!! * [+] ALLOW ROTATING OF VAULTS - [+] BUG: dig X only goes 1 cell. - [+] add a U shaped turn vault. - [+] change wehre i apply HADRNESS for lfs! - don't use adjustdammaterial cause we inherit there - [+] make obchance/thingchance part of habitat_t - [+] make sense surroundings take cartography skill into account * [+] BUG: rotated at() etc not working. - [+] if you fail stealing, the target should get angry!!! - [+] make sure to redraw stat bar when mind scan finishes. - [+] villages - [+] initial code * [+] town gaurds. stand next to the gate - [+] potion shop vault - [+] implement - [+] potion shop isn't getting potions!! - [+] and getting wrong floor type. * [+] stop shop from always being at the top left. - [+] make sure its x/y arent too close to edge of map (at least 5 away) - [+] vault param. f_mapmargin, 5 - [+] make calcroompos take x/y margin - [+] don't put auto obs inside vaults - [+] town walls - [+] more kinds of shops * [+] signs outside shops - [+] bug with ai swapping between firearms and twohanded weapons. fixed. * [+] make _CELLS_ have habitats! - [+] move vaultchance to a habitat param instead of getvaultchance() * [+] shopkeepers (special race) village things: - [+] barrels, - [+] guards, - [+] statue - [+] thrown objects should still take damage if blocked via a shield * [+] hardness (must do dam >= xx to hurt) * [+] WATER spread mods * [+] very powerful spells have casttime - [+] allow linkstairs() to take a parameter rather than always jsut searching for the other end - [+] when digging holes, only use getrandomadjcell if there is an lf in the way. and then use WE_NOLF. clear out solid cells - [+] show armour EVASION penalty in describeob - [+] teleportation trap. You reintegrate inside a solid object! You die.--More--. - [+] riverroom vault * [+] water: swap { and ~ again?? - [+] make "large puddle of water" evaporate more quickly * [+] special glyph case: for deep water
2011-06-29 18:48:48 +10:00
#include "vault.h"
2010-12-02 12:17:54 +11:00
2011-02-01 06:16:13 +11:00
extern long curtime;
2010-12-02 12:17:54 +11:00
extern lifeform_t *player;
extern map_t *firstmap;
2010-12-07 18:34:26 +11:00
extern knowledge_t *knowledge;
* [+] make vending machines use this container code instead. - [+] don't say "you see a few things" if one of them is footsteps * [+] IFMONSTER code failing....because flags are now SORTED!!! - [+] tumble - askcoords is letting us pick a cell we don't have lof to. * [+] assign a name to lfs once you hire them * [+] coloured msgtext - [+] make min dam reduction from AR be AR/5. - [+] safebox - [+] if intelligent, prompt before walking into RESTRICTMOVEMENT with no getsweaker (val1) * [+] make fire / ice damage mor elike netheck - [+] towns should have gates on EVERY side - [+] forest cells outside town gates need to be CLEARED. (maybe turn to dirt) - [+] fix up knock targetting to include magical barriers - [+] say "open a bag?" not "operate a bag?" * [+] implement immunetodisease - [+] sort known skills in @s. - [+] better damage bonus when attacking someone who is asleep - [+] practive firearms/throwing * [+] need objecttype->size * [+] containers * [+] change guns so you have to reload them. ("operate") - [+] crash when loading map with water - [+] SAVE OBJECT CONTENTSk - [+] monsters with jobs aren't getting start items - [+] shopkeeper has shotgun - [+] bug: monster keeps swapping between shotgun and flail - [+] when hiring, remember failure. * [+] Inn - [+] bug: pets fighting!!! then they all turn on you. never make allies get angry unless the attacker is the player * [+] hiring npcs - [+] chat to pet: "stay close" or "keep your distance" - [+] new 'furniture' obclass - [+] allow for 'randomshop' regiontype * [+] add enchantment school - [+] cast a scroll of mending on itself. CRASH. * [+] lessengravity should make you jump better and get knocked back further - [+] boostgrav/lessengrav cancel out each other. * [+] CRASH when you fall down a hole and die. - [+] problem: master gravitation doesn't let us cast levitat. getspellschoolknown() should return the HIGHEST known skill, not the first. * [+] bug: dregion is null?!??! * [+] dig a pit, if you cleared out land below, you just stay down there. - [+] potion of leveitation - [+] warning msg when levitate is about to expire * [+] if you fall upwards to the surface... * [+] if you are ever on the surface while levitating.... - [+] BUG: cna't go up stairs to surface anymore!!!!! - [+] get hungry LOTS more quickly when you start sprinting * [+] monk slow metabolism psionic pell. - [+] fix buf with lore giving LESS accuracy instead of more. - [+] food shop - [+] wand of digging not identified if you dig upwards * [+] when you make ah ole in the roof, objects above should fall through right away * [+] all towns should have: - [+] give monks more psionics spells. - [+] sk_throwing skill - [+] make calm animals use spellpower * [+] add wisdom * [+] need to save region data along with maps * [+] COMBINE armour evasion and accuracy penalty!!! * [+] make armour reduce accuracy as well (unless you have 'armour' skill) - [+] landmine trap * [+] make friendly monsters of same raceclass swap ammo - [+] rename 'pull' to 'suck' to avoid confusion with pull metal * [+] food to fix blindness - [+] potion of coffee * [+] genericise statbrackets * [+] tumble ability * [+] simplify spell power * [+] shopkeeprs should be allowed to pursue targets outside of the shop. - [+] give shopkeepers a shotgun * [+] make F_RNDHOSTILE be able to ahve a random chance. * [+] if you randomly generate food in a shop, still give it a price. - [+] if peaceful humanoid walks into you, "sorry!" - [+] sayphrase(lf, SP_SORRY, vol) - [+] only let you recruit jobs with j_recruitable - [+] CRASH - summon "monk" - [+] dogs, - [+] chickens, - [+] drunks, * [+] village objects - [+] change armourrating AGAIN. instead of a percentage, make it a number. - [+] rename inn to "pub", since you can't sleep there. * [+] random speech code * [+] genericise sayphrase text based on lf's job * [+] monks - add rest of abliities - [+] add fiengdeath ability to some monsters
2011-07-14 07:40:28 +10:00
extern region_t *firstregion,*lastregion;
extern regionoutline_t *firstregionoutline,*lastregionoutline;
2010-12-07 18:34:26 +11:00
extern enum GAMEMODE gamemode;
2010-12-02 12:17:54 +11:00
int loadall(void) {
DIR *dir;
struct dirent *ent;
* [+] fire should set equipped obs on fire too * [+] trapped doors/objcets * [+] make careful walking have less chance of triggering some traps (eg tripwire) - [+] dex penalty when drunk - [+] require dex to put on most shoes - [+] Diety's short sword of pyromania isn't appearing? - [+] make sure i can tumble over traps * [+] able to cut tripwires with slashing/chopping/piercing weapons? - [+] maybe make cmomando have no weapon skill - [+] make armour more common - [+] shouldnt be able to swap place with someone who is sleeping - [+] if you're not in the water, can't see lfs in water (unless they are adjacent) - [+] You break free from the zombie! You reintegrate inside a solid object!--More-- * [+] shopkeepers will charge an extra fee to identify stuff - [+] shouldn't get an empty flask when I dirnk from a fountain! - [+] identify and remove curse scrolls should be COMMON * [+] provide detailed skill descriptions - [+] dumpoutlines() - [+] make minotaurs stay in room - [+] make minotaurs have good smell - [+] don't auotreveal vaults. * [+] should be able to fill flasks from fountains - [+] don't announce corpse decay death while training. * [+] add the initial godstone at the bottom of firstdungeon * [+] make fountains names same as their linked potions - [+] bug: when filling potions from the ground, ground object was never dryaing up Beggars - [+] stealing ability sometimes. run away after using this * [+] various lots of generic f_talktext->"have a coin to spare?" World map - [+] 1-2,1-2: habitat: village - [+] multiple villages - [+] vault: island with treasure (or acid island?) - [+] jump into a water - it splashes small puddles to surrounding cells * [+] let dig spell go up/down. * [+] fountains, random potion effect or water (blue _ or }) - [+] make thingchance and obchance be habitat_t parameters. work on game goal - [+] find a way out of the magical dungeon barriers in the first dungeon - [+] slime - [+] troll = t - [+] lizardman - [+] ogre - [+] kobold - [+] fire sprite - [+] hobgoblin - [+] bugbear - [+] gnoll - [+] giant - [+] zombie - [+] skeleton * [+] ghoul - [+] ghast - [+] can operate spanner to - [+] jam/unjam a door * [+] visibility - [+] initial code for monsters opening doors while giving chase - [+] acid does more damage to armour * [+] implement temporary flags. * [+] implement unknown flags - [+] mana spike - [+] energy bolt - [+] energy blast (hits all in radius) - [+] flash (like flashbang) - [+] telekinesis (open/close doors remotely, grab/throw objects remotely) - [+] mindscan - knoweldge of hp etc * [+] airblast (push obs, push someone very far, AND lose obs. break walls they hit?) - [+] fireball - sets on fire - [+] flamepillar - [+] fire arrow - [+] spark (light a flammable object) - [+] flameburst - 2d8+3 damage in a circle - [+] burning wave - 2d10 damage and set on firea, line towards target - [+] range 3 - [+] freezing touch (turns an object to ice) - [+] knock - opens doors - [+] gas form - [+] polymorph - [+] write on floor - [+] light - [+] weaken (lose str) - [+] poison cloud - change cloudkill to this? - [+] animate dead - [+] posession - [+] minor healing - [+] healing - [+] turn undead - [+] identify - [+] detect magic - [+] detect aura - [+] reveal surroundings - [+] uncontrolled teleport - [+] speed - [+] slow - [+] boost gravity - [+] create monster - [+] divine - [+] wish
2011-07-21 11:43:45 +10:00
int db = B_FALSE;
2010-12-02 12:17:54 +11:00
gamemode = GM_LOADING;
2010-12-07 18:34:26 +11:00
2010-12-02 12:17:54 +11:00
dir = opendir(MAPDIR);
if (!dir) {
dblog("Could not open map directory '%s'",MAPDIR);
return B_TRUE;
}
* [+] make vending machines use this container code instead. - [+] don't say "you see a few things" if one of them is footsteps * [+] IFMONSTER code failing....because flags are now SORTED!!! - [+] tumble - askcoords is letting us pick a cell we don't have lof to. * [+] assign a name to lfs once you hire them * [+] coloured msgtext - [+] make min dam reduction from AR be AR/5. - [+] safebox - [+] if intelligent, prompt before walking into RESTRICTMOVEMENT with no getsweaker (val1) * [+] make fire / ice damage mor elike netheck - [+] towns should have gates on EVERY side - [+] forest cells outside town gates need to be CLEARED. (maybe turn to dirt) - [+] fix up knock targetting to include magical barriers - [+] say "open a bag?" not "operate a bag?" * [+] implement immunetodisease - [+] sort known skills in @s. - [+] better damage bonus when attacking someone who is asleep - [+] practive firearms/throwing * [+] need objecttype->size * [+] containers * [+] change guns so you have to reload them. ("operate") - [+] crash when loading map with water - [+] SAVE OBJECT CONTENTSk - [+] monsters with jobs aren't getting start items - [+] shopkeeper has shotgun - [+] bug: monster keeps swapping between shotgun and flail - [+] when hiring, remember failure. * [+] Inn - [+] bug: pets fighting!!! then they all turn on you. never make allies get angry unless the attacker is the player * [+] hiring npcs - [+] chat to pet: "stay close" or "keep your distance" - [+] new 'furniture' obclass - [+] allow for 'randomshop' regiontype * [+] add enchantment school - [+] cast a scroll of mending on itself. CRASH. * [+] lessengravity should make you jump better and get knocked back further - [+] boostgrav/lessengrav cancel out each other. * [+] CRASH when you fall down a hole and die. - [+] problem: master gravitation doesn't let us cast levitat. getspellschoolknown() should return the HIGHEST known skill, not the first. * [+] bug: dregion is null?!??! * [+] dig a pit, if you cleared out land below, you just stay down there. - [+] potion of leveitation - [+] warning msg when levitate is about to expire * [+] if you fall upwards to the surface... * [+] if you are ever on the surface while levitating.... - [+] BUG: cna't go up stairs to surface anymore!!!!! - [+] get hungry LOTS more quickly when you start sprinting * [+] monk slow metabolism psionic pell. - [+] fix buf with lore giving LESS accuracy instead of more. - [+] food shop - [+] wand of digging not identified if you dig upwards * [+] when you make ah ole in the roof, objects above should fall through right away * [+] all towns should have: - [+] give monks more psionics spells. - [+] sk_throwing skill - [+] make calm animals use spellpower * [+] add wisdom * [+] need to save region data along with maps * [+] COMBINE armour evasion and accuracy penalty!!! * [+] make armour reduce accuracy as well (unless you have 'armour' skill) - [+] landmine trap * [+] make friendly monsters of same raceclass swap ammo - [+] rename 'pull' to 'suck' to avoid confusion with pull metal * [+] food to fix blindness - [+] potion of coffee * [+] genericise statbrackets * [+] tumble ability * [+] simplify spell power * [+] shopkeeprs should be allowed to pursue targets outside of the shop. - [+] give shopkeepers a shotgun * [+] make F_RNDHOSTILE be able to ahve a random chance. * [+] if you randomly generate food in a shop, still give it a price. - [+] if peaceful humanoid walks into you, "sorry!" - [+] sayphrase(lf, SP_SORRY, vol) - [+] only let you recruit jobs with j_recruitable - [+] CRASH - summon "monk" - [+] dogs, - [+] chickens, - [+] drunks, * [+] village objects - [+] change armourrating AGAIN. instead of a percentage, make it a number. - [+] rename inn to "pub", since you can't sleep there. * [+] random speech code * [+] genericise sayphrase text based on lf's job * [+] monks - add rest of abliities - [+] add fiengdeath ability to some monsters
2011-07-14 07:40:28 +10:00
// load region outlines first.
if (loadregions()) {
// this isn't an error - just means no savegames
* [+] fire should set equipped obs on fire too * [+] trapped doors/objcets * [+] make careful walking have less chance of triggering some traps (eg tripwire) - [+] dex penalty when drunk - [+] require dex to put on most shoes - [+] Diety's short sword of pyromania isn't appearing? - [+] make sure i can tumble over traps * [+] able to cut tripwires with slashing/chopping/piercing weapons? - [+] maybe make cmomando have no weapon skill - [+] make armour more common - [+] shouldnt be able to swap place with someone who is sleeping - [+] if you're not in the water, can't see lfs in water (unless they are adjacent) - [+] You break free from the zombie! You reintegrate inside a solid object!--More-- * [+] shopkeepers will charge an extra fee to identify stuff - [+] shouldn't get an empty flask when I dirnk from a fountain! - [+] identify and remove curse scrolls should be COMMON * [+] provide detailed skill descriptions - [+] dumpoutlines() - [+] make minotaurs stay in room - [+] make minotaurs have good smell - [+] don't auotreveal vaults. * [+] should be able to fill flasks from fountains - [+] don't announce corpse decay death while training. * [+] add the initial godstone at the bottom of firstdungeon * [+] make fountains names same as their linked potions - [+] bug: when filling potions from the ground, ground object was never dryaing up Beggars - [+] stealing ability sometimes. run away after using this * [+] various lots of generic f_talktext->"have a coin to spare?" World map - [+] 1-2,1-2: habitat: village - [+] multiple villages - [+] vault: island with treasure (or acid island?) - [+] jump into a water - it splashes small puddles to surrounding cells * [+] let dig spell go up/down. * [+] fountains, random potion effect or water (blue _ or }) - [+] make thingchance and obchance be habitat_t parameters. work on game goal - [+] find a way out of the magical dungeon barriers in the first dungeon - [+] slime - [+] troll = t - [+] lizardman - [+] ogre - [+] kobold - [+] fire sprite - [+] hobgoblin - [+] bugbear - [+] gnoll - [+] giant - [+] zombie - [+] skeleton * [+] ghoul - [+] ghast - [+] can operate spanner to - [+] jam/unjam a door * [+] visibility - [+] initial code for monsters opening doors while giving chase - [+] acid does more damage to armour * [+] implement temporary flags. * [+] implement unknown flags - [+] mana spike - [+] energy bolt - [+] energy blast (hits all in radius) - [+] flash (like flashbang) - [+] telekinesis (open/close doors remotely, grab/throw objects remotely) - [+] mindscan - knoweldge of hp etc * [+] airblast (push obs, push someone very far, AND lose obs. break walls they hit?) - [+] fireball - sets on fire - [+] flamepillar - [+] fire arrow - [+] spark (light a flammable object) - [+] flameburst - 2d8+3 damage in a circle - [+] burning wave - 2d10 damage and set on firea, line towards target - [+] range 3 - [+] freezing touch (turns an object to ice) - [+] knock - opens doors - [+] gas form - [+] polymorph - [+] write on floor - [+] light - [+] weaken (lose str) - [+] poison cloud - change cloudkill to this? - [+] animate dead - [+] posession - [+] minor healing - [+] healing - [+] turn undead - [+] identify - [+] detect magic - [+] detect aura - [+] reveal surroundings - [+] uncontrolled teleport - [+] speed - [+] slow - [+] boost gravity - [+] create monster - [+] divine - [+] wish
2011-07-21 11:43:45 +10:00
if (db) dblog("No region data found.");
* [+] make vending machines use this container code instead. - [+] don't say "you see a few things" if one of them is footsteps * [+] IFMONSTER code failing....because flags are now SORTED!!! - [+] tumble - askcoords is letting us pick a cell we don't have lof to. * [+] assign a name to lfs once you hire them * [+] coloured msgtext - [+] make min dam reduction from AR be AR/5. - [+] safebox - [+] if intelligent, prompt before walking into RESTRICTMOVEMENT with no getsweaker (val1) * [+] make fire / ice damage mor elike netheck - [+] towns should have gates on EVERY side - [+] forest cells outside town gates need to be CLEARED. (maybe turn to dirt) - [+] fix up knock targetting to include magical barriers - [+] say "open a bag?" not "operate a bag?" * [+] implement immunetodisease - [+] sort known skills in @s. - [+] better damage bonus when attacking someone who is asleep - [+] practive firearms/throwing * [+] need objecttype->size * [+] containers * [+] change guns so you have to reload them. ("operate") - [+] crash when loading map with water - [+] SAVE OBJECT CONTENTSk - [+] monsters with jobs aren't getting start items - [+] shopkeeper has shotgun - [+] bug: monster keeps swapping between shotgun and flail - [+] when hiring, remember failure. * [+] Inn - [+] bug: pets fighting!!! then they all turn on you. never make allies get angry unless the attacker is the player * [+] hiring npcs - [+] chat to pet: "stay close" or "keep your distance" - [+] new 'furniture' obclass - [+] allow for 'randomshop' regiontype * [+] add enchantment school - [+] cast a scroll of mending on itself. CRASH. * [+] lessengravity should make you jump better and get knocked back further - [+] boostgrav/lessengrav cancel out each other. * [+] CRASH when you fall down a hole and die. - [+] problem: master gravitation doesn't let us cast levitat. getspellschoolknown() should return the HIGHEST known skill, not the first. * [+] bug: dregion is null?!??! * [+] dig a pit, if you cleared out land below, you just stay down there. - [+] potion of leveitation - [+] warning msg when levitate is about to expire * [+] if you fall upwards to the surface... * [+] if you are ever on the surface while levitating.... - [+] BUG: cna't go up stairs to surface anymore!!!!! - [+] get hungry LOTS more quickly when you start sprinting * [+] monk slow metabolism psionic pell. - [+] fix buf with lore giving LESS accuracy instead of more. - [+] food shop - [+] wand of digging not identified if you dig upwards * [+] when you make ah ole in the roof, objects above should fall through right away * [+] all towns should have: - [+] give monks more psionics spells. - [+] sk_throwing skill - [+] make calm animals use spellpower * [+] add wisdom * [+] need to save region data along with maps * [+] COMBINE armour evasion and accuracy penalty!!! * [+] make armour reduce accuracy as well (unless you have 'armour' skill) - [+] landmine trap * [+] make friendly monsters of same raceclass swap ammo - [+] rename 'pull' to 'suck' to avoid confusion with pull metal * [+] food to fix blindness - [+] potion of coffee * [+] genericise statbrackets * [+] tumble ability * [+] simplify spell power * [+] shopkeeprs should be allowed to pursue targets outside of the shop. - [+] give shopkeepers a shotgun * [+] make F_RNDHOSTILE be able to ahve a random chance. * [+] if you randomly generate food in a shop, still give it a price. - [+] if peaceful humanoid walks into you, "sorry!" - [+] sayphrase(lf, SP_SORRY, vol) - [+] only let you recruit jobs with j_recruitable - [+] CRASH - summon "monk" - [+] dogs, - [+] chickens, - [+] drunks, * [+] village objects - [+] change armourrating AGAIN. instead of a percentage, make it a number. - [+] rename inn to "pub", since you can't sleep there. * [+] random speech code * [+] genericise sayphrase text based on lf's job * [+] monks - add rest of abliities - [+] add fiengdeath ability to some monsters
2011-07-14 07:40:28 +10:00
return B_FALSE;
}
2010-12-02 12:17:54 +11:00
// for each map file in directory
while ((ent = readdir(dir)) != NULL) {
char *p;
// ie. start of 4 char prefix
p = ent->d_name + strlen(ent->d_name) - 4;
// load this map
if (!strcmp(p, ".map") ) {
if (!loadmap(ent->d_name)) {
printf("Error loading map from file '%s'",ent->d_name);
exit(1);
}
}
}
closedir(dir);
loadsavegame();
gamemode = GM_LOADED;
2010-12-07 18:34:26 +11:00
2010-12-02 12:17:54 +11:00
return B_FALSE;
}
2011-02-01 06:16:13 +11:00
int loadflagpile(FILE *f, flagpile_t *fp) {
flag_t tempflag;
flag_t *fl;
char buf[BUFLEN];
int rv;
* [+] make vending machines use this container code instead. - [+] don't say "you see a few things" if one of them is footsteps * [+] IFMONSTER code failing....because flags are now SORTED!!! - [+] tumble - askcoords is letting us pick a cell we don't have lof to. * [+] assign a name to lfs once you hire them * [+] coloured msgtext - [+] make min dam reduction from AR be AR/5. - [+] safebox - [+] if intelligent, prompt before walking into RESTRICTMOVEMENT with no getsweaker (val1) * [+] make fire / ice damage mor elike netheck - [+] towns should have gates on EVERY side - [+] forest cells outside town gates need to be CLEARED. (maybe turn to dirt) - [+] fix up knock targetting to include magical barriers - [+] say "open a bag?" not "operate a bag?" * [+] implement immunetodisease - [+] sort known skills in @s. - [+] better damage bonus when attacking someone who is asleep - [+] practive firearms/throwing * [+] need objecttype->size * [+] containers * [+] change guns so you have to reload them. ("operate") - [+] crash when loading map with water - [+] SAVE OBJECT CONTENTSk - [+] monsters with jobs aren't getting start items - [+] shopkeeper has shotgun - [+] bug: monster keeps swapping between shotgun and flail - [+] when hiring, remember failure. * [+] Inn - [+] bug: pets fighting!!! then they all turn on you. never make allies get angry unless the attacker is the player * [+] hiring npcs - [+] chat to pet: "stay close" or "keep your distance" - [+] new 'furniture' obclass - [+] allow for 'randomshop' regiontype * [+] add enchantment school - [+] cast a scroll of mending on itself. CRASH. * [+] lessengravity should make you jump better and get knocked back further - [+] boostgrav/lessengrav cancel out each other. * [+] CRASH when you fall down a hole and die. - [+] problem: master gravitation doesn't let us cast levitat. getspellschoolknown() should return the HIGHEST known skill, not the first. * [+] bug: dregion is null?!??! * [+] dig a pit, if you cleared out land below, you just stay down there. - [+] potion of leveitation - [+] warning msg when levitate is about to expire * [+] if you fall upwards to the surface... * [+] if you are ever on the surface while levitating.... - [+] BUG: cna't go up stairs to surface anymore!!!!! - [+] get hungry LOTS more quickly when you start sprinting * [+] monk slow metabolism psionic pell. - [+] fix buf with lore giving LESS accuracy instead of more. - [+] food shop - [+] wand of digging not identified if you dig upwards * [+] when you make ah ole in the roof, objects above should fall through right away * [+] all towns should have: - [+] give monks more psionics spells. - [+] sk_throwing skill - [+] make calm animals use spellpower * [+] add wisdom * [+] need to save region data along with maps * [+] COMBINE armour evasion and accuracy penalty!!! * [+] make armour reduce accuracy as well (unless you have 'armour' skill) - [+] landmine trap * [+] make friendly monsters of same raceclass swap ammo - [+] rename 'pull' to 'suck' to avoid confusion with pull metal * [+] food to fix blindness - [+] potion of coffee * [+] genericise statbrackets * [+] tumble ability * [+] simplify spell power * [+] shopkeeprs should be allowed to pursue targets outside of the shop. - [+] give shopkeepers a shotgun * [+] make F_RNDHOSTILE be able to ahve a random chance. * [+] if you randomly generate food in a shop, still give it a price. - [+] if peaceful humanoid walks into you, "sorry!" - [+] sayphrase(lf, SP_SORRY, vol) - [+] only let you recruit jobs with j_recruitable - [+] CRASH - summon "monk" - [+] dogs, - [+] chickens, - [+] drunks, * [+] village objects - [+] change armourrating AGAIN. instead of a percentage, make it a number. - [+] rename inn to "pub", since you can't sleep there. * [+] random speech code * [+] genericise sayphrase text based on lf's job * [+] monks - add rest of abliities - [+] add fiengdeath ability to some monsters
2011-07-14 07:40:28 +10:00
int db = B_FALSE;
2011-02-01 06:16:13 +11:00
rv = fscanf(f, "%d,%d,%d,%d,%d,%d,%d,%ld\n",
&tempflag.id, &tempflag.nvals, &tempflag.val[0], &tempflag.val[1], &tempflag.val[2],&tempflag.lifetime, &tempflag.known,&tempflag.obfrom);
while (tempflag.id != -1) {
dblog("got flag id=%d\n",tempflag.id);
// get flag text
fgets(buf, BUFLEN, f);
buf[strlen(buf)-1] = '\0'; // strip newline
fl = addflag_real(fp, tempflag.id,
tempflag.val[0],
tempflag.val[1],
tempflag.val[2], strcmp(buf, "^^^") ? buf : NULL, tempflag.lifetime, tempflag.known, tempflag.obfrom);
2011-02-01 06:16:13 +11:00
if (db) {
dblog("--> added flag id=%d. v0=%d, v1=%d, v2=%d, text=%s, lifetime=%d, known=%d, obfrom=%ld\n",fl->id,
fl->val[0], fl->val[1], fl->val[2], fl->text ? fl->text : "(null)", fl->lifetime, fl->known,fl->obfrom);
}
// load next one
rv = fscanf(f, "%d,%d,%d,%d,%d,%d,%d,%ld\n",
&tempflag.id, &tempflag.nvals, &tempflag.val[0], &tempflag.val[1], &tempflag.val[2],&tempflag.lifetime, &tempflag.known,&tempflag.obfrom);
//dblog("fscanf returned %d\n",rv);
}
return B_FALSE;
}
2010-12-07 18:34:26 +11:00
int loadknowledge(FILE *f) {
int db = B_FALSE;
char buf[BUFLEN];
- [+] bug: "10 flaming arrows ##########\n are no longer on fire" - [+] bug: when wearing no boots: "A small puddle of water hits you!" - [+] animated zombie keeps changing colour * [+] wizard special case: * [+] bug - walked down stiars on top of a monster - [+] change "haslof" to come from a cell - [+] replace WE_NOTSOLID with WE_WALKABLE - [+] show hp/mp in colour - [+] invis potion should always traget user - [+] generic functions to curse/uncurse an object - [+] not prompting for statgain after training properly. fixed. * [+] pressing a key should interrupt resting * [+] implement doublebuffering for screen - [+] don't show attack dmg for mosnters - [+] reduce sprint time - [+] if a monster is chasing someone (ie has F_TARGET), then don't consider cursed ob ells as valid - [+] don't hear noises when in battle - [+] colourise attribs on status bar * [+] askob/askobmulti - [+] "lockpick with what" showing too much * [+] inventoy colours - [+] "masterwork stick" ?! - [+] poison: save to get rid of poison should be HARDER than save to prevent getting it * [+] why are xats starting off carrying objects ? * [+] small chance of catching a thrown missile if you have very high dex * [+] if you polymorphed on purpose, have a "revert to original form" ability - [+] nausea should only affect humanoids - [+] BUG displaying knowledge when it goes longer than 1 screen. - [+] monsters are attacking each other again! fixed? * [+] BUG: when i load a game, i gain all knowledge! - [+] more pole weapons * [+] disarming weapons * [+] tripping weapons * [+] MORE ISSUES with askobject * [+] validatelf - [+] fix bug with poison triggering too often - [+] chance of retching when nauseated. no hp loss, but takes time. - [+] monsters shouldn't throw stuff if they don't have lof. - [+] fix crash in knockbackob->fireat, caused by thrower == null - [+] let high powered KNOCK knockback creatures again ? - [+] test function to dump out: dungeonlev which_monsters_can_appear - [+] firstaid tells you how long poison will last and whether it's lifethreatenting? * [+] high level listen gives more info - [+] wind shield spell - [+] repels all missiles of speed <= power - [+] variable level spells - [+] F_VARLEVEL - [+] when you cast, say "cast at how much power" with choices "Power II (5 MP)" - [+] show in spell list: "5-10 MP" - [+] replace ARBOOST with MAGICARMOUR - [+] needan() * [+] move psychic shield check into losehp - [+] high level detectlife should show actual lf glyphs - [+] control which jobs can learn which new skills. - [+] F_CANLEARN xxx - [+] remember last target from spells - [+] askcoords = does lf for lastlftarg exist? if not, set it to null - [+] if so, start with it - [+] when you pick one, set it. - [+] F_SHIELDPENALTY - modifies accuracy. * [+] stop wizards from using shields
2011-04-06 17:27:55 +10:00
char line[BUFLEN];
2010-12-07 18:34:26 +11:00
int otid,known;
char hiddenname[BUFLEN];
- [+] bug: "10 flaming arrows ##########\n are no longer on fire" - [+] bug: when wearing no boots: "A small puddle of water hits you!" - [+] animated zombie keeps changing colour * [+] wizard special case: * [+] bug - walked down stiars on top of a monster - [+] change "haslof" to come from a cell - [+] replace WE_NOTSOLID with WE_WALKABLE - [+] show hp/mp in colour - [+] invis potion should always traget user - [+] generic functions to curse/uncurse an object - [+] not prompting for statgain after training properly. fixed. * [+] pressing a key should interrupt resting * [+] implement doublebuffering for screen - [+] don't show attack dmg for mosnters - [+] reduce sprint time - [+] if a monster is chasing someone (ie has F_TARGET), then don't consider cursed ob ells as valid - [+] don't hear noises when in battle - [+] colourise attribs on status bar * [+] askob/askobmulti - [+] "lockpick with what" showing too much * [+] inventoy colours - [+] "masterwork stick" ?! - [+] poison: save to get rid of poison should be HARDER than save to prevent getting it * [+] why are xats starting off carrying objects ? * [+] small chance of catching a thrown missile if you have very high dex * [+] if you polymorphed on purpose, have a "revert to original form" ability - [+] nausea should only affect humanoids - [+] BUG displaying knowledge when it goes longer than 1 screen. - [+] monsters are attacking each other again! fixed? * [+] BUG: when i load a game, i gain all knowledge! - [+] more pole weapons * [+] disarming weapons * [+] tripping weapons * [+] MORE ISSUES with askobject * [+] validatelf - [+] fix bug with poison triggering too often - [+] chance of retching when nauseated. no hp loss, but takes time. - [+] monsters shouldn't throw stuff if they don't have lof. - [+] fix crash in knockbackob->fireat, caused by thrower == null - [+] let high powered KNOCK knockback creatures again ? - [+] test function to dump out: dungeonlev which_monsters_can_appear - [+] firstaid tells you how long poison will last and whether it's lifethreatenting? * [+] high level listen gives more info - [+] wind shield spell - [+] repels all missiles of speed <= power - [+] variable level spells - [+] F_VARLEVEL - [+] when you cast, say "cast at how much power" with choices "Power II (5 MP)" - [+] show in spell list: "5-10 MP" - [+] replace ARBOOST with MAGICARMOUR - [+] needan() * [+] move psychic shield check into losehp - [+] high level detectlife should show actual lf glyphs - [+] control which jobs can learn which new skills. - [+] F_CANLEARN xxx - [+] remember last target from spells - [+] askcoords = does lf for lastlftarg exist? if not, set it to null - [+] if so, start with it - [+] when you pick one, set it. - [+] F_SHIELDPENALTY - modifies accuracy. * [+] stop wizards from using shields
2011-04-06 17:27:55 +10:00
char *p,*dummy;
2010-12-07 18:34:26 +11:00
if (db) dblog("--> Loading knowledge...\n");
fscanf(f, "startknowledge\n");
fgets(buf, BUFLEN, f);
buf[strlen(buf)-1] = '\0'; // strip newline
2010-12-02 12:17:54 +11:00
2010-12-07 18:34:26 +11:00
while (strcmp(buf, "endknowledge")) {
- [+] bug: "10 flaming arrows ##########\n are no longer on fire" - [+] bug: when wearing no boots: "A small puddle of water hits you!" - [+] animated zombie keeps changing colour * [+] wizard special case: * [+] bug - walked down stiars on top of a monster - [+] change "haslof" to come from a cell - [+] replace WE_NOTSOLID with WE_WALKABLE - [+] show hp/mp in colour - [+] invis potion should always traget user - [+] generic functions to curse/uncurse an object - [+] not prompting for statgain after training properly. fixed. * [+] pressing a key should interrupt resting * [+] implement doublebuffering for screen - [+] don't show attack dmg for mosnters - [+] reduce sprint time - [+] if a monster is chasing someone (ie has F_TARGET), then don't consider cursed ob ells as valid - [+] don't hear noises when in battle - [+] colourise attribs on status bar * [+] askob/askobmulti - [+] "lockpick with what" showing too much * [+] inventoy colours - [+] "masterwork stick" ?! - [+] poison: save to get rid of poison should be HARDER than save to prevent getting it * [+] why are xats starting off carrying objects ? * [+] small chance of catching a thrown missile if you have very high dex * [+] if you polymorphed on purpose, have a "revert to original form" ability - [+] nausea should only affect humanoids - [+] BUG displaying knowledge when it goes longer than 1 screen. - [+] monsters are attacking each other again! fixed? * [+] BUG: when i load a game, i gain all knowledge! - [+] more pole weapons * [+] disarming weapons * [+] tripping weapons * [+] MORE ISSUES with askobject * [+] validatelf - [+] fix bug with poison triggering too often - [+] chance of retching when nauseated. no hp loss, but takes time. - [+] monsters shouldn't throw stuff if they don't have lof. - [+] fix crash in knockbackob->fireat, caused by thrower == null - [+] let high powered KNOCK knockback creatures again ? - [+] test function to dump out: dungeonlev which_monsters_can_appear - [+] firstaid tells you how long poison will last and whether it's lifethreatenting? * [+] high level listen gives more info - [+] wind shield spell - [+] repels all missiles of speed <= power - [+] variable level spells - [+] F_VARLEVEL - [+] when you cast, say "cast at how much power" with choices "Power II (5 MP)" - [+] show in spell list: "5-10 MP" - [+] replace ARBOOST with MAGICARMOUR - [+] needan() * [+] move psychic shield check into losehp - [+] high level detectlife should show actual lf glyphs - [+] control which jobs can learn which new skills. - [+] F_CANLEARN xxx - [+] remember last target from spells - [+] askcoords = does lf for lastlftarg exist? if not, set it to null - [+] if so, start with it - [+] when you pick one, set it. - [+] F_SHIELDPENALTY - modifies accuracy. * [+] stop wizards from using shields
2011-04-06 17:27:55 +10:00
//sscanf(buf, "%d^%s^%d",&otid, hiddenname, &known);
strcpy(line, buf);
p = strtok_r(line, "^", &dummy);
otid = atoi(p);
p = strtok_r(NULL, "^", &dummy);
strcpy(hiddenname, p);
p = strtok_r(NULL, "^", &dummy);
known = atoi(p);
2010-12-07 18:34:26 +11:00
addknowledge(otid, hiddenname, known);
// get next line
fgets(buf, BUFLEN, f);
buf[strlen(buf)-1] = '\0'; // strip newline
}
return B_FALSE;
}
2010-12-02 12:17:54 +11:00
2011-02-01 06:16:13 +11:00
int loadvars(FILE *f) {
int db = B_FALSE;
if (db) dblog("--> Loading knowledge...\n");
fscanf(f, "startvars\n");
fscanf(f, "curtime:%ld\n",&curtime);
fscanf(f, "endvars\n");
return B_FALSE;
}
2010-12-02 12:17:54 +11:00
// load and allocate one lifeform from given file
lifeform_t *loadlf(FILE *f, cell_t *where) {
lifeform_t *l;
int lfid, lfraceid;
long obid;
int rv;
int i;
char buf[BUFLEN];
int obcount;
int mapid;
map_t *m;
- [+] young hawk moving very slowly? was healing. - [+] make monsters heal faster when resting - [+] make pet rest when you do - [+] allow 'R' to heal allies - [+] F_RESTUNTILALLIES - [+] mindless/animal mosnters won't throw things - [+] announceflag for attrset not working * [+] feeblemind spell - reduces intelligence to ANIMAL. - [+] ai: if we are carrying too much, drop something (non-weapons/armour first) - [+] teleport spell should teleport any adjacent allies too. * [+] new 'C'hat commands: * [+] change 'resist elements' potion to 'rum' * [+] notify when pet is low on hp - [+] why could a pirate use a biuckler? * [+] genericise usage of canhaveobmod! - [+] armour mod: blooodstained. adds scary. - [+] CRASH when you have two weapons and catch a glowbug in your flask. * [+] potion of restoration onto frozen axe: - [+] slow spell repeated message: The brown snake looks sluggish. The brown snake is now moving slower. - [+] make you only hear one thing each turn ? - [+] always draw impassable objects on top - [+] special ash - [+] exploding powder - explode in radius 1 around player (including player) - [+] concealing powder - create smoke cloud radius 3 around player - [+] redo levelup logic. - [+] trigger LevUp when you have 'newskillready' - [+] announce when you gain level. - [+] can't gain more experience when LevUp! - [+] only update maxhp/mp from new level after you train - [+] diety can't use abilities. fixed. * [+] when i exit from@S output, statbar isn't redrawn * [+] make SKILLS page show which skills you can learn. - [+] In @s, downline isn't showing the title on the second page of SKILLS... - [+] show POWER in @M spells page - [+] ###--- - [+] show cost RANGE in @M for varpower ones - [+] need getspellcosttext(spellid, power, buf) function - [+] 25-62MP - [+] leftover rubbish chars at end of ---- in doheading() - [+] mosnters should follow you up/down stairs * [+] different poison types - [+] implement tremorsense (like darkvision butrun can't be blinded etc) * [+] implement HIDE ability * [+] Thief job - [+] if you walk into a room and every cell is lit, reveal it all. - [+] auto-learn jump ability with high athletics skill * [+] secret doors - [+] items to spot secret doors - [+] gem of seeing - [+] ENHANCESEARCH - [+] F_SEEINVIS - [+] spell: "reveal hidden" - [+] shows secret doors - [+] removes invisibility - [+] wand of detect hidden - [+] ... casts the spell
2011-04-14 09:44:29 +10:00
int x,y,level,newlevel;
2010-12-02 12:17:54 +11:00
int db = B_TRUE;
- [+] thrown objects taking no damage due to hardness * [+] DIETY is slow. - [+] map bug - from 0,0, walk NE (off top edge). i end up at 0,0 again!!! * [+] ALLOW ROTATING OF VAULTS - [+] BUG: dig X only goes 1 cell. - [+] add a U shaped turn vault. - [+] change wehre i apply HADRNESS for lfs! - don't use adjustdammaterial cause we inherit there - [+] make obchance/thingchance part of habitat_t - [+] make sense surroundings take cartography skill into account * [+] BUG: rotated at() etc not working. - [+] if you fail stealing, the target should get angry!!! - [+] make sure to redraw stat bar when mind scan finishes. - [+] villages - [+] initial code * [+] town gaurds. stand next to the gate - [+] potion shop vault - [+] implement - [+] potion shop isn't getting potions!! - [+] and getting wrong floor type. * [+] stop shop from always being at the top left. - [+] make sure its x/y arent too close to edge of map (at least 5 away) - [+] vault param. f_mapmargin, 5 - [+] make calcroompos take x/y margin - [+] don't put auto obs inside vaults - [+] town walls - [+] more kinds of shops * [+] signs outside shops - [+] bug with ai swapping between firearms and twohanded weapons. fixed. * [+] make _CELLS_ have habitats! - [+] move vaultchance to a habitat param instead of getvaultchance() * [+] shopkeepers (special race) village things: - [+] barrels, - [+] guards, - [+] statue - [+] thrown objects should still take damage if blocked via a shield * [+] hardness (must do dam >= xx to hurt) * [+] WATER spread mods * [+] very powerful spells have casttime - [+] allow linkstairs() to take a parameter rather than always jsut searching for the other end - [+] when digging holes, only use getrandomadjcell if there is an lf in the way. and then use WE_NOLF. clear out solid cells - [+] show armour EVASION penalty in describeob - [+] teleportation trap. You reintegrate inside a solid object! You die.--More--. - [+] riverroom vault * [+] water: swap { and ~ again?? - [+] make "large puddle of water" evaporate more quickly * [+] special glyph case: for deep water
2011-06-29 18:48:48 +10:00
int matid;
2010-12-02 12:17:54 +11:00
if (db) dblog("--> Loading lifeform...\n");
fscanf(f, "startlf\n");
fscanf(f, "lfid: %d\n",&lfid);
fscanf(f, "race: %d\n",&lfraceid);
fscanf(f, "map: %d\n",&mapid);
fscanf(f, "pos: %d,%d\n",&x, &y);
2010-12-07 18:34:26 +11:00
fscanf(f, "level: %d\n",&level);
- [+] young hawk moving very slowly? was healing. - [+] make monsters heal faster when resting - [+] make pet rest when you do - [+] allow 'R' to heal allies - [+] F_RESTUNTILALLIES - [+] mindless/animal mosnters won't throw things - [+] announceflag for attrset not working * [+] feeblemind spell - reduces intelligence to ANIMAL. - [+] ai: if we are carrying too much, drop something (non-weapons/armour first) - [+] teleport spell should teleport any adjacent allies too. * [+] new 'C'hat commands: * [+] change 'resist elements' potion to 'rum' * [+] notify when pet is low on hp - [+] why could a pirate use a biuckler? * [+] genericise usage of canhaveobmod! - [+] armour mod: blooodstained. adds scary. - [+] CRASH when you have two weapons and catch a glowbug in your flask. * [+] potion of restoration onto frozen axe: - [+] slow spell repeated message: The brown snake looks sluggish. The brown snake is now moving slower. - [+] make you only hear one thing each turn ? - [+] always draw impassable objects on top - [+] special ash - [+] exploding powder - explode in radius 1 around player (including player) - [+] concealing powder - create smoke cloud radius 3 around player - [+] redo levelup logic. - [+] trigger LevUp when you have 'newskillready' - [+] announce when you gain level. - [+] can't gain more experience when LevUp! - [+] only update maxhp/mp from new level after you train - [+] diety can't use abilities. fixed. * [+] when i exit from@S output, statbar isn't redrawn * [+] make SKILLS page show which skills you can learn. - [+] In @s, downline isn't showing the title on the second page of SKILLS... - [+] show POWER in @M spells page - [+] ###--- - [+] show cost RANGE in @M for varpower ones - [+] need getspellcosttext(spellid, power, buf) function - [+] 25-62MP - [+] leftover rubbish chars at end of ---- in doheading() - [+] mosnters should follow you up/down stairs * [+] different poison types - [+] implement tremorsense (like darkvision butrun can't be blinded etc) * [+] implement HIDE ability * [+] Thief job - [+] if you walk into a room and every cell is lit, reveal it all. - [+] auto-learn jump ability with high athletics skill * [+] secret doors - [+] items to spot secret doors - [+] gem of seeing - [+] ENHANCESEARCH - [+] F_SEEINVIS - [+] spell: "reveal hidden" - [+] shows secret doors - [+] removes invisibility - [+] wand of detect hidden - [+] ... casts the spell
2011-04-14 09:44:29 +10:00
fscanf(f, "newlevel: %d\n",&newlevel);
2010-12-02 12:17:54 +11:00
// find the map
m = findmap(mapid);
if (!m) {
dblog("ERROR loading lf id %d: can't find map id %d\n",lfid,mapid);
exit(1);
}
if (where == NULL) {
where = getcellat(m, x, y);
}
if (!m) {
dblog("ERROR loading lf id %d: can't find cell at %d,%d on map id %d\n",lfid,x,y,mapid);
exit(1);
}
2010-12-07 18:34:26 +11:00
l = addlf(where, lfraceid,level);
2010-12-02 12:17:54 +11:00
l->id = lfid;
l->x = x;
l->y = y;
- [+] young hawk moving very slowly? was healing. - [+] make monsters heal faster when resting - [+] make pet rest when you do - [+] allow 'R' to heal allies - [+] F_RESTUNTILALLIES - [+] mindless/animal mosnters won't throw things - [+] announceflag for attrset not working * [+] feeblemind spell - reduces intelligence to ANIMAL. - [+] ai: if we are carrying too much, drop something (non-weapons/armour first) - [+] teleport spell should teleport any adjacent allies too. * [+] new 'C'hat commands: * [+] change 'resist elements' potion to 'rum' * [+] notify when pet is low on hp - [+] why could a pirate use a biuckler? * [+] genericise usage of canhaveobmod! - [+] armour mod: blooodstained. adds scary. - [+] CRASH when you have two weapons and catch a glowbug in your flask. * [+] potion of restoration onto frozen axe: - [+] slow spell repeated message: The brown snake looks sluggish. The brown snake is now moving slower. - [+] make you only hear one thing each turn ? - [+] always draw impassable objects on top - [+] special ash - [+] exploding powder - explode in radius 1 around player (including player) - [+] concealing powder - create smoke cloud radius 3 around player - [+] redo levelup logic. - [+] trigger LevUp when you have 'newskillready' - [+] announce when you gain level. - [+] can't gain more experience when LevUp! - [+] only update maxhp/mp from new level after you train - [+] diety can't use abilities. fixed. * [+] when i exit from@S output, statbar isn't redrawn * [+] make SKILLS page show which skills you can learn. - [+] In @s, downline isn't showing the title on the second page of SKILLS... - [+] show POWER in @M spells page - [+] ###--- - [+] show cost RANGE in @M for varpower ones - [+] need getspellcosttext(spellid, power, buf) function - [+] 25-62MP - [+] leftover rubbish chars at end of ---- in doheading() - [+] mosnters should follow you up/down stairs * [+] different poison types - [+] implement tremorsense (like darkvision butrun can't be blinded etc) * [+] implement HIDE ability * [+] Thief job - [+] if you walk into a room and every cell is lit, reveal it all. - [+] auto-learn jump ability with high athletics skill * [+] secret doors - [+] items to spot secret doors - [+] gem of seeing - [+] ENHANCESEARCH - [+] F_SEEINVIS - [+] spell: "reveal hidden" - [+] shows secret doors - [+] removes invisibility - [+] wand of detect hidden - [+] ... casts the spell
2011-04-14 09:44:29 +10:00
l->newlevel = newlevel;
2010-12-02 12:17:54 +11:00
// load rest of this lf
2011-02-01 06:16:13 +11:00
fscanf(f, "str: %d/%d\n",&l->att[A_STR],&l->baseatt[A_STR]);
fscanf(f, "dex: %d/%d\n",&l->att[A_DEX],&l->baseatt[A_DEX]);
fscanf(f, "int: %d/%d\n",&l->att[A_IQ],&l->baseatt[A_IQ]);
fscanf(f, "xp: %ld\n",&l->xp);
2011-03-16 15:45:46 +11:00
fscanf(f, "skp: %d\n",&l->skillpoints);
2010-12-02 12:17:54 +11:00
fscanf(f, "contr: %d\n",&l->controller);
fscanf(f, "hp: %d/%d\n",&l->hp, &l->maxhp);
2011-02-01 06:16:13 +11:00
fscanf(f, "mp: %d/%d\n",&l->mp, &l->maxmp);
2010-12-02 12:17:54 +11:00
fscanf(f, "alive: %d\n",&l->alive);
2011-02-01 06:16:13 +11:00
fscanf(f, "lastdamtype: %d\n",(int *)&l->lastdamtype);
2010-12-02 12:17:54 +11:00
fgets(buf, BUFLEN, f); // lastdam
buf[strlen(buf)-1] = '\0'; // strip newline
l->lastdam = strdup(buf + 9); // after 'lastdam: '
- [+] thrown objects taking no damage due to hardness * [+] DIETY is slow. - [+] map bug - from 0,0, walk NE (off top edge). i end up at 0,0 again!!! * [+] ALLOW ROTATING OF VAULTS - [+] BUG: dig X only goes 1 cell. - [+] add a U shaped turn vault. - [+] change wehre i apply HADRNESS for lfs! - don't use adjustdammaterial cause we inherit there - [+] make obchance/thingchance part of habitat_t - [+] make sense surroundings take cartography skill into account * [+] BUG: rotated at() etc not working. - [+] if you fail stealing, the target should get angry!!! - [+] make sure to redraw stat bar when mind scan finishes. - [+] villages - [+] initial code * [+] town gaurds. stand next to the gate - [+] potion shop vault - [+] implement - [+] potion shop isn't getting potions!! - [+] and getting wrong floor type. * [+] stop shop from always being at the top left. - [+] make sure its x/y arent too close to edge of map (at least 5 away) - [+] vault param. f_mapmargin, 5 - [+] make calcroompos take x/y margin - [+] don't put auto obs inside vaults - [+] town walls - [+] more kinds of shops * [+] signs outside shops - [+] bug with ai swapping between firearms and twohanded weapons. fixed. * [+] make _CELLS_ have habitats! - [+] move vaultchance to a habitat param instead of getvaultchance() * [+] shopkeepers (special race) village things: - [+] barrels, - [+] guards, - [+] statue - [+] thrown objects should still take damage if blocked via a shield * [+] hardness (must do dam >= xx to hurt) * [+] WATER spread mods * [+] very powerful spells have casttime - [+] allow linkstairs() to take a parameter rather than always jsut searching for the other end - [+] when digging holes, only use getrandomadjcell if there is an lf in the way. and then use WE_NOLF. clear out solid cells - [+] show armour EVASION penalty in describeob - [+] teleportation trap. You reintegrate inside a solid object! You die.--More--. - [+] riverroom vault * [+] water: swap { and ~ again?? - [+] make "large puddle of water" evaporate more quickly * [+] special glyph case: for deep water
2011-06-29 18:48:48 +10:00
fscanf(f, "material: %d\n",&matid);
l->material = findmaterial(matid);
2010-12-02 12:17:54 +11:00
fscanf(f, "timespent: %d\n",&l->timespent);
fscanf(f, "sorted: %d\n",&l->sorted);
2011-02-01 06:16:13 +11:00
fscanf(f, "polyrevert: %d\n",&l->polyrevert);
2010-12-07 18:34:26 +11:00
fscanf(f, "forgettimer: %f\n",&l->forgettimer);
2010-12-02 12:17:54 +11:00
2011-02-01 06:16:13 +11:00
if (db) dblog("--> Got hp=%d/%d. timespend=%d. sorted=%d. Now loading flags.",l->hp,l->maxhp,l->timespent,l->sorted);
* [+] bug: secret doors revealed when we walk away from them. - [+] make lamps last heaps longer * [+] web spell * [+] spider monstrer * [+] funnelweb: * [+] redback: - [+] if you are wracked with pain, don't clear msg - [+] check rarity for spiders * [+] attack/defense mod if there is stickiness in your square - [+] replace "sticky" with "restrictive" * [+] make some mosnters start hidden - [+] adjust spot checks basd on distance - [+] ensure that attacking stops you hiding - [+] casting spells stops you from being hidden - [+] hidden mosnters shouldn't move unless their victim is ADJACENT. - [+] hidden mosnters shouldn't cast spells, throw missiles, etc unless their victim is ADJACENT. - [-] XP CALC - [+] funnelweb and redback are the same. - [+] check this is right...... i want funnel web to be worse. - [+] make hitconfer check in calcxpval take lifetime into account - [+] ALSO assign an xp rating to each hitconferred flag. - [+] hardcode this. * [+] entangle spell - [+] reveal secret doors if you see them get damaged. * [+] make askcoords list restrivitce objects - [+] ACTUALLY make vines not damaged by struggling * [+] object descriptions, a/an needs to change if showing condition: "a battered entangling vine" - [+] wizard levelled up and was prompted for "WISH, GIFT"! shouldn't happen! - [+] The human diety reads a blessed scroll of create monster! -- but nothing happens?? * [+] throw code - [+] wizard: ask for school specialty at start, from: fire, ice, xxx ? You get this + WILD. - [+] describe varpower spells - [+] fix mp cost for varpower spells - [+] we're not stopping running at staircases anymore for some reason. - [+] CHARGE ability (like swoop but don't return to original positino) - [+] need to honor f_canlearn when displaying new skills to learn! - [+] ai: if we are going to player's last known loc (via targetcell), abandon if we can SEE the player! - [+] make shatter() into a function - [+] oil potion makes oil puddle whan smashed - [+] make flammable objects be able to convert to others - [+] replace 'magic item usage' with 'channeling' - [+] a cloud of darkness descends. this is a *cursed* wand of light. - [+] spiders shouldn't be able to be stuck in a web! * [+] spells should be able to have MULTIPLE schools. - [+] don't bleed into walls - [+] in @M, use colours to show which spells are too hard so far (ie cost > maxmp) * [+] in @M, use schools that you know * [+] after loading game, barbarian is getting an extra attack? You miss the eyebat. You punch the eyebat. - [+] show objects on top of stairs - [+] stuck mosnters must pass a saving throw to follow you up/down stairs - [+] genericise: trytomove(lf) * [+] add more snakes - [+] undead can't eat or drink? or MOST undead can't. * [+] why can MONSTERS shoot webs through things? (but I can't) - [+] barkskin - doesn't reduce max mp enough? - [+] The skeleton touches a fuming aqua potion [tried] then recoils in pain! The skeleton drops a blessed fuming aqua potion [tried]. The skeleton drinks a fuming aqua potion! - [+] why can't i use abilites anymore? - [+] infinite loop bug due to ai only having one ignorecell. - [+] make sleet storms rust all armour - [+] make a kind of walkdam that hits armour - [+] add this as well as walkdam for: acid, fire, water - [+] Takeoff isn't prompting properly. only showing weapons! * [+] waterproof obs (ie cloak) * [+] walkdambp doesn't hurt body if you have a cloak NATURE SPELLS: - [+] mending, heals 1d6 damage - [+] spark - [+] purify food - [+] sticks to snakes - [+] calm animals (power_d4 hd) * [+] charm animal (works on one animal up to power hit dice, temporary) - [+] airblast - [+] barkskin (power +2 AR, firevuln, ongoing) - [+] soften earth (makes ground into mud) - [+] warp wood (damages wooden objects) - [+] repel insects - [+] reduce poison - [+] web - [+] windshield - [+] call lightning, air - [+] resist elements, ongoing - [+] passwall - [+] poisonbolt - [+] quench (puts out a fire) - [+] sleet storm (lowers movement, vision) - [+] healing - [+] cure poison * [+] calming scent - [+] dig - [+] entangle - [+] levitate - [+] flamepillar - [+] hailstorm. like sleetstorm but hurts more. power d 6. - [+] burning wave - [+] gaseous form * [+] knowledge skills: * [+] force makespellchoicelist() to show spells in level order. * [+] druid - [+] check OBJECT rarity list (dumplev) - [+] fix bug where heaps of books suddently appear from dlev 3 onwards - [+] gain skills on level up for some jobs - [+] f_levspellschool, v0=lev, v1 = school or ANY - select one from that school
2011-04-23 14:27:42 +10:00
// clear existing flags from addlf
while (l->flags->first) {
killflag(l->flags->first);
}
// load lf flags
2011-02-01 06:16:13 +11:00
loadflagpile(f, l->flags);
if (db) dblog("--> now loading objects");
2010-12-02 12:17:54 +11:00
// load object list
obcount = 0;
obid = 9999; // for testing
rv = fscanf(f, "ob:%ld\n",&obid);
while (obid != -1) {
if (db) dblog("--> Load ob id %d into list...",obid);
l->pack->oblist[obcount] = obid;
obcount++;
fscanf(f, "ob:%ld\n",&obid);
}
// terminate with -1s!
for (i = obcount ; i < MAXPILEOBS; i++) {
l->pack->oblist[i] = -1;
}
if (db) dblog("--> Finished oblist. Found %d objects.",obcount);
2010-12-07 18:34:26 +11:00
// now load load object defs for this player!
2010-12-02 12:17:54 +11:00
fscanf(f, "obdefs\n");
for (i = 0; i < obcount; i++) {
2010-12-07 18:34:26 +11:00
long thisid;
if (db) dblog("--> Creating ob #%d for lf.",i);
2010-12-02 12:17:54 +11:00
//if (db) dblog("-----> ob %d/%d...\n",i+1,obcount);
2010-12-07 18:34:26 +11:00
if (loadob(f, l->pack, &thisid)) {
2010-12-02 12:17:54 +11:00
dblog("Error - can't create object %d/%d!\n",i+1,obcount);
exit(1);
}
2010-12-07 18:34:26 +11:00
if (db) dblog("----> done (id=%ld)",thisid);
2010-12-02 12:17:54 +11:00
}
// is this the player?
if (l->controller == C_PLAYER) {
player = l;
}
2011-02-01 06:16:13 +11:00
sortlf(l->cell->map, l);
return l;
2010-12-02 12:17:54 +11:00
}
map_t *loadmap(char *basefile) {
FILE *f;
char filename[BUFLEN];
char buf[BUFLEN];
int obcount;
int i;
int x,y;
int db = B_TRUE;
enum HABITAT habitatid;
2010-12-02 12:17:54 +11:00
lifeform_t *l;
2011-02-01 06:16:13 +11:00
object_t *o;
2010-12-02 12:17:54 +11:00
map_t *m;
cell_t *dummycell;
* [+] make vending machines use this container code instead. - [+] don't say "you see a few things" if one of them is footsteps * [+] IFMONSTER code failing....because flags are now SORTED!!! - [+] tumble - askcoords is letting us pick a cell we don't have lof to. * [+] assign a name to lfs once you hire them * [+] coloured msgtext - [+] make min dam reduction from AR be AR/5. - [+] safebox - [+] if intelligent, prompt before walking into RESTRICTMOVEMENT with no getsweaker (val1) * [+] make fire / ice damage mor elike netheck - [+] towns should have gates on EVERY side - [+] forest cells outside town gates need to be CLEARED. (maybe turn to dirt) - [+] fix up knock targetting to include magical barriers - [+] say "open a bag?" not "operate a bag?" * [+] implement immunetodisease - [+] sort known skills in @s. - [+] better damage bonus when attacking someone who is asleep - [+] practive firearms/throwing * [+] need objecttype->size * [+] containers * [+] change guns so you have to reload them. ("operate") - [+] crash when loading map with water - [+] SAVE OBJECT CONTENTSk - [+] monsters with jobs aren't getting start items - [+] shopkeeper has shotgun - [+] bug: monster keeps swapping between shotgun and flail - [+] when hiring, remember failure. * [+] Inn - [+] bug: pets fighting!!! then they all turn on you. never make allies get angry unless the attacker is the player * [+] hiring npcs - [+] chat to pet: "stay close" or "keep your distance" - [+] new 'furniture' obclass - [+] allow for 'randomshop' regiontype * [+] add enchantment school - [+] cast a scroll of mending on itself. CRASH. * [+] lessengravity should make you jump better and get knocked back further - [+] boostgrav/lessengrav cancel out each other. * [+] CRASH when you fall down a hole and die. - [+] problem: master gravitation doesn't let us cast levitat. getspellschoolknown() should return the HIGHEST known skill, not the first. * [+] bug: dregion is null?!??! * [+] dig a pit, if you cleared out land below, you just stay down there. - [+] potion of leveitation - [+] warning msg when levitate is about to expire * [+] if you fall upwards to the surface... * [+] if you are ever on the surface while levitating.... - [+] BUG: cna't go up stairs to surface anymore!!!!! - [+] get hungry LOTS more quickly when you start sprinting * [+] monk slow metabolism psionic pell. - [+] fix buf with lore giving LESS accuracy instead of more. - [+] food shop - [+] wand of digging not identified if you dig upwards * [+] when you make ah ole in the roof, objects above should fall through right away * [+] all towns should have: - [+] give monks more psionics spells. - [+] sk_throwing skill - [+] make calm animals use spellpower * [+] add wisdom * [+] need to save region data along with maps * [+] COMBINE armour evasion and accuracy penalty!!! * [+] make armour reduce accuracy as well (unless you have 'armour' skill) - [+] landmine trap * [+] make friendly monsters of same raceclass swap ammo - [+] rename 'pull' to 'suck' to avoid confusion with pull metal * [+] food to fix blindness - [+] potion of coffee * [+] genericise statbrackets * [+] tumble ability * [+] simplify spell power * [+] shopkeeprs should be allowed to pursue targets outside of the shop. - [+] give shopkeepers a shotgun * [+] make F_RNDHOSTILE be able to ahve a random chance. * [+] if you randomly generate food in a shop, still give it a price. - [+] if peaceful humanoid walks into you, "sorry!" - [+] sayphrase(lf, SP_SORRY, vol) - [+] only let you recruit jobs with j_recruitable - [+] CRASH - summon "monk" - [+] dogs, - [+] chickens, - [+] drunks, * [+] village objects - [+] change armourrating AGAIN. instead of a percentage, make it a number. - [+] rename inn to "pub", since you can't sleep there. * [+] random speech code * [+] genericise sayphrase text based on lf's job * [+] monks - add rest of abliities - [+] add fiengdeath ability to some monsters
2011-07-14 07:40:28 +10:00
int regionid;
2010-12-02 12:17:54 +11:00
if (db) dblog("Loading map from %s...",basefile);
sprintf(filename, "%s/%s",MAPDIR,basefile);
f = fopen(filename, "rt");
// create map
m = addmap();
dummycell = malloc(sizeof(cell_t));
* [+] make vending machines use this container code instead. - [+] don't say "you see a few things" if one of them is footsteps * [+] IFMONSTER code failing....because flags are now SORTED!!! - [+] tumble - askcoords is letting us pick a cell we don't have lof to. * [+] assign a name to lfs once you hire them * [+] coloured msgtext - [+] make min dam reduction from AR be AR/5. - [+] safebox - [+] if intelligent, prompt before walking into RESTRICTMOVEMENT with no getsweaker (val1) * [+] make fire / ice damage mor elike netheck - [+] towns should have gates on EVERY side - [+] forest cells outside town gates need to be CLEARED. (maybe turn to dirt) - [+] fix up knock targetting to include magical barriers - [+] say "open a bag?" not "operate a bag?" * [+] implement immunetodisease - [+] sort known skills in @s. - [+] better damage bonus when attacking someone who is asleep - [+] practive firearms/throwing * [+] need objecttype->size * [+] containers * [+] change guns so you have to reload them. ("operate") - [+] crash when loading map with water - [+] SAVE OBJECT CONTENTSk - [+] monsters with jobs aren't getting start items - [+] shopkeeper has shotgun - [+] bug: monster keeps swapping between shotgun and flail - [+] when hiring, remember failure. * [+] Inn - [+] bug: pets fighting!!! then they all turn on you. never make allies get angry unless the attacker is the player * [+] hiring npcs - [+] chat to pet: "stay close" or "keep your distance" - [+] new 'furniture' obclass - [+] allow for 'randomshop' regiontype * [+] add enchantment school - [+] cast a scroll of mending on itself. CRASH. * [+] lessengravity should make you jump better and get knocked back further - [+] boostgrav/lessengrav cancel out each other. * [+] CRASH when you fall down a hole and die. - [+] problem: master gravitation doesn't let us cast levitat. getspellschoolknown() should return the HIGHEST known skill, not the first. * [+] bug: dregion is null?!??! * [+] dig a pit, if you cleared out land below, you just stay down there. - [+] potion of leveitation - [+] warning msg when levitate is about to expire * [+] if you fall upwards to the surface... * [+] if you are ever on the surface while levitating.... - [+] BUG: cna't go up stairs to surface anymore!!!!! - [+] get hungry LOTS more quickly when you start sprinting * [+] monk slow metabolism psionic pell. - [+] fix buf with lore giving LESS accuracy instead of more. - [+] food shop - [+] wand of digging not identified if you dig upwards * [+] when you make ah ole in the roof, objects above should fall through right away * [+] all towns should have: - [+] give monks more psionics spells. - [+] sk_throwing skill - [+] make calm animals use spellpower * [+] add wisdom * [+] need to save region data along with maps * [+] COMBINE armour evasion and accuracy penalty!!! * [+] make armour reduce accuracy as well (unless you have 'armour' skill) - [+] landmine trap * [+] make friendly monsters of same raceclass swap ammo - [+] rename 'pull' to 'suck' to avoid confusion with pull metal * [+] food to fix blindness - [+] potion of coffee * [+] genericise statbrackets * [+] tumble ability * [+] simplify spell power * [+] shopkeeprs should be allowed to pursue targets outside of the shop. - [+] give shopkeepers a shotgun * [+] make F_RNDHOSTILE be able to ahve a random chance. * [+] if you randomly generate food in a shop, still give it a price. - [+] if peaceful humanoid walks into you, "sorry!" - [+] sayphrase(lf, SP_SORRY, vol) - [+] only let you recruit jobs with j_recruitable - [+] CRASH - summon "monk" - [+] dogs, - [+] chickens, - [+] drunks, * [+] village objects - [+] change armourrating AGAIN. instead of a percentage, make it a number. - [+] rename inn to "pub", since you can't sleep there. * [+] random speech code * [+] genericise sayphrase text based on lf's job * [+] monks - add rest of abliities - [+] add fiengdeath ability to some monsters
2011-07-14 07:40:28 +10:00
dummycell->obpile = addobpile(NULL, dummycell, NULL);
2010-12-02 12:17:54 +11:00
dummycell->map = m;
2010-12-07 18:34:26 +11:00
dummycell->type = (celltype_t *)DUMMYCELLTYPE; // for debugging
2010-12-02 12:17:54 +11:00
if (!m) {
dblog("Error creating map while loading file '%s'",filename);
return NULL;
}
// load map info
if (db) dblog("--> Loading map info...\n");
fscanf(f, "id:%d\n",&m->id); // map id
* [+] make vending machines use this container code instead. - [+] don't say "you see a few things" if one of them is footsteps * [+] IFMONSTER code failing....because flags are now SORTED!!! - [+] tumble - askcoords is letting us pick a cell we don't have lof to. * [+] assign a name to lfs once you hire them * [+] coloured msgtext - [+] make min dam reduction from AR be AR/5. - [+] safebox - [+] if intelligent, prompt before walking into RESTRICTMOVEMENT with no getsweaker (val1) * [+] make fire / ice damage mor elike netheck - [+] towns should have gates on EVERY side - [+] forest cells outside town gates need to be CLEARED. (maybe turn to dirt) - [+] fix up knock targetting to include magical barriers - [+] say "open a bag?" not "operate a bag?" * [+] implement immunetodisease - [+] sort known skills in @s. - [+] better damage bonus when attacking someone who is asleep - [+] practive firearms/throwing * [+] need objecttype->size * [+] containers * [+] change guns so you have to reload them. ("operate") - [+] crash when loading map with water - [+] SAVE OBJECT CONTENTSk - [+] monsters with jobs aren't getting start items - [+] shopkeeper has shotgun - [+] bug: monster keeps swapping between shotgun and flail - [+] when hiring, remember failure. * [+] Inn - [+] bug: pets fighting!!! then they all turn on you. never make allies get angry unless the attacker is the player * [+] hiring npcs - [+] chat to pet: "stay close" or "keep your distance" - [+] new 'furniture' obclass - [+] allow for 'randomshop' regiontype * [+] add enchantment school - [+] cast a scroll of mending on itself. CRASH. * [+] lessengravity should make you jump better and get knocked back further - [+] boostgrav/lessengrav cancel out each other. * [+] CRASH when you fall down a hole and die. - [+] problem: master gravitation doesn't let us cast levitat. getspellschoolknown() should return the HIGHEST known skill, not the first. * [+] bug: dregion is null?!??! * [+] dig a pit, if you cleared out land below, you just stay down there. - [+] potion of leveitation - [+] warning msg when levitate is about to expire * [+] if you fall upwards to the surface... * [+] if you are ever on the surface while levitating.... - [+] BUG: cna't go up stairs to surface anymore!!!!! - [+] get hungry LOTS more quickly when you start sprinting * [+] monk slow metabolism psionic pell. - [+] fix buf with lore giving LESS accuracy instead of more. - [+] food shop - [+] wand of digging not identified if you dig upwards * [+] when you make ah ole in the roof, objects above should fall through right away * [+] all towns should have: - [+] give monks more psionics spells. - [+] sk_throwing skill - [+] make calm animals use spellpower * [+] add wisdom * [+] need to save region data along with maps * [+] COMBINE armour evasion and accuracy penalty!!! * [+] make armour reduce accuracy as well (unless you have 'armour' skill) - [+] landmine trap * [+] make friendly monsters of same raceclass swap ammo - [+] rename 'pull' to 'suck' to avoid confusion with pull metal * [+] food to fix blindness - [+] potion of coffee * [+] genericise statbrackets * [+] tumble ability * [+] simplify spell power * [+] shopkeeprs should be allowed to pursue targets outside of the shop. - [+] give shopkeepers a shotgun * [+] make F_RNDHOSTILE be able to ahve a random chance. * [+] if you randomly generate food in a shop, still give it a price. - [+] if peaceful humanoid walks into you, "sorry!" - [+] sayphrase(lf, SP_SORRY, vol) - [+] only let you recruit jobs with j_recruitable - [+] CRASH - summon "monk" - [+] dogs, - [+] chickens, - [+] drunks, * [+] village objects - [+] change armourrating AGAIN. instead of a percentage, make it a number. - [+] rename inn to "pub", since you can't sleep there. * [+] random speech code * [+] genericise sayphrase text based on lf's job * [+] monks - add rest of abliities - [+] add fiengdeath ability to some monsters
2011-07-14 07:40:28 +10:00
fscanf(f, "region:%d\n",&regionid); // region id
m->region = findregion(regionid);
2011-02-01 06:16:13 +11:00
fscanf(f, "depth:%d\n",&m->depth); // map depth
2010-12-02 12:17:54 +11:00
fgets(buf, BUFLEN, f); // map name
buf[strlen(buf)-1] = '\0'; // strip newline
m->name = strdup(buf + 5); // after 'name:'
* [+] make vending machines use this container code instead. - [+] don't say "you see a few things" if one of them is footsteps * [+] IFMONSTER code failing....because flags are now SORTED!!! - [+] tumble - askcoords is letting us pick a cell we don't have lof to. * [+] assign a name to lfs once you hire them * [+] coloured msgtext - [+] make min dam reduction from AR be AR/5. - [+] safebox - [+] if intelligent, prompt before walking into RESTRICTMOVEMENT with no getsweaker (val1) * [+] make fire / ice damage mor elike netheck - [+] towns should have gates on EVERY side - [+] forest cells outside town gates need to be CLEARED. (maybe turn to dirt) - [+] fix up knock targetting to include magical barriers - [+] say "open a bag?" not "operate a bag?" * [+] implement immunetodisease - [+] sort known skills in @s. - [+] better damage bonus when attacking someone who is asleep - [+] practive firearms/throwing * [+] need objecttype->size * [+] containers * [+] change guns so you have to reload them. ("operate") - [+] crash when loading map with water - [+] SAVE OBJECT CONTENTSk - [+] monsters with jobs aren't getting start items - [+] shopkeeper has shotgun - [+] bug: monster keeps swapping between shotgun and flail - [+] when hiring, remember failure. * [+] Inn - [+] bug: pets fighting!!! then they all turn on you. never make allies get angry unless the attacker is the player * [+] hiring npcs - [+] chat to pet: "stay close" or "keep your distance" - [+] new 'furniture' obclass - [+] allow for 'randomshop' regiontype * [+] add enchantment school - [+] cast a scroll of mending on itself. CRASH. * [+] lessengravity should make you jump better and get knocked back further - [+] boostgrav/lessengrav cancel out each other. * [+] CRASH when you fall down a hole and die. - [+] problem: master gravitation doesn't let us cast levitat. getspellschoolknown() should return the HIGHEST known skill, not the first. * [+] bug: dregion is null?!??! * [+] dig a pit, if you cleared out land below, you just stay down there. - [+] potion of leveitation - [+] warning msg when levitate is about to expire * [+] if you fall upwards to the surface... * [+] if you are ever on the surface while levitating.... - [+] BUG: cna't go up stairs to surface anymore!!!!! - [+] get hungry LOTS more quickly when you start sprinting * [+] monk slow metabolism psionic pell. - [+] fix buf with lore giving LESS accuracy instead of more. - [+] food shop - [+] wand of digging not identified if you dig upwards * [+] when you make ah ole in the roof, objects above should fall through right away * [+] all towns should have: - [+] give monks more psionics spells. - [+] sk_throwing skill - [+] make calm animals use spellpower * [+] add wisdom * [+] need to save region data along with maps * [+] COMBINE armour evasion and accuracy penalty!!! * [+] make armour reduce accuracy as well (unless you have 'armour' skill) - [+] landmine trap * [+] make friendly monsters of same raceclass swap ammo - [+] rename 'pull' to 'suck' to avoid confusion with pull metal * [+] food to fix blindness - [+] potion of coffee * [+] genericise statbrackets * [+] tumble ability * [+] simplify spell power * [+] shopkeeprs should be allowed to pursue targets outside of the shop. - [+] give shopkeepers a shotgun * [+] make F_RNDHOSTILE be able to ahve a random chance. * [+] if you randomly generate food in a shop, still give it a price. - [+] if peaceful humanoid walks into you, "sorry!" - [+] sayphrase(lf, SP_SORRY, vol) - [+] only let you recruit jobs with j_recruitable - [+] CRASH - summon "monk" - [+] dogs, - [+] chickens, - [+] drunks, * [+] village objects - [+] change armourrating AGAIN. instead of a percentage, make it a number. - [+] rename inn to "pub", since you can't sleep there. * [+] random speech code * [+] genericise sayphrase text based on lf's job * [+] monks - add rest of abliities - [+] add fiengdeath ability to some monsters
2011-07-14 07:40:28 +10:00
fscanf(f, "habitat:%d\n",(int *)&habitatid); // habitat
m->habitat = findhabitat(habitatid);
2010-12-02 12:17:54 +11:00
fscanf(f, "seed:%d\n",&m->seed); // seed
fscanf(f, "lastplayervisit:%ld\n",&m->lastplayervisit);
2010-12-02 12:17:54 +11:00
fscanf(f, "dims:%d,%d\n",&m->w, &m->h); // map dimensons
fscanf(f, "nextmaps:\n");
for (i = 0; i < MAXDIR_ORTH; i++) {
fscanf(f, "%d\n",&m->nextmap[i]); // map dimensons
}
if (db) dblog("--> Finished map info. name='%s', dims=%d x %d\n",m->name, m->w, m->h);
* [+] backstab - [+] monsters start asleep and make spot checks ? - [+] make them start asleep - [+] then make this random - [+] sound will wake them (ie. "makenoise") - [+] when you move, make SC_STEALTH check. if you fail, you make noise! - [+] must pass LISTEN check OR have los to hear something. - [+] "the blowfly falls asleep" "the blowfly appears" when summoned. - [+] don't show 'falls asleep' while being created! * [+] don't start summoned mosnters asleep! * [+] clean up bresnham functions - [+] hearing - instead of just using distance, use distance modiied by # of walls! - [+] getcelldistsound() - each wall counts as an extra cell! - [+] add WALK/FLY noises to all monsters! - [+] don't show 'you hear xxx' when resting. - [+] extra damage for weapon skill (up to 50% extra) - [+] make broken glass crushable - [+] only interrupt rest for non-peaceful, non-friendly monsters - [+] save to fight off poison * [+] beholder is never using its BITE attack * [+] need a price for manuals!! * [+] change"dobresnham" to populate an array of cells - [+] make ai cast animate metal (if they ahve a second weapon) - [+] implement getallegiance() to clean up isfriendly / ispeaceful etc - [+] bug - f_else f_ifpct etc not working in startobs * [+] OT_S_CHARM - [+] update askcoords to show "weilding x AND Y" - [+] stop enemies from throwing firearm ammo somehow * [+] implement - [+] pacify spell - [+] make spellbooks less common - [+] detectmetal not wokring. fixed. - [+] detectobjects spell - [+] cleanup using flagcausesredraw() - [+] increase odds of weapons in rooms, and max ob count in rooms
2011-03-24 16:09:31 +11:00
fscanf(f, "beingcreated:%d\n",&m->beingcreated);
2010-12-02 12:17:54 +11:00
fscanf(f, "id:%d\n",&m->id); // map id
// load lifeforms
if (db) dblog("--> Loading lifeforms...\n");
fscanf(f, "lifeforms:\n");
fscanf(f, "%s\n",buf);
while (!strcmp(buf ,"startlf")) {
loadlf(f, dummycell);
// check for more lifeforms...
fscanf(f, "%s\n",buf);
}
// load room defs
fscanf(f, "nrooms:%d\n",&m->nrooms);
for (i = 0; i < m->nrooms; i++) {
fscanf(f, "%d,%d,%d,%d,%d,%s\n",&m->room[i].id,
&m->room[i].x1, &m->room[i].y1,
&m->room[i].x2, &m->room[i].y2, buf);
m->room[i].vault = findvault(buf);
}
2010-12-02 12:17:54 +11:00
// load cells
if (db) dblog("--> Loading map cells...\n");
fscanf(f, "cells:\n");
for (y = 0; y < m->h; y++) {
for (x = 0; x < m->w; x++) {
cell_t *c;
celltype_t *ct;
int celltypeid;
long obid;
- [+] thrown objects taking no damage due to hardness * [+] DIETY is slow. - [+] map bug - from 0,0, walk NE (off top edge). i end up at 0,0 again!!! * [+] ALLOW ROTATING OF VAULTS - [+] BUG: dig X only goes 1 cell. - [+] add a U shaped turn vault. - [+] change wehre i apply HADRNESS for lfs! - don't use adjustdammaterial cause we inherit there - [+] make obchance/thingchance part of habitat_t - [+] make sense surroundings take cartography skill into account * [+] BUG: rotated at() etc not working. - [+] if you fail stealing, the target should get angry!!! - [+] make sure to redraw stat bar when mind scan finishes. - [+] villages - [+] initial code * [+] town gaurds. stand next to the gate - [+] potion shop vault - [+] implement - [+] potion shop isn't getting potions!! - [+] and getting wrong floor type. * [+] stop shop from always being at the top left. - [+] make sure its x/y arent too close to edge of map (at least 5 away) - [+] vault param. f_mapmargin, 5 - [+] make calcroompos take x/y margin - [+] don't put auto obs inside vaults - [+] town walls - [+] more kinds of shops * [+] signs outside shops - [+] bug with ai swapping between firearms and twohanded weapons. fixed. * [+] make _CELLS_ have habitats! - [+] move vaultchance to a habitat param instead of getvaultchance() * [+] shopkeepers (special race) village things: - [+] barrels, - [+] guards, - [+] statue - [+] thrown objects should still take damage if blocked via a shield * [+] hardness (must do dam >= xx to hurt) * [+] WATER spread mods * [+] very powerful spells have casttime - [+] allow linkstairs() to take a parameter rather than always jsut searching for the other end - [+] when digging holes, only use getrandomadjcell if there is an lf in the way. and then use WE_NOLF. clear out solid cells - [+] show armour EVASION penalty in describeob - [+] teleportation trap. You reintegrate inside a solid object! You die.--More--. - [+] riverroom vault * [+] water: swap { and ~ again?? - [+] make "large puddle of water" evaporate more quickly * [+] special glyph case: for deep water
2011-06-29 18:48:48 +10:00
int temphab;
int roomid;
2010-12-02 12:17:54 +11:00
//if (db) dblog("cell %d,%d...",x,y);
// allocate this cell
c = addcell(m, x, y);
// cell info
fscanf(f, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
&roomid, &celltypeid, &c->known, &c->knownglyph.ch, &c->knownglyph.colour, &c->visited, &c->lit, &c->origlit, &c->littimer,&temphab);
- [+] thrown objects taking no damage due to hardness * [+] DIETY is slow. - [+] map bug - from 0,0, walk NE (off top edge). i end up at 0,0 again!!! * [+] ALLOW ROTATING OF VAULTS - [+] BUG: dig X only goes 1 cell. - [+] add a U shaped turn vault. - [+] change wehre i apply HADRNESS for lfs! - don't use adjustdammaterial cause we inherit there - [+] make obchance/thingchance part of habitat_t - [+] make sense surroundings take cartography skill into account * [+] BUG: rotated at() etc not working. - [+] if you fail stealing, the target should get angry!!! - [+] make sure to redraw stat bar when mind scan finishes. - [+] villages - [+] initial code * [+] town gaurds. stand next to the gate - [+] potion shop vault - [+] implement - [+] potion shop isn't getting potions!! - [+] and getting wrong floor type. * [+] stop shop from always being at the top left. - [+] make sure its x/y arent too close to edge of map (at least 5 away) - [+] vault param. f_mapmargin, 5 - [+] make calcroompos take x/y margin - [+] don't put auto obs inside vaults - [+] town walls - [+] more kinds of shops * [+] signs outside shops - [+] bug with ai swapping between firearms and twohanded weapons. fixed. * [+] make _CELLS_ have habitats! - [+] move vaultchance to a habitat param instead of getvaultchance() * [+] shopkeepers (special race) village things: - [+] barrels, - [+] guards, - [+] statue - [+] thrown objects should still take damage if blocked via a shield * [+] hardness (must do dam >= xx to hurt) * [+] WATER spread mods * [+] very powerful spells have casttime - [+] allow linkstairs() to take a parameter rather than always jsut searching for the other end - [+] when digging holes, only use getrandomadjcell if there is an lf in the way. and then use WE_NOLF. clear out solid cells - [+] show armour EVASION penalty in describeob - [+] teleportation trap. You reintegrate inside a solid object! You die.--More--. - [+] riverroom vault * [+] water: swap { and ~ again?? - [+] make "large puddle of water" evaporate more quickly * [+] special glyph case: for deep water
2011-06-29 18:48:48 +10:00
c->habitat = findhabitat(temphab);
2010-12-02 12:17:54 +11:00
c->room = findroom(m, roomid);
2010-12-02 12:17:54 +11:00
ct = findcelltype(celltypeid);
if (ct) {
c->type = ct;
} else {
dblog("ERROR loading map cells - can't find celltype id %ld\n",celltypeid);
exit(1);
}
// cell objects
obcount = 0;
fscanf(f, "ob:%ld\n",&obid);
while (obid != -1) {
c->obpile->oblist[obcount] = obid;
obcount++;
fscanf(f, "ob:%ld\n",&obid);
}
// terminate with -1s!
for (i = obcount ; i < MAXPILEOBS; i++) {
c->obpile->oblist[i] = -1;
}
}
}
// load object definitions
if (db) dblog("--> Loading object definitions for map obs...\n");
fscanf(f, "MAPOBS:%d\n",&obcount); // how many obs?
// create all objects in a dummy cell
for (i = 0; i < obcount; i++) {
2010-12-07 18:34:26 +11:00
long thisid;
if (db) dblog("-----> loading into dummycell: mapob %d/%d...\n",i+1,obcount);
if (loadob(f, dummycell->obpile, &thisid)) {
2010-12-02 12:17:54 +11:00
dblog("Error - can't create object %d/%d!\n",i+1,obcount);
exit(1);
}
2010-12-07 18:34:26 +11:00
if (db) dblog("----------> got obid %ld\n",thisid);
// check!
if (!hasobid(dummycell->obpile, thisid)) {
dblog("Error: after loading obid %ld, can't find it in dummycell!\n",thisid);
exit(1);
}
2010-12-02 12:17:54 +11:00
}
// hand out the objects to lifeforms...
2010-12-07 18:34:26 +11:00
/*
2010-12-02 12:17:54 +11:00
for (l = m->lf ; l ; l = l->next) {
int curob = 0;
long obid;
obid = l->pack->oblist[curob];
while (obid != -1) {
int found = B_FALSE;
// find this ob id in the dummycell
for (o = dummycell->obpile->first ; o ; o = nexto) {
nexto = o->next;
if (o->id == obid) {
relinkob(o, l->pack);
found = B_TRUE;
break;
}
}
if (!found) {
2010-12-07 18:34:26 +11:00
dblog("Error loading obs - lf %d should have obid %ld but can't find it in dummycell.\n",l->id, obid);
2010-12-02 12:17:54 +11:00
exit(1);
}
// next one
curob++;
obid = l->pack->oblist[curob];
}
// clear the oblist
for (i = 0; i < MAXPILEOBS; i++) {
l->pack->oblist[i] = -1;
}
}
2010-12-07 18:34:26 +11:00
*/
2010-12-02 12:17:54 +11:00
// hand out objects to cells
for (y = 0; y < m->h; y++) {
for (x = 0; x < m->w; x++) {
cell_t *c;
long obid;
int curob = 0;
c = m->cell[y * m->w + x];
obid = c->obpile->oblist[curob];
2010-12-07 18:34:26 +11:00
dblog("Handing out objects to cell %d,%d\n",x,y);
2010-12-02 12:17:54 +11:00
while (obid != -1) {
2010-12-07 18:34:26 +11:00
dblog(" Looking for obid %ld in dummycell...",obid);
2010-12-02 12:17:54 +11:00
// find this ob id in the dummycell
2010-12-07 18:34:26 +11:00
o = hasobid(dummycell->obpile, obid);
if (o) {
dblog(" Got it.");
relinkob(o, c->obpile);
} else {
dblog(" Error loading obs - cell %d,%d should have obid %ld but can't find it.\n",x,y, obid);
2010-12-02 12:17:54 +11:00
exit(1);
}
// next one
curob++;
2010-12-07 18:34:26 +11:00
obid = c->obpile->oblist[curob];
2010-12-02 12:17:54 +11:00
}
// clear the oblist
for (i = 0; i < MAXPILEOBS; i++) {
c->obpile->oblist[i] = -1;
}
}
}
2011-05-20 06:30:58 +10:00
// load flags
loadflagpile(f, m->flags);
2010-12-02 12:17:54 +11:00
fclose(f);
// move lifeforms to their proper locations
for (l = m->lf ; l ; l = l->next) {
cell_t *c;
c = getcellat(m, l->x, l->y);
if (!c) {
dblog("Error loading map - Can't find cell at %d,%d to place lifeform id %d.\n",
l->x, l->y, l->id);
exit(1);
}
movelf(l, c);
//dblog("Moving lf %d to %d,%d\n",l->id, l->x, l->y);
}
free(dummycell);
2010-12-07 18:34:26 +11:00
// successful load - kill the map now
unlink(filename);
2010-12-02 12:17:54 +11:00
return m;
}
2010-12-07 18:34:26 +11:00
int loadob(FILE *f, obpile_t *op, long *id) {
2010-12-02 12:17:54 +11:00
objecttype_t *ot;
object_t *o;
material_t *mat;
long obid;
int otid,matid;
char buf[BUFLEN];
2010-12-07 18:34:26 +11:00
int db = B_TRUE;
2010-12-02 12:17:54 +11:00
fscanf(f, "id:%ld\n",&obid);
fscanf(f, "type:%d\n",&otid);
2010-12-07 18:34:26 +11:00
if (db) dblog("... loading object id %ld",obid);
if (id) {
*id = obid;
}
2010-12-02 12:17:54 +11:00
ot = findot(otid);
if (!ot) {
2011-02-01 06:16:13 +11:00
dblog("ERROR loading objects - can't find obtype id %d (obj id %ld)\n",otid,obid);
2010-12-02 12:17:54 +11:00
return B_TRUE;
}
// create the object
o = addobject(op, NULL, B_NOSTACK, B_FALSE, ot->id); // no stacking!
2010-12-02 12:17:54 +11:00
// overwrite ob parameters
o->id = obid;
fscanf(f, "material:%d\n",&matid);
mat = findmaterial(matid);
if (!mat) {
dblog("ERROR loading objects - can't find material %d\n",matid);
return B_TRUE;
}
o->material = mat;
fscanf(f, "weight:%f\n",&o->weight);
fgets(buf, BUFLEN, f); // inscription
buf[strlen(buf)-1] = '\0'; // strip newline
o->inscription = strdup(buf + 6); // after 'inscr:'
if (!strcmp(o->inscription, "^^^")) { // ie. if equal to ^^^...
free(o->inscription);
o->inscription = NULL;
}
fscanf(f, "letter:%c\n",&o->letter);
fscanf(f, "bless:%d\n",&o->blessed);
fscanf(f, "blessknown:%d\n",&o->blessknown);
fscanf(f, "amt:%d\n",&o->amt);
2011-02-01 06:16:13 +11:00
fscanf(f, "birthtime:%ld\n",&o->birthtime);
2010-12-02 12:17:54 +11:00
2011-02-01 06:16:13 +11:00
// now remove ALL obejct flags (which were inherited
// from the obtype during addobject() ). these will be
// loaded in instead.
2010-12-02 12:17:54 +11:00
2011-02-01 06:16:13 +11:00
while (o->flags->first) {
killflag(o->flags->first);
}
2010-12-07 18:34:26 +11:00
2011-02-01 06:16:13 +11:00
fscanf(f, "flags:\n");
2010-12-02 12:17:54 +11:00
2011-02-01 06:16:13 +11:00
dblog("About to start loading object flags...");
loadflagpile(f, o->flags);
* [+] make vending machines use this container code instead. - [+] don't say "you see a few things" if one of them is footsteps * [+] IFMONSTER code failing....because flags are now SORTED!!! - [+] tumble - askcoords is letting us pick a cell we don't have lof to. * [+] assign a name to lfs once you hire them * [+] coloured msgtext - [+] make min dam reduction from AR be AR/5. - [+] safebox - [+] if intelligent, prompt before walking into RESTRICTMOVEMENT with no getsweaker (val1) * [+] make fire / ice damage mor elike netheck - [+] towns should have gates on EVERY side - [+] forest cells outside town gates need to be CLEARED. (maybe turn to dirt) - [+] fix up knock targetting to include magical barriers - [+] say "open a bag?" not "operate a bag?" * [+] implement immunetodisease - [+] sort known skills in @s. - [+] better damage bonus when attacking someone who is asleep - [+] practive firearms/throwing * [+] need objecttype->size * [+] containers * [+] change guns so you have to reload them. ("operate") - [+] crash when loading map with water - [+] SAVE OBJECT CONTENTSk - [+] monsters with jobs aren't getting start items - [+] shopkeeper has shotgun - [+] bug: monster keeps swapping between shotgun and flail - [+] when hiring, remember failure. * [+] Inn - [+] bug: pets fighting!!! then they all turn on you. never make allies get angry unless the attacker is the player * [+] hiring npcs - [+] chat to pet: "stay close" or "keep your distance" - [+] new 'furniture' obclass - [+] allow for 'randomshop' regiontype * [+] add enchantment school - [+] cast a scroll of mending on itself. CRASH. * [+] lessengravity should make you jump better and get knocked back further - [+] boostgrav/lessengrav cancel out each other. * [+] CRASH when you fall down a hole and die. - [+] problem: master gravitation doesn't let us cast levitat. getspellschoolknown() should return the HIGHEST known skill, not the first. * [+] bug: dregion is null?!??! * [+] dig a pit, if you cleared out land below, you just stay down there. - [+] potion of leveitation - [+] warning msg when levitate is about to expire * [+] if you fall upwards to the surface... * [+] if you are ever on the surface while levitating.... - [+] BUG: cna't go up stairs to surface anymore!!!!! - [+] get hungry LOTS more quickly when you start sprinting * [+] monk slow metabolism psionic pell. - [+] fix buf with lore giving LESS accuracy instead of more. - [+] food shop - [+] wand of digging not identified if you dig upwards * [+] when you make ah ole in the roof, objects above should fall through right away * [+] all towns should have: - [+] give monks more psionics spells. - [+] sk_throwing skill - [+] make calm animals use spellpower * [+] add wisdom * [+] need to save region data along with maps * [+] COMBINE armour evasion and accuracy penalty!!! * [+] make armour reduce accuracy as well (unless you have 'armour' skill) - [+] landmine trap * [+] make friendly monsters of same raceclass swap ammo - [+] rename 'pull' to 'suck' to avoid confusion with pull metal * [+] food to fix blindness - [+] potion of coffee * [+] genericise statbrackets * [+] tumble ability * [+] simplify spell power * [+] shopkeeprs should be allowed to pursue targets outside of the shop. - [+] give shopkeepers a shotgun * [+] make F_RNDHOSTILE be able to ahve a random chance. * [+] if you randomly generate food in a shop, still give it a price. - [+] if peaceful humanoid walks into you, "sorry!" - [+] sayphrase(lf, SP_SORRY, vol) - [+] only let you recruit jobs with j_recruitable - [+] CRASH - summon "monk" - [+] dogs, - [+] chickens, - [+] drunks, * [+] village objects - [+] change armourrating AGAIN. instead of a percentage, make it a number. - [+] rename inn to "pub", since you can't sleep there. * [+] random speech code * [+] genericise sayphrase text based on lf's job * [+] monks - add rest of abliities - [+] add fiengdeath ability to some monsters
2011-07-14 07:40:28 +10:00
fgets(buf, BUFLEN, f);// either 'obcontents:xx' or 'endob'
if (strstarts(buf, "obcontents")) {
// load this object's contents...
char *p;
char buf2[BUFLEN];
int ncontents;
int i;
//dblog("got obcontents");
// strip newline
buf[strlen(buf)-1] = '\0';
p = readuntil(buf2, buf, ':'); // ignore bit before :
p = readuntil(buf2, p, ')'); // ) will really be eol
ncontents = atoi(buf2);
for (i = 0 ; i < ncontents; i++) {
loadob(f, o->contents, NULL);
}
fgets(buf, BUFLEN, f);// 'endobcontents'
//dblog("want endobcontents, got: '%s'", buf);
fgets(buf, BUFLEN, f);// 'endob'
//dblog("want endob, got: '%s'", buf);
}
if (strstarts(buf, "endob")) {
// we got 'endob'
} else {
dblog("ERROR loading objects - expecting 'endob' but got '%s'\n",buf);
exit(1);
}
//fscanf(f, "endob\n");
return B_FALSE;
}
int loadregions(void) {
FILE *f;
char filename[BUFLEN];
int rtid,nthings,i,n;
int numoutlines,numregions;
int db = B_FALSE;
// TODO: check that map dir exists
sprintf(filename, "%s/regions.dat",MAPDIR);
f = fopen(filename, "rt");
if (!f) {
return B_TRUE;
}
fscanf(f, "numoutlines:%d\n",&numoutlines);
if (db) dblog("Found %d region outlines.\n",numoutlines);
for (n = 0; n < numoutlines; n++) {
fscanf(f, "startro\n");
fscanf(f, "rtypeid:%d\n",&rtid); // region type id
addregionoutline(rtid);
fscanf(f, "nthings:%d\n",&nthings);
for (i = 0; i < nthings; i++) {
int depth,x,y,val;
enum REGIONTHING whatkind;
char buf[BUFLEN],*p;
fscanf(f, "startthing\n");
fscanf(f, " thingdepth:%d,%d,%d\n",&depth, &x, &y);
fscanf(f, " thingkind:%d\n",(int *)&whatkind);
fscanf(f, " thingval:%d\n",&val);
fscanf(f, " thingwhat:%s\n",buf);
fscanf(f, "endthing\n");
// replace ^ with ' ' in thingwhat
for (p = buf ; *p; p++) {
if (*p == '^') *p = ' ';
}
addregionthing(lastregionoutline, depth, x, y, whatkind, val, streq(buf, "NULL") ? NULL : buf);
}
fscanf(f, "endro\n");
if (db) dblog("Loaded regionoutline #%d / %d",n+1, numoutlines);
}
// now save out the actual region->outline mappings
fscanf(f, "numregions:%d\n",&numregions);
if (db) dblog("Found %d regions.\n",numregions);
for (n = 0; n < numregions; n++) {
region_t *r;
enum REGIONTYPE rtid;
int outlineid,parentid,nthings;
fscanf(f, "startregion\n");
fscanf(f, " rtypeid:%d\n",(int *)&rtid);
fscanf(f, " outline:%d\n",&outlineid);
fscanf(f, " parentregion:%d\n",&parentid);
fscanf(f, " nthings:%d\n",&nthings);
fscanf(f, "endregion\n");
r = addregion(rtid, (parentid == -1) ? NULL : findregion(parentid), outlineid);
r->nthings = nthings;
if (db) dblog("Loaded region #%d / %d",n+1, numregions);
}
fclose(f);
// successful load - kill the file now
unlink(filename);
2010-12-02 12:17:54 +11:00
return B_FALSE;
}
int loadsavegame(void) {
DIR *dir;
struct dirent *ent;
char filename[BUFLEN];
FILE *f;
// now see if there is a savegame...
dir = opendir(SAVEDIR);
if (!dir) {
dblog("Could not open savegame directory '%s'",SAVEDIR);
return B_TRUE;
}
ent = readdir(dir);
while ((ent = readdir(dir)) != NULL) {
char *p;
// ie. start of 4 char prefix
p = ent->d_name + strlen(ent->d_name) - 4;
// load this savegame
if (!strcmp(p, ".sav") ) {
sprintf(filename, "%s/%s",SAVEDIR,ent->d_name);
dblog("Trying to load from %s\n",filename);
f = fopen(filename, "rt");
if (!f) {
printf("Error opening savegame file '%s'",ent->d_name);
exit(1);
}
if (!loadlf(f, NULL)) {
* [+] make vending machines use this container code instead. - [+] don't say "you see a few things" if one of them is footsteps * [+] IFMONSTER code failing....because flags are now SORTED!!! - [+] tumble - askcoords is letting us pick a cell we don't have lof to. * [+] assign a name to lfs once you hire them * [+] coloured msgtext - [+] make min dam reduction from AR be AR/5. - [+] safebox - [+] if intelligent, prompt before walking into RESTRICTMOVEMENT with no getsweaker (val1) * [+] make fire / ice damage mor elike netheck - [+] towns should have gates on EVERY side - [+] forest cells outside town gates need to be CLEARED. (maybe turn to dirt) - [+] fix up knock targetting to include magical barriers - [+] say "open a bag?" not "operate a bag?" * [+] implement immunetodisease - [+] sort known skills in @s. - [+] better damage bonus when attacking someone who is asleep - [+] practive firearms/throwing * [+] need objecttype->size * [+] containers * [+] change guns so you have to reload them. ("operate") - [+] crash when loading map with water - [+] SAVE OBJECT CONTENTSk - [+] monsters with jobs aren't getting start items - [+] shopkeeper has shotgun - [+] bug: monster keeps swapping between shotgun and flail - [+] when hiring, remember failure. * [+] Inn - [+] bug: pets fighting!!! then they all turn on you. never make allies get angry unless the attacker is the player * [+] hiring npcs - [+] chat to pet: "stay close" or "keep your distance" - [+] new 'furniture' obclass - [+] allow for 'randomshop' regiontype * [+] add enchantment school - [+] cast a scroll of mending on itself. CRASH. * [+] lessengravity should make you jump better and get knocked back further - [+] boostgrav/lessengrav cancel out each other. * [+] CRASH when you fall down a hole and die. - [+] problem: master gravitation doesn't let us cast levitat. getspellschoolknown() should return the HIGHEST known skill, not the first. * [+] bug: dregion is null?!??! * [+] dig a pit, if you cleared out land below, you just stay down there. - [+] potion of leveitation - [+] warning msg when levitate is about to expire * [+] if you fall upwards to the surface... * [+] if you are ever on the surface while levitating.... - [+] BUG: cna't go up stairs to surface anymore!!!!! - [+] get hungry LOTS more quickly when you start sprinting * [+] monk slow metabolism psionic pell. - [+] fix buf with lore giving LESS accuracy instead of more. - [+] food shop - [+] wand of digging not identified if you dig upwards * [+] when you make ah ole in the roof, objects above should fall through right away * [+] all towns should have: - [+] give monks more psionics spells. - [+] sk_throwing skill - [+] make calm animals use spellpower * [+] add wisdom * [+] need to save region data along with maps * [+] COMBINE armour evasion and accuracy penalty!!! * [+] make armour reduce accuracy as well (unless you have 'armour' skill) - [+] landmine trap * [+] make friendly monsters of same raceclass swap ammo - [+] rename 'pull' to 'suck' to avoid confusion with pull metal * [+] food to fix blindness - [+] potion of coffee * [+] genericise statbrackets * [+] tumble ability * [+] simplify spell power * [+] shopkeeprs should be allowed to pursue targets outside of the shop. - [+] give shopkeepers a shotgun * [+] make F_RNDHOSTILE be able to ahve a random chance. * [+] if you randomly generate food in a shop, still give it a price. - [+] if peaceful humanoid walks into you, "sorry!" - [+] sayphrase(lf, SP_SORRY, vol) - [+] only let you recruit jobs with j_recruitable - [+] CRASH - summon "monk" - [+] dogs, - [+] chickens, - [+] drunks, * [+] village objects - [+] change armourrating AGAIN. instead of a percentage, make it a number. - [+] rename inn to "pub", since you can't sleep there. * [+] random speech code * [+] genericise sayphrase text based on lf's job * [+] monks - add rest of abliities - [+] add fiengdeath ability to some monsters
2011-07-14 07:40:28 +10:00
printf("Error loading player from file '%s'",ent->d_name);
2010-12-02 12:17:54 +11:00
exit(1);
}
2010-12-07 18:34:26 +11:00
if (loadknowledge(f)) {
printf("Error loading knowledge from file '%s'",ent->d_name);
exit(1);
}
2011-02-01 06:16:13 +11:00
if (loadvars(f)) {
printf("Error loading game variables from file '%s'",ent->d_name);
exit(1);
}
2010-12-02 12:17:54 +11:00
fclose(f);
// successful load - kill the savegame now
unlink(filename);
break;
}
}
closedir(dir);
2011-02-01 06:16:13 +11:00
return B_FALSE;
}
int savevars(FILE *f) {
int db = B_FALSE;
if (db) dblog("--> Saving knowledge...\n");
fprintf(f, "startvars\n");
fprintf(f, "curtime:%ld\n",curtime);
fprintf(f, "endvars\n");
return B_FALSE;
}
int saveflagpile(FILE *f, flagpile_t *fp) {
flag_t *fl;
fprintf(f, "flags:\n");
for (fl = fp->first ; fl ; fl = fl->next) {
fprintf(f, "%d,%d,%d,%d,%d,%d,%d,%ld\n",
fl->id, fl->nvals, fl->val[0], fl->val[1], fl->val[2],fl->lifetime,fl->known,fl->obfrom);
if (!fl->text || !strcmp(fl->text, "")) {
fprintf(f, "%s\n","^^^");
} else {
fprintf(f, "%s\n",fl->text);
}
}
fprintf(f, "-1,-1,-1,-1,-1,-1,-1,-1\n");
2010-12-02 12:17:54 +11:00
return B_FALSE;
}
2010-12-07 18:34:26 +11:00
int saveknowledge(FILE *f) {
int db = B_FALSE;
knowledge_t *k;
if (db) dblog("--> Saving knowledge...\n");
fprintf(f, "startknowledge\n");
for (k = knowledge; k ; k = k->next) {
fprintf(f, "%d^%s^%d\n",k->id, k->hiddenname, k->known);
}
fprintf(f, "endknowledge\n");
return B_FALSE;
}
2010-12-02 12:17:54 +11:00
int savelf(FILE *f, lifeform_t *l) {
object_t *o;
int obcount = 0;
// save this lf
fprintf(f, "startlf\n");
fprintf(f, "lfid: %d\n",l->id);
fprintf(f, "race: %d\n",l->race->id);
fprintf(f, "map: %d\n",l->cell->map->id);
fprintf(f, "pos: %d,%d\n",l->cell->x, l->cell->y);
2010-12-07 18:34:26 +11:00
fprintf(f, "level: %d\n",l->level);
- [+] young hawk moving very slowly? was healing. - [+] make monsters heal faster when resting - [+] make pet rest when you do - [+] allow 'R' to heal allies - [+] F_RESTUNTILALLIES - [+] mindless/animal mosnters won't throw things - [+] announceflag for attrset not working * [+] feeblemind spell - reduces intelligence to ANIMAL. - [+] ai: if we are carrying too much, drop something (non-weapons/armour first) - [+] teleport spell should teleport any adjacent allies too. * [+] new 'C'hat commands: * [+] change 'resist elements' potion to 'rum' * [+] notify when pet is low on hp - [+] why could a pirate use a biuckler? * [+] genericise usage of canhaveobmod! - [+] armour mod: blooodstained. adds scary. - [+] CRASH when you have two weapons and catch a glowbug in your flask. * [+] potion of restoration onto frozen axe: - [+] slow spell repeated message: The brown snake looks sluggish. The brown snake is now moving slower. - [+] make you only hear one thing each turn ? - [+] always draw impassable objects on top - [+] special ash - [+] exploding powder - explode in radius 1 around player (including player) - [+] concealing powder - create smoke cloud radius 3 around player - [+] redo levelup logic. - [+] trigger LevUp when you have 'newskillready' - [+] announce when you gain level. - [+] can't gain more experience when LevUp! - [+] only update maxhp/mp from new level after you train - [+] diety can't use abilities. fixed. * [+] when i exit from@S output, statbar isn't redrawn * [+] make SKILLS page show which skills you can learn. - [+] In @s, downline isn't showing the title on the second page of SKILLS... - [+] show POWER in @M spells page - [+] ###--- - [+] show cost RANGE in @M for varpower ones - [+] need getspellcosttext(spellid, power, buf) function - [+] 25-62MP - [+] leftover rubbish chars at end of ---- in doheading() - [+] mosnters should follow you up/down stairs * [+] different poison types - [+] implement tremorsense (like darkvision butrun can't be blinded etc) * [+] implement HIDE ability * [+] Thief job - [+] if you walk into a room and every cell is lit, reveal it all. - [+] auto-learn jump ability with high athletics skill * [+] secret doors - [+] items to spot secret doors - [+] gem of seeing - [+] ENHANCESEARCH - [+] F_SEEINVIS - [+] spell: "reveal hidden" - [+] shows secret doors - [+] removes invisibility - [+] wand of detect hidden - [+] ... casts the spell
2011-04-14 09:44:29 +10:00
fprintf(f, "newlevel: %d\n",l->newlevel);
2011-02-01 06:16:13 +11:00
// liefform will be created after loading the above.
fprintf(f, "str: %d/%d\n",l->att[A_STR],l->baseatt[A_STR]);
fprintf(f, "dex: %d/%d\n",l->att[A_DEX],l->baseatt[A_DEX]);
fprintf(f, "int: %d/%d\n",l->att[A_IQ],l->baseatt[A_IQ]);
fprintf(f, "xp: %ld\n",l->xp);
2011-03-16 15:45:46 +11:00
fprintf(f, "skp: %d\n",l->skillpoints);
2010-12-02 12:17:54 +11:00
fprintf(f, "contr: %d\n",l->controller);
fprintf(f, "hp: %d/%d\n",l->hp, l->maxhp);
2011-02-01 06:16:13 +11:00
fprintf(f, "mp: %d/%d\n",l->mp, l->maxmp);
2010-12-02 12:17:54 +11:00
fprintf(f, "alive: %d\n",l->alive);
2011-02-01 06:16:13 +11:00
fprintf(f, "lastdamtype: %d\n",l->lastdamtype);
2010-12-02 12:17:54 +11:00
fprintf(f, "lastdam: %s\n",l->lastdam);
- [+] thrown objects taking no damage due to hardness * [+] DIETY is slow. - [+] map bug - from 0,0, walk NE (off top edge). i end up at 0,0 again!!! * [+] ALLOW ROTATING OF VAULTS - [+] BUG: dig X only goes 1 cell. - [+] add a U shaped turn vault. - [+] change wehre i apply HADRNESS for lfs! - don't use adjustdammaterial cause we inherit there - [+] make obchance/thingchance part of habitat_t - [+] make sense surroundings take cartography skill into account * [+] BUG: rotated at() etc not working. - [+] if you fail stealing, the target should get angry!!! - [+] make sure to redraw stat bar when mind scan finishes. - [+] villages - [+] initial code * [+] town gaurds. stand next to the gate - [+] potion shop vault - [+] implement - [+] potion shop isn't getting potions!! - [+] and getting wrong floor type. * [+] stop shop from always being at the top left. - [+] make sure its x/y arent too close to edge of map (at least 5 away) - [+] vault param. f_mapmargin, 5 - [+] make calcroompos take x/y margin - [+] don't put auto obs inside vaults - [+] town walls - [+] more kinds of shops * [+] signs outside shops - [+] bug with ai swapping between firearms and twohanded weapons. fixed. * [+] make _CELLS_ have habitats! - [+] move vaultchance to a habitat param instead of getvaultchance() * [+] shopkeepers (special race) village things: - [+] barrels, - [+] guards, - [+] statue - [+] thrown objects should still take damage if blocked via a shield * [+] hardness (must do dam >= xx to hurt) * [+] WATER spread mods * [+] very powerful spells have casttime - [+] allow linkstairs() to take a parameter rather than always jsut searching for the other end - [+] when digging holes, only use getrandomadjcell if there is an lf in the way. and then use WE_NOLF. clear out solid cells - [+] show armour EVASION penalty in describeob - [+] teleportation trap. You reintegrate inside a solid object! You die.--More--. - [+] riverroom vault * [+] water: swap { and ~ again?? - [+] make "large puddle of water" evaporate more quickly * [+] special glyph case: for deep water
2011-06-29 18:48:48 +10:00
fprintf(f, "material: %d\n",l->material->id);
2010-12-02 12:17:54 +11:00
fprintf(f, "timespent: %d\n",l->timespent);
fprintf(f, "sorted: %d\n",l->sorted);
2011-02-01 06:16:13 +11:00
fprintf(f, "polyrevert: %d\n",l->polyrevert);
2010-12-07 18:34:26 +11:00
fprintf(f, "forgettimer: %f\n",l->forgettimer);
2011-02-01 06:16:13 +11:00
// lf flags
saveflagpile(f, l->flags);
2010-12-02 12:17:54 +11:00
// lifeform objects
obcount = 0;
for (o = l->pack->first ; o ; o = o->next) {
fprintf(f, "ob:%ld\n",o->id);
obcount++;
}
fprintf(f, "ob:-1\n");
fprintf(f, "obdefs\n");
// now save our object definitions
for (o = l->pack->first ; o ; o = o->next) {
saveob(f, o);
}
return B_FALSE;
}
2011-02-01 06:16:13 +11:00
int savegame(void) {
map_t *m;
FILE *f;
char buf[BUFLEN];
int rv;
* [+] make vending machines use this container code instead. - [+] don't say "you see a few things" if one of them is footsteps * [+] IFMONSTER code failing....because flags are now SORTED!!! - [+] tumble - askcoords is letting us pick a cell we don't have lof to. * [+] assign a name to lfs once you hire them * [+] coloured msgtext - [+] make min dam reduction from AR be AR/5. - [+] safebox - [+] if intelligent, prompt before walking into RESTRICTMOVEMENT with no getsweaker (val1) * [+] make fire / ice damage mor elike netheck - [+] towns should have gates on EVERY side - [+] forest cells outside town gates need to be CLEARED. (maybe turn to dirt) - [+] fix up knock targetting to include magical barriers - [+] say "open a bag?" not "operate a bag?" * [+] implement immunetodisease - [+] sort known skills in @s. - [+] better damage bonus when attacking someone who is asleep - [+] practive firearms/throwing * [+] need objecttype->size * [+] containers * [+] change guns so you have to reload them. ("operate") - [+] crash when loading map with water - [+] SAVE OBJECT CONTENTSk - [+] monsters with jobs aren't getting start items - [+] shopkeeper has shotgun - [+] bug: monster keeps swapping between shotgun and flail - [+] when hiring, remember failure. * [+] Inn - [+] bug: pets fighting!!! then they all turn on you. never make allies get angry unless the attacker is the player * [+] hiring npcs - [+] chat to pet: "stay close" or "keep your distance" - [+] new 'furniture' obclass - [+] allow for 'randomshop' regiontype * [+] add enchantment school - [+] cast a scroll of mending on itself. CRASH. * [+] lessengravity should make you jump better and get knocked back further - [+] boostgrav/lessengrav cancel out each other. * [+] CRASH when you fall down a hole and die. - [+] problem: master gravitation doesn't let us cast levitat. getspellschoolknown() should return the HIGHEST known skill, not the first. * [+] bug: dregion is null?!??! * [+] dig a pit, if you cleared out land below, you just stay down there. - [+] potion of leveitation - [+] warning msg when levitate is about to expire * [+] if you fall upwards to the surface... * [+] if you are ever on the surface while levitating.... - [+] BUG: cna't go up stairs to surface anymore!!!!! - [+] get hungry LOTS more quickly when you start sprinting * [+] monk slow metabolism psionic pell. - [+] fix buf with lore giving LESS accuracy instead of more. - [+] food shop - [+] wand of digging not identified if you dig upwards * [+] when you make ah ole in the roof, objects above should fall through right away * [+] all towns should have: - [+] give monks more psionics spells. - [+] sk_throwing skill - [+] make calm animals use spellpower * [+] add wisdom * [+] need to save region data along with maps * [+] COMBINE armour evasion and accuracy penalty!!! * [+] make armour reduce accuracy as well (unless you have 'armour' skill) - [+] landmine trap * [+] make friendly monsters of same raceclass swap ammo - [+] rename 'pull' to 'suck' to avoid confusion with pull metal * [+] food to fix blindness - [+] potion of coffee * [+] genericise statbrackets * [+] tumble ability * [+] simplify spell power * [+] shopkeeprs should be allowed to pursue targets outside of the shop. - [+] give shopkeepers a shotgun * [+] make F_RNDHOSTILE be able to ahve a random chance. * [+] if you randomly generate food in a shop, still give it a price. - [+] if peaceful humanoid walks into you, "sorry!" - [+] sayphrase(lf, SP_SORRY, vol) - [+] only let you recruit jobs with j_recruitable - [+] CRASH - summon "monk" - [+] dogs, - [+] chickens, - [+] drunks, * [+] village objects - [+] change armourrating AGAIN. instead of a percentage, make it a number. - [+] rename inn to "pub", since you can't sleep there. * [+] random speech code * [+] genericise sayphrase text based on lf's job * [+] monks - add rest of abliities - [+] add fiengdeath ability to some monsters
2011-07-14 07:40:28 +10:00
rv = saveregions();
if (rv) {
msg("Could not save region data.");
return B_TRUE;
}
2011-02-01 06:16:13 +11:00
for (m = firstmap; m ; m = m->next) {
// save world
rv = savemap(m);
if (rv) {
msg("Could not save map '%s'",m->name);
return B_TRUE;
}
// save player + their objects
sprintf(buf, "%s/game.sav",SAVEDIR);
f = fopen(buf, "wt");
if (!f) {
msg("Could not open save file!");
return B_TRUE;
}
savelf(f, player);
saveknowledge(f);
savevars(f);
fclose(f);
}
return B_FALSE;
}
2010-12-02 12:17:54 +11:00
int savemap(map_t *m) {
FILE *f;
char filename[BUFLEN];
int i;
object_t *o;
lifeform_t *l;
int x,y;
int obcount = 0;
// TODO: check that map dir exists
sprintf(filename, "%s/map%d.map",MAPDIR, m->id);
f = fopen(filename, "wt");
// save map info
fprintf(f, "id:%d\n",m->id); // map id
* [+] make vending machines use this container code instead. - [+] don't say "you see a few things" if one of them is footsteps * [+] IFMONSTER code failing....because flags are now SORTED!!! - [+] tumble - askcoords is letting us pick a cell we don't have lof to. * [+] assign a name to lfs once you hire them * [+] coloured msgtext - [+] make min dam reduction from AR be AR/5. - [+] safebox - [+] if intelligent, prompt before walking into RESTRICTMOVEMENT with no getsweaker (val1) * [+] make fire / ice damage mor elike netheck - [+] towns should have gates on EVERY side - [+] forest cells outside town gates need to be CLEARED. (maybe turn to dirt) - [+] fix up knock targetting to include magical barriers - [+] say "open a bag?" not "operate a bag?" * [+] implement immunetodisease - [+] sort known skills in @s. - [+] better damage bonus when attacking someone who is asleep - [+] practive firearms/throwing * [+] need objecttype->size * [+] containers * [+] change guns so you have to reload them. ("operate") - [+] crash when loading map with water - [+] SAVE OBJECT CONTENTSk - [+] monsters with jobs aren't getting start items - [+] shopkeeper has shotgun - [+] bug: monster keeps swapping between shotgun and flail - [+] when hiring, remember failure. * [+] Inn - [+] bug: pets fighting!!! then they all turn on you. never make allies get angry unless the attacker is the player * [+] hiring npcs - [+] chat to pet: "stay close" or "keep your distance" - [+] new 'furniture' obclass - [+] allow for 'randomshop' regiontype * [+] add enchantment school - [+] cast a scroll of mending on itself. CRASH. * [+] lessengravity should make you jump better and get knocked back further - [+] boostgrav/lessengrav cancel out each other. * [+] CRASH when you fall down a hole and die. - [+] problem: master gravitation doesn't let us cast levitat. getspellschoolknown() should return the HIGHEST known skill, not the first. * [+] bug: dregion is null?!??! * [+] dig a pit, if you cleared out land below, you just stay down there. - [+] potion of leveitation - [+] warning msg when levitate is about to expire * [+] if you fall upwards to the surface... * [+] if you are ever on the surface while levitating.... - [+] BUG: cna't go up stairs to surface anymore!!!!! - [+] get hungry LOTS more quickly when you start sprinting * [+] monk slow metabolism psionic pell. - [+] fix buf with lore giving LESS accuracy instead of more. - [+] food shop - [+] wand of digging not identified if you dig upwards * [+] when you make ah ole in the roof, objects above should fall through right away * [+] all towns should have: - [+] give monks more psionics spells. - [+] sk_throwing skill - [+] make calm animals use spellpower * [+] add wisdom * [+] need to save region data along with maps * [+] COMBINE armour evasion and accuracy penalty!!! * [+] make armour reduce accuracy as well (unless you have 'armour' skill) - [+] landmine trap * [+] make friendly monsters of same raceclass swap ammo - [+] rename 'pull' to 'suck' to avoid confusion with pull metal * [+] food to fix blindness - [+] potion of coffee * [+] genericise statbrackets * [+] tumble ability * [+] simplify spell power * [+] shopkeeprs should be allowed to pursue targets outside of the shop. - [+] give shopkeepers a shotgun * [+] make F_RNDHOSTILE be able to ahve a random chance. * [+] if you randomly generate food in a shop, still give it a price. - [+] if peaceful humanoid walks into you, "sorry!" - [+] sayphrase(lf, SP_SORRY, vol) - [+] only let you recruit jobs with j_recruitable - [+] CRASH - summon "monk" - [+] dogs, - [+] chickens, - [+] drunks, * [+] village objects - [+] change armourrating AGAIN. instead of a percentage, make it a number. - [+] rename inn to "pub", since you can't sleep there. * [+] random speech code * [+] genericise sayphrase text based on lf's job * [+] monks - add rest of abliities - [+] add fiengdeath ability to some monsters
2011-07-14 07:40:28 +10:00
fprintf(f, "region:%d\n",m->region->id); // map region id
2011-02-01 06:16:13 +11:00
fprintf(f, "depth:%d\n",m->depth); // map depth
2010-12-02 12:17:54 +11:00
fprintf(f, "name:%s\n",m->name); // map name
fprintf(f, "habitat:%d\n",m->habitat->id); // habitat
2010-12-02 12:17:54 +11:00
fprintf(f, "seed:%d\n",m->seed); // seed
fprintf(f, "lastplayervisit:%ld\n",m->lastplayervisit);
2010-12-02 12:17:54 +11:00
fprintf(f, "dims:%d,%d\n",m->w, m->h); // map dimensons
fprintf(f, "nextmaps:\n");
for (i = 0; i < MAXDIR_ORTH; i++) {
fprintf(f, "%d\n",m->nextmap[i] ); // map dimensons
}
* [+] backstab - [+] monsters start asleep and make spot checks ? - [+] make them start asleep - [+] then make this random - [+] sound will wake them (ie. "makenoise") - [+] when you move, make SC_STEALTH check. if you fail, you make noise! - [+] must pass LISTEN check OR have los to hear something. - [+] "the blowfly falls asleep" "the blowfly appears" when summoned. - [+] don't show 'falls asleep' while being created! * [+] don't start summoned mosnters asleep! * [+] clean up bresnham functions - [+] hearing - instead of just using distance, use distance modiied by # of walls! - [+] getcelldistsound() - each wall counts as an extra cell! - [+] add WALK/FLY noises to all monsters! - [+] don't show 'you hear xxx' when resting. - [+] extra damage for weapon skill (up to 50% extra) - [+] make broken glass crushable - [+] only interrupt rest for non-peaceful, non-friendly monsters - [+] save to fight off poison * [+] beholder is never using its BITE attack * [+] need a price for manuals!! * [+] change"dobresnham" to populate an array of cells - [+] make ai cast animate metal (if they ahve a second weapon) - [+] implement getallegiance() to clean up isfriendly / ispeaceful etc - [+] bug - f_else f_ifpct etc not working in startobs * [+] OT_S_CHARM - [+] update askcoords to show "weilding x AND Y" - [+] stop enemies from throwing firearm ammo somehow * [+] implement - [+] pacify spell - [+] make spellbooks less common - [+] detectmetal not wokring. fixed. - [+] detectobjects spell - [+] cleanup using flagcausesredraw() - [+] increase odds of weapons in rooms, and max ob count in rooms
2011-03-24 16:09:31 +11:00
fprintf(f, "beingcreated:%d\n",m->beingcreated);
2010-12-02 12:17:54 +11:00
// save all non-player lifeforms (includes their objects)
fprintf(f, "lifeforms:\n");
for (l = m->lf ; l ; l = l->next) {
if (l->controller != C_PLAYER) { // don't save the player!
savelf(f, l);
}
}
fprintf(f, "endlifeforms\n");
// save room defs
fprintf(f, "nrooms:%d\n",m->nrooms);
for (i = 0; i < m->nrooms; i++) {
fprintf(f, "%d,%d,%d,%d,%d,%s\n",m->room[i].id,
m->room[i].x1, m->room[i].y1,
m->room[i].x2, m->room[i].y2,
m->room[i].vault ? m->room[i].vault->id : "^^^");
}
2010-12-02 12:17:54 +11:00
// cells
fprintf(f, "cells:\n");
for (y = 0; y < m->h; y++) {
for (x = 0; x < m->w; x++) {
cell_t *c;
c = getcellat(m, x, y);
// cell info
fprintf(f, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
c->room ? c->room->id : -1, c->type->id, c->known, c->knownglyph.ch, c->knownglyph.colour, c->visited,c->lit,c->origlit,c->littimer,c->habitat->id );
2010-12-02 12:17:54 +11:00
// cell objects
for (o = c->obpile->first ; o ; o = o->next) {
fprintf(f, "ob:%ld\n",o->id);
obcount++;
}
fprintf(f, "ob:-1\n");
}
}
2010-12-02 12:17:54 +11:00
// save object definitions from map cells
fprintf(f, "MAPOBS:%d\n",obcount);
for (y = 0; y < m->h; y++) {
for (x = 0; x < m->w; x++) {
cell_t *c;
c = getcellat(m, x, y);
// cell objects
for (o = c->obpile->first ; o ; o = o->next) {
saveob(f, o);
}
}
}
2011-05-20 06:30:58 +10:00
saveflagpile(f, m->flags);
2010-12-02 12:17:54 +11:00
fclose(f);
return B_FALSE;
}
int saveob(FILE *f, object_t *o) {
* [+] make vending machines use this container code instead. - [+] don't say "you see a few things" if one of them is footsteps * [+] IFMONSTER code failing....because flags are now SORTED!!! - [+] tumble - askcoords is letting us pick a cell we don't have lof to. * [+] assign a name to lfs once you hire them * [+] coloured msgtext - [+] make min dam reduction from AR be AR/5. - [+] safebox - [+] if intelligent, prompt before walking into RESTRICTMOVEMENT with no getsweaker (val1) * [+] make fire / ice damage mor elike netheck - [+] towns should have gates on EVERY side - [+] forest cells outside town gates need to be CLEARED. (maybe turn to dirt) - [+] fix up knock targetting to include magical barriers - [+] say "open a bag?" not "operate a bag?" * [+] implement immunetodisease - [+] sort known skills in @s. - [+] better damage bonus when attacking someone who is asleep - [+] practive firearms/throwing * [+] need objecttype->size * [+] containers * [+] change guns so you have to reload them. ("operate") - [+] crash when loading map with water - [+] SAVE OBJECT CONTENTSk - [+] monsters with jobs aren't getting start items - [+] shopkeeper has shotgun - [+] bug: monster keeps swapping between shotgun and flail - [+] when hiring, remember failure. * [+] Inn - [+] bug: pets fighting!!! then they all turn on you. never make allies get angry unless the attacker is the player * [+] hiring npcs - [+] chat to pet: "stay close" or "keep your distance" - [+] new 'furniture' obclass - [+] allow for 'randomshop' regiontype * [+] add enchantment school - [+] cast a scroll of mending on itself. CRASH. * [+] lessengravity should make you jump better and get knocked back further - [+] boostgrav/lessengrav cancel out each other. * [+] CRASH when you fall down a hole and die. - [+] problem: master gravitation doesn't let us cast levitat. getspellschoolknown() should return the HIGHEST known skill, not the first. * [+] bug: dregion is null?!??! * [+] dig a pit, if you cleared out land below, you just stay down there. - [+] potion of leveitation - [+] warning msg when levitate is about to expire * [+] if you fall upwards to the surface... * [+] if you are ever on the surface while levitating.... - [+] BUG: cna't go up stairs to surface anymore!!!!! - [+] get hungry LOTS more quickly when you start sprinting * [+] monk slow metabolism psionic pell. - [+] fix buf with lore giving LESS accuracy instead of more. - [+] food shop - [+] wand of digging not identified if you dig upwards * [+] when you make ah ole in the roof, objects above should fall through right away * [+] all towns should have: - [+] give monks more psionics spells. - [+] sk_throwing skill - [+] make calm animals use spellpower * [+] add wisdom * [+] need to save region data along with maps * [+] COMBINE armour evasion and accuracy penalty!!! * [+] make armour reduce accuracy as well (unless you have 'armour' skill) - [+] landmine trap * [+] make friendly monsters of same raceclass swap ammo - [+] rename 'pull' to 'suck' to avoid confusion with pull metal * [+] food to fix blindness - [+] potion of coffee * [+] genericise statbrackets * [+] tumble ability * [+] simplify spell power * [+] shopkeeprs should be allowed to pursue targets outside of the shop. - [+] give shopkeepers a shotgun * [+] make F_RNDHOSTILE be able to ahve a random chance. * [+] if you randomly generate food in a shop, still give it a price. - [+] if peaceful humanoid walks into you, "sorry!" - [+] sayphrase(lf, SP_SORRY, vol) - [+] only let you recruit jobs with j_recruitable - [+] CRASH - summon "monk" - [+] dogs, - [+] chickens, - [+] drunks, * [+] village objects - [+] change armourrating AGAIN. instead of a percentage, make it a number. - [+] rename inn to "pub", since you can't sleep there. * [+] random speech code * [+] genericise sayphrase text based on lf's job * [+] monks - add rest of abliities - [+] add fiengdeath ability to some monsters
2011-07-14 07:40:28 +10:00
object_t *oo;
int ncontents;
2010-12-02 12:17:54 +11:00
fprintf(f, "id:%ld\n",o->id);
fprintf(f, "type:%d\n",o->type->id);
fprintf(f, "material:%d\n",o->material->id);
fprintf(f, "weight:%f\n",o->weight);
fprintf(f, "inscr:%s\n",o->inscription ? o->inscription : "^^^");
fprintf(f, "letter:%c\n",o->letter);
fprintf(f, "bless:%d\n",o->blessed);
fprintf(f, "blessknown:%d\n",o->blessknown);
fprintf(f, "amt:%d\n",o->amt);
2011-02-01 06:16:13 +11:00
fprintf(f, "birthtime:%ld\n",o->birthtime);
saveflagpile(f, o->flags);
* [+] make vending machines use this container code instead. - [+] don't say "you see a few things" if one of them is footsteps * [+] IFMONSTER code failing....because flags are now SORTED!!! - [+] tumble - askcoords is letting us pick a cell we don't have lof to. * [+] assign a name to lfs once you hire them * [+] coloured msgtext - [+] make min dam reduction from AR be AR/5. - [+] safebox - [+] if intelligent, prompt before walking into RESTRICTMOVEMENT with no getsweaker (val1) * [+] make fire / ice damage mor elike netheck - [+] towns should have gates on EVERY side - [+] forest cells outside town gates need to be CLEARED. (maybe turn to dirt) - [+] fix up knock targetting to include magical barriers - [+] say "open a bag?" not "operate a bag?" * [+] implement immunetodisease - [+] sort known skills in @s. - [+] better damage bonus when attacking someone who is asleep - [+] practive firearms/throwing * [+] need objecttype->size * [+] containers * [+] change guns so you have to reload them. ("operate") - [+] crash when loading map with water - [+] SAVE OBJECT CONTENTSk - [+] monsters with jobs aren't getting start items - [+] shopkeeper has shotgun - [+] bug: monster keeps swapping between shotgun and flail - [+] when hiring, remember failure. * [+] Inn - [+] bug: pets fighting!!! then they all turn on you. never make allies get angry unless the attacker is the player * [+] hiring npcs - [+] chat to pet: "stay close" or "keep your distance" - [+] new 'furniture' obclass - [+] allow for 'randomshop' regiontype * [+] add enchantment school - [+] cast a scroll of mending on itself. CRASH. * [+] lessengravity should make you jump better and get knocked back further - [+] boostgrav/lessengrav cancel out each other. * [+] CRASH when you fall down a hole and die. - [+] problem: master gravitation doesn't let us cast levitat. getspellschoolknown() should return the HIGHEST known skill, not the first. * [+] bug: dregion is null?!??! * [+] dig a pit, if you cleared out land below, you just stay down there. - [+] potion of leveitation - [+] warning msg when levitate is about to expire * [+] if you fall upwards to the surface... * [+] if you are ever on the surface while levitating.... - [+] BUG: cna't go up stairs to surface anymore!!!!! - [+] get hungry LOTS more quickly when you start sprinting * [+] monk slow metabolism psionic pell. - [+] fix buf with lore giving LESS accuracy instead of more. - [+] food shop - [+] wand of digging not identified if you dig upwards * [+] when you make ah ole in the roof, objects above should fall through right away * [+] all towns should have: - [+] give monks more psionics spells. - [+] sk_throwing skill - [+] make calm animals use spellpower * [+] add wisdom * [+] need to save region data along with maps * [+] COMBINE armour evasion and accuracy penalty!!! * [+] make armour reduce accuracy as well (unless you have 'armour' skill) - [+] landmine trap * [+] make friendly monsters of same raceclass swap ammo - [+] rename 'pull' to 'suck' to avoid confusion with pull metal * [+] food to fix blindness - [+] potion of coffee * [+] genericise statbrackets * [+] tumble ability * [+] simplify spell power * [+] shopkeeprs should be allowed to pursue targets outside of the shop. - [+] give shopkeepers a shotgun * [+] make F_RNDHOSTILE be able to ahve a random chance. * [+] if you randomly generate food in a shop, still give it a price. - [+] if peaceful humanoid walks into you, "sorry!" - [+] sayphrase(lf, SP_SORRY, vol) - [+] only let you recruit jobs with j_recruitable - [+] CRASH - summon "monk" - [+] dogs, - [+] chickens, - [+] drunks, * [+] village objects - [+] change armourrating AGAIN. instead of a percentage, make it a number. - [+] rename inn to "pub", since you can't sleep there. * [+] random speech code * [+] genericise sayphrase text based on lf's job * [+] monks - add rest of abliities - [+] add fiengdeath ability to some monsters
2011-07-14 07:40:28 +10:00
// object contents...
ncontents = countobs(o->contents, B_FALSE);
if (ncontents) {
fprintf(f, "obcontents:%d\n",ncontents);
for (oo = o->contents->first ; oo ; oo = oo->next) {
saveob(f, oo);
}
fprintf(f, "endobcontents\n");
}
2010-12-02 12:17:54 +11:00
fprintf(f, "endob\n");
return B_FALSE;
}
* [+] make vending machines use this container code instead. - [+] don't say "you see a few things" if one of them is footsteps * [+] IFMONSTER code failing....because flags are now SORTED!!! - [+] tumble - askcoords is letting us pick a cell we don't have lof to. * [+] assign a name to lfs once you hire them * [+] coloured msgtext - [+] make min dam reduction from AR be AR/5. - [+] safebox - [+] if intelligent, prompt before walking into RESTRICTMOVEMENT with no getsweaker (val1) * [+] make fire / ice damage mor elike netheck - [+] towns should have gates on EVERY side - [+] forest cells outside town gates need to be CLEARED. (maybe turn to dirt) - [+] fix up knock targetting to include magical barriers - [+] say "open a bag?" not "operate a bag?" * [+] implement immunetodisease - [+] sort known skills in @s. - [+] better damage bonus when attacking someone who is asleep - [+] practive firearms/throwing * [+] need objecttype->size * [+] containers * [+] change guns so you have to reload them. ("operate") - [+] crash when loading map with water - [+] SAVE OBJECT CONTENTSk - [+] monsters with jobs aren't getting start items - [+] shopkeeper has shotgun - [+] bug: monster keeps swapping between shotgun and flail - [+] when hiring, remember failure. * [+] Inn - [+] bug: pets fighting!!! then they all turn on you. never make allies get angry unless the attacker is the player * [+] hiring npcs - [+] chat to pet: "stay close" or "keep your distance" - [+] new 'furniture' obclass - [+] allow for 'randomshop' regiontype * [+] add enchantment school - [+] cast a scroll of mending on itself. CRASH. * [+] lessengravity should make you jump better and get knocked back further - [+] boostgrav/lessengrav cancel out each other. * [+] CRASH when you fall down a hole and die. - [+] problem: master gravitation doesn't let us cast levitat. getspellschoolknown() should return the HIGHEST known skill, not the first. * [+] bug: dregion is null?!??! * [+] dig a pit, if you cleared out land below, you just stay down there. - [+] potion of leveitation - [+] warning msg when levitate is about to expire * [+] if you fall upwards to the surface... * [+] if you are ever on the surface while levitating.... - [+] BUG: cna't go up stairs to surface anymore!!!!! - [+] get hungry LOTS more quickly when you start sprinting * [+] monk slow metabolism psionic pell. - [+] fix buf with lore giving LESS accuracy instead of more. - [+] food shop - [+] wand of digging not identified if you dig upwards * [+] when you make ah ole in the roof, objects above should fall through right away * [+] all towns should have: - [+] give monks more psionics spells. - [+] sk_throwing skill - [+] make calm animals use spellpower * [+] add wisdom * [+] need to save region data along with maps * [+] COMBINE armour evasion and accuracy penalty!!! * [+] make armour reduce accuracy as well (unless you have 'armour' skill) - [+] landmine trap * [+] make friendly monsters of same raceclass swap ammo - [+] rename 'pull' to 'suck' to avoid confusion with pull metal * [+] food to fix blindness - [+] potion of coffee * [+] genericise statbrackets * [+] tumble ability * [+] simplify spell power * [+] shopkeeprs should be allowed to pursue targets outside of the shop. - [+] give shopkeepers a shotgun * [+] make F_RNDHOSTILE be able to ahve a random chance. * [+] if you randomly generate food in a shop, still give it a price. - [+] if peaceful humanoid walks into you, "sorry!" - [+] sayphrase(lf, SP_SORRY, vol) - [+] only let you recruit jobs with j_recruitable - [+] CRASH - summon "monk" - [+] dogs, - [+] chickens, - [+] drunks, * [+] village objects - [+] change armourrating AGAIN. instead of a percentage, make it a number. - [+] rename inn to "pub", since you can't sleep there. * [+] random speech code * [+] genericise sayphrase text based on lf's job * [+] monks - add rest of abliities - [+] add fiengdeath ability to some monsters
2011-07-14 07:40:28 +10:00
int saveregions(void) {
FILE *f;
char filename[BUFLEN];
int i;
regionoutline_t *ro;
region_t *r;
int numoutlines = 0,numregions = 0;
// TODO: check that map dir exists
sprintf(filename, "%s/regions.dat",MAPDIR);
f = fopen(filename, "wt");
for (ro = firstregionoutline ; ro ; ro = ro->next) {
numoutlines++;
}
fprintf(f, "numoutlines:%d\n",numoutlines);
for (ro = firstregionoutline ; ro ; ro = ro->next) {
// save this outline
fprintf(f, "startro\n");
fprintf(f, "rtypeid:%d\n",ro->rtype->id); // region type id
fprintf(f, "nthings:%d\n",ro->nthings);
for (i = 0; i < ro->nthings; i++) {
fprintf(f, "startthing\n");
fprintf(f, " thingdepth:%d,%d,%d\n",ro->thing[i].depth, ro->thing[i].x, ro->thing[i].y);
fprintf(f, " thingkind:%d\n",(int)ro->thing[i].whatkind);
fprintf(f, " thingval:%d\n",(int)ro->thing[i].value);
if (strlen(ro->thing[i].what)) {
char localwhat[BUFLEN],*p;
strcpy(localwhat,ro->thing[i].what);
for (p = localwhat ; *p; p++) {
if (*p == ' ') *p = '^';
}
fprintf(f, " thingwhat:%s\n",localwhat);
} else {
fprintf(f, " thingwhat:NULL\n");
}
fprintf(f, "endthing\n");
}
fprintf(f, "endro\n");
}
// now save out the actual region->outline mappings
numregions = 0;
for (r = firstregion ; r; r = r->next) {
numregions++;
}
fprintf(f, "numregions:%d\n",numregions);
for (r = firstregion ; r; r = r->next) {
fprintf(f, "startregion\n");
fprintf(f, " rtypeid:%d\n",r->rtype->id);
fprintf(f, " outline:%d\n",r->outline ? r->outline->id : -1);
fprintf(f, " parentregion:%d\n",r->parentregion ? r->parentregion->id : -1);
fprintf(f, " nthings:%d\n",r->nthings);
fprintf(f, "endregion\n");
}
fclose(f);
return B_FALSE;
}
int showhiscores(lifeform_t *lf, int min, int max) {
sqlite3 *db;
int rc;
char filename[BUFLEN],*cmd;
char *errmsg = NULL;
char hilitescoretext[BUFLEN];
long hilitescore = -1;
if (lf && !lfhasflag(lf, F_NOSCORE)) {
hilitescore = calcscore(lf);
} else {
hilitescore = -1;
}
// open database
sprintf(filename, "%s/hiscores.db", DATADIR);
rc = sqlite3_open(filename, &db);
if (rc) {
msg("error opening hiscore file '%s'.\n",filename);
dblog("error opening hiscore file '%s'.\n",filename);
return B_TRUE;
}
// show top ten
//sprintf(cmd, "select * from hiscores order by score desc limit 10;");
asprintf(&cmd, "select (select count(*) from hiscores b where b.score > a.score) + 1 as rank, score,name,job,killedby from hiscores a where (rank >= %d) and (rank <= %d) order by score desc limit 10;", min, max);
sprintf(hilitescoretext, "%ld",hilitescore);
rc = sqlite3_exec(db, cmd, showhiscoreline, hilitescoretext, &errmsg);
if (rc != SQLITE_OK) {
msg("error writing hiscores: '%s'", errmsg);
- [+] outdoor bug: at -1,-1. travel south. end up at 0,0!!! - [+] blink should go to random place within lof, not los - [+] sunglasses shuld reduce nightvis range, not visrange * [+] since jolt needs adjacency, make it more powerful - [+] use colours for spell descriptions - [+] replace 'call wind' with 'zephyr' * [+] add vault commonality. - [+] add more common vaults - roundabout etc * [+] change "addmonster" to take a string arg instrad of RACEID - [+] pouring cursed water on blessed scroll didn't work..... - [+] append "...god of xxx" to rc_god lifeforms - [+] try to attack with f_pain -> INFINITE LOOP. - [+] ARMOURPIERCE shouldn't hurt armour - [+] ghast touchparalyze attack isn't working. * [+] bug: when praying to gods, ones not in heaven aren't listed. - [+] when a god apepars..."Hecta appears" x2 - [+] attacking fleeing lf should count as a backstab (if you have the skill) * [+] "nothing happens" during god spell effects * [+] allow hunger to work on monsters - [+] pressing 'a' on @Magic has weird results. - [+] bug: got a gift form yumi during combat???? what for? healing? initial vampire implementation initial god implementation - [+] they all start off in "heaven" map. - [+] gods ahve f_piety. starts at 0 - [+] keep track of piety with each god. starts at 0 for each one. * [+] let planeshift take you to heaven (for debugging) * [+] everyone has 'pray' ability. - [+] modpiety(rid, amt) * [+] piety vals * [+] when you pray - [+] isangry(god) - ie is piety < 0 * [+] if you pray when god is angry, bad! * [+] once piety gets over 200 or so, praying might give you a gift. * [+] god_appears(lifeform_t *victim) - [+] if >=0 (indiff / pleased), goes up to indiff over time(1 per turn). - [+] regain through doing actions ... in progress - [+] lose through doing actions only if you have prayed to this god before (angergodmaybe) - [+] special: gods don't need LOS to cast spells. - [+] gods planeshift away if not doing anything else. * [+] @g to see your piety levels for each god - [+] ?g for help on gods - [+] IN general: - [+] prey = oneoff effect - [+] gift = ongoing * [+] makeangry() vs modpiety * [+] Yumi - fem,mercy/healing - if you die within the first few turns! Hecta - partial Avamon - partial
2011-08-04 04:43:05 +10:00
dblog("error writing hiscores: '%s'\n sql command: [%s]", errmsg, cmd);
sqlite3_free(errmsg);
}
- [+] outdoor bug: at -1,-1. travel south. end up at 0,0!!! - [+] blink should go to random place within lof, not los - [+] sunglasses shuld reduce nightvis range, not visrange * [+] since jolt needs adjacency, make it more powerful - [+] use colours for spell descriptions - [+] replace 'call wind' with 'zephyr' * [+] add vault commonality. - [+] add more common vaults - roundabout etc * [+] change "addmonster" to take a string arg instrad of RACEID - [+] pouring cursed water on blessed scroll didn't work..... - [+] append "...god of xxx" to rc_god lifeforms - [+] try to attack with f_pain -> INFINITE LOOP. - [+] ARMOURPIERCE shouldn't hurt armour - [+] ghast touchparalyze attack isn't working. * [+] bug: when praying to gods, ones not in heaven aren't listed. - [+] when a god apepars..."Hecta appears" x2 - [+] attacking fleeing lf should count as a backstab (if you have the skill) * [+] "nothing happens" during god spell effects * [+] allow hunger to work on monsters - [+] pressing 'a' on @Magic has weird results. - [+] bug: got a gift form yumi during combat???? what for? healing? initial vampire implementation initial god implementation - [+] they all start off in "heaven" map. - [+] gods ahve f_piety. starts at 0 - [+] keep track of piety with each god. starts at 0 for each one. * [+] let planeshift take you to heaven (for debugging) * [+] everyone has 'pray' ability. - [+] modpiety(rid, amt) * [+] piety vals * [+] when you pray - [+] isangry(god) - ie is piety < 0 * [+] if you pray when god is angry, bad! * [+] once piety gets over 200 or so, praying might give you a gift. * [+] god_appears(lifeform_t *victim) - [+] if >=0 (indiff / pleased), goes up to indiff over time(1 per turn). - [+] regain through doing actions ... in progress - [+] lose through doing actions only if you have prayed to this god before (angergodmaybe) - [+] special: gods don't need LOS to cast spells. - [+] gods planeshift away if not doing anything else. * [+] @g to see your piety levels for each god - [+] ?g for help on gods - [+] IN general: - [+] prey = oneoff effect - [+] gift = ongoing * [+] makeangry() vs modpiety * [+] Yumi - fem,mercy/healing - if you die within the first few turns! Hecta - partial Avamon - partial
2011-08-04 04:43:05 +10:00
free(cmd);
sqlite3_close(db);
return B_FALSE;
}
// returns player's rank in 'rank'
int writehiscore(lifeform_t *lf, int *rank) {
sqlite3 *db;
int rc;
char filename[BUFLEN],*cmd;
char pname[BUFLEN];
char jobname[BUFLEN];
char killedby[BUFLEN];
char *errmsg = NULL;
sqlite3_stmt *smt;
job_t *j;
long minscore;
long score;
score = calcscore(lf);
// open database
sprintf(filename, "%s/hiscores.db", DATADIR);
rc = sqlite3_open(filename, &db);
if (rc) {
msg("error opening hiscore file '%s'.\n",filename);
dblog("error opening hiscore file '%s'.\n",filename);
return B_TRUE;
}
getplayername(pname);
j = getjob(player);
sprintf(jobname, "Lv%d %s", player->level, j->name);
makekillertext(killedby, lf->lastdam, B_FALSE);
if (!lfhasflag(lf, F_NOSCORE)) {
asprintf(&cmd, "insert into 'hiscores' (score,name,job,killedby) VALUES (%ld, '%s', '%s', '%s')", score, pname, jobname, killedby);
rc = sqlite3_exec(db, cmd, NULL, NULL, &errmsg);
free(cmd);
if (rc != SQLITE_OK) {
msg("error writing hiscores: '%s'", errmsg);
dblog("error writing hiscores: '%s'", errmsg);
sqlite3_free(errmsg);
}
}
if (rank) {
if (lfhasflag(lf, F_NOSCORE)) {
*rank = -1;
} else {
// find out the player's rank
asprintf(&cmd, "select (select count(*) from hiscores b where b.score > a.score) + 1 as rank from hiscores a where score = %ld;",score);
rc = sqlite3_prepare_v2(db, cmd, -1, &smt, 0);
free(cmd);
rc = sqlite3_step(smt);
while (rc == SQLITE_ROW) {
const char *p;
p = (const char *)sqlite3_column_text(smt, 0);
*rank = atoi(p);
rc = sqlite3_step(smt);
}
}
}
// now delete all hiscore entries after 100
// find score number 100...
asprintf(&cmd, "select score from hiscores order by score desc limit 100;");
rc = sqlite3_prepare_v2(db, cmd, -1, &smt, 0);
free(cmd);
rc = sqlite3_step(smt);
while (rc == SQLITE_ROW) {
const char *p;
p = (const char *)sqlite3_column_text(smt, 0);
minscore = atol(p);
rc = sqlite3_step(smt);
}
// we now have a minimum score - delete everything lower than it.
asprintf(&cmd, "delete from hiscores where score < %ld;", minscore);
rc = sqlite3_exec(db, cmd, NULL, NULL, &errmsg);
free(cmd);
sqlite3_close(db);
return 0;
}