- [+] bug in movement speed display for monsters
- [+] bug: curtime getting past 23:59. need it to wrap around. * [+] track # days spent. - [+] need to save gametime!
This commit is contained in:
parent
52f6fd21c3
commit
1f721ed03c
1
defs.h
1
defs.h
|
@ -291,6 +291,7 @@
|
||||||
#define ANYROOM (-9770)
|
#define ANYROOM (-9770)
|
||||||
#define FALLTHRU (-8765) // for walkdambp
|
#define FALLTHRU (-8765) // for walkdambp
|
||||||
#define TICK_INTERVAL (20)
|
#define TICK_INTERVAL (20)
|
||||||
|
#define DAYSECS (86400) // # seconds in a day
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
6
io.c
6
io.c
|
@ -8285,9 +8285,9 @@ void showlfstats(lifeform_t *lf, int showall) {
|
||||||
if (lorelev >= PR_NOVICE) unsetcol(mainwin, lorecol);
|
if (lorelev >= PR_NOVICE) unsetcol(mainwin, lorecol);
|
||||||
}
|
}
|
||||||
|
|
||||||
getspeednameshort(getactspeed(player), actbuf);
|
getspeednameshort(getactspeed(lf), actbuf);
|
||||||
getspeednameshort(getmovespeed(player), movebuf);
|
getspeednameshort(getmovespeed(lf), movebuf);
|
||||||
if (!strcmp(actbuf, movebuf)) {
|
if (streq(actbuf, movebuf)) {
|
||||||
sprintf(buf, "%s", actbuf);
|
sprintf(buf, "%s", actbuf);
|
||||||
capitalise(buf);
|
capitalise(buf);
|
||||||
} else {
|
} else {
|
||||||
|
|
1
lf.c
1
lf.c
|
@ -15061,6 +15061,7 @@ void initskills(void) {
|
||||||
addskilldesc(SK_SS_MODIFICATION, PR_EXPERT, "Allows you to cast Modification spells up to level 5.", B_FALSE);
|
addskilldesc(SK_SS_MODIFICATION, PR_EXPERT, "Allows you to cast Modification spells up to level 5.", B_FALSE);
|
||||||
addskilldesc(SK_SS_MODIFICATION, PR_MASTER, "Allows you to cast Modification spells up to level 6.", B_FALSE);
|
addskilldesc(SK_SS_MODIFICATION, PR_MASTER, "Allows you to cast Modification spells up to level 6.", B_FALSE);
|
||||||
addskill(SK_SS_MENTAL, "Psionics", "Boosts casting of spells from this school.", 50);
|
addskill(SK_SS_MENTAL, "Psionics", "Boosts casting of spells from this school.", 50);
|
||||||
|
addskilldesc(SK_SS_MENTAL, PR_INEPT, "- Each rank gives you a 10%% chance to learn a new psionic ability when levelling up.", B_FALSE);
|
||||||
addskilldesc(SK_SS_MENTAL, PR_NOVICE, "Allows you to cast Psionic spells up to level 1.", B_FALSE);
|
addskilldesc(SK_SS_MENTAL, PR_NOVICE, "Allows you to cast Psionic spells up to level 1.", B_FALSE);
|
||||||
addskilldesc(SK_SS_MENTAL, PR_BEGINNER, "Allows you to cast Psionic spells up to level 2.", B_FALSE);
|
addskilldesc(SK_SS_MENTAL, PR_BEGINNER, "Allows you to cast Psionic spells up to level 2.", B_FALSE);
|
||||||
addskilldesc(SK_SS_MENTAL, PR_ADEPT, "Allows you to cast Psionic spells up to level 3.", B_FALSE);
|
addskilldesc(SK_SS_MENTAL, PR_ADEPT, "Allows you to cast Psionic spells up to level 3.", B_FALSE);
|
||||||
|
|
19
nexus.c
19
nexus.c
|
@ -85,8 +85,10 @@ int obdb = B_FALSE;
|
||||||
|
|
||||||
enum GAMEMODE gamemode = GM_FIRST;
|
enum GAMEMODE gamemode = GM_FIRST;
|
||||||
|
|
||||||
long curtime = 0;
|
long curtime = 0; // # current game clock (in seconds)
|
||||||
long timeleft = 0;
|
long gamedays = 0; // # game days passed since start of game
|
||||||
|
long gamesecs = 0; // # game seconds passed since start of game
|
||||||
|
long timeleft = 0; // # secs remaining for which we need to process events
|
||||||
|
|
||||||
extern int statdirty;
|
extern int statdirty;
|
||||||
|
|
||||||
|
@ -306,7 +308,7 @@ int main(int argc, char **argv) {
|
||||||
getplayernamefull(pname);
|
getplayernamefull(pname);
|
||||||
sprintf(welcomemsg, "Greetings %s, welcome to %snexus!", pname, newworld ? "the new " : "");
|
sprintf(welcomemsg, "Greetings %s, welcome to %snexus!", pname, newworld ? "the new " : "");
|
||||||
// 00:00 - 23:59
|
// 00:00 - 23:59
|
||||||
curtime = rnd(0,86399);
|
curtime = rnd(0,DAYSECS-1);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
sprintf(welcomemsg, "Welcome back!");
|
sprintf(welcomemsg, "Welcome back!");
|
||||||
|
@ -1534,6 +1536,17 @@ void timeeffectsworld(map_t *map, int updategametime) {
|
||||||
if (updategametime) {
|
if (updategametime) {
|
||||||
// inc game time
|
// inc game time
|
||||||
curtime += firstlftime;
|
curtime += firstlftime;
|
||||||
|
// don't let it get higher than 23:59
|
||||||
|
while (curtime >= DAYSECS) {
|
||||||
|
curtime -= DAYSECS;
|
||||||
|
}
|
||||||
|
|
||||||
|
// inc total gametime passed
|
||||||
|
gamesecs += firstlftime;
|
||||||
|
while (gamesecs >= DAYSECS) {
|
||||||
|
gamesecs -= DAYSECS;
|
||||||
|
gamedays++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (db) dblog("cur time is %ld\n",curtime);
|
if (db) dblog("cur time is %ld\n",curtime);
|
||||||
|
|
|
@ -8803,18 +8803,21 @@ void initobjects(void) {
|
||||||
addflag(lastot->flags, F_GOESON, BP_HEAD, NA, NA, NULL);
|
addflag(lastot->flags, F_GOESON, BP_HEAD, NA, NA, NULL);
|
||||||
addflag(lastot->flags, F_ARMOURRATING, 1, NA, NA, NULL);
|
addflag(lastot->flags, F_ARMOURRATING, 1, NA, NA, NULL);
|
||||||
addflag(lastot->flags, F_OBHP, 3, 3, NA, NULL);
|
addflag(lastot->flags, F_OBHP, 3, 3, NA, NULL);
|
||||||
|
addflag(lastot->flags, F_NOQUALITY, B_TRUE, NA, NA, NULL);
|
||||||
addot(OT_PIRATEHAT, "tricorne", "A three cornered hat with a skull and crossbones emblem.", MT_CLOTH, 1, OC_ARMOUR, SZ_SMALL);
|
addot(OT_PIRATEHAT, "tricorne", "A three cornered hat with a skull and crossbones emblem.", MT_CLOTH, 1, OC_ARMOUR, SZ_SMALL);
|
||||||
addflag(lastot->flags, F_RARITY, H_DUNGEON, 100, RR_UNCOMMON, NULL);
|
addflag(lastot->flags, F_RARITY, H_DUNGEON, 100, RR_UNCOMMON, NULL);
|
||||||
addflag(lastot->flags, F_GOESON, BP_HEAD, NA, NA, NULL);
|
addflag(lastot->flags, F_GOESON, BP_HEAD, NA, NA, NULL);
|
||||||
addflag(lastot->flags, F_ARMOURRATING, 1, NA, NA, NULL);
|
addflag(lastot->flags, F_ARMOURRATING, 1, NA, NA, NULL);
|
||||||
addflag(lastot->flags, F_OBHP, 2, 2, NA, NULL);
|
addflag(lastot->flags, F_OBHP, 2, 2, NA, NULL);
|
||||||
addflag(lastot->flags, F_SCARY, 2, NA, NA, NULL);
|
addflag(lastot->flags, F_SCARY, 2, NA, NA, NULL);
|
||||||
|
addflag(lastot->flags, F_NOQUALITY, B_TRUE, NA, NA, NULL);
|
||||||
addot(OT_CAP, "cap", "Close-fitting headwear with a short shade visor at the front.", MT_CLOTH, 1, OC_ARMOUR, SZ_SMALL);
|
addot(OT_CAP, "cap", "Close-fitting headwear with a short shade visor at the front.", MT_CLOTH, 1, OC_ARMOUR, SZ_SMALL);
|
||||||
addflag(lastot->flags, F_RARITY, H_DUNGEON, 100, RR_COMMON, NULL);
|
addflag(lastot->flags, F_RARITY, H_DUNGEON, 100, RR_COMMON, NULL);
|
||||||
addflag(lastot->flags, F_RARITY, H_FOREST, 100, RR_COMMON, NULL);
|
addflag(lastot->flags, F_RARITY, H_FOREST, 100, RR_COMMON, NULL);
|
||||||
addflag(lastot->flags, F_GOESON, BP_HEAD, NA, NA, NULL);
|
addflag(lastot->flags, F_GOESON, BP_HEAD, NA, NA, NULL);
|
||||||
addflag(lastot->flags, F_ARMOURRATING, 1, NA, NA, NULL);
|
addflag(lastot->flags, F_ARMOURRATING, 1, NA, NA, NULL);
|
||||||
addflag(lastot->flags, F_OBHP, 3, 3, NA, NULL);
|
addflag(lastot->flags, F_OBHP, 3, 3, NA, NULL);
|
||||||
|
addflag(lastot->flags, F_NOQUALITY, B_TRUE, NA, NA, NULL);
|
||||||
addot(OT_GASMASK, "gas mask", "A full face mask which protects the wearer from toxic gasses.", MT_METAL, 3.5, OC_ARMOUR, SZ_SMALL);
|
addot(OT_GASMASK, "gas mask", "A full face mask which protects the wearer from toxic gasses.", MT_METAL, 3.5, OC_ARMOUR, SZ_SMALL);
|
||||||
addflag(lastot->flags, F_RARITY, H_DUNGEON, 75, RR_UNCOMMON, NULL);
|
addflag(lastot->flags, F_RARITY, H_DUNGEON, 75, RR_UNCOMMON, NULL);
|
||||||
addflag(lastot->flags, F_GOESON, BP_HEAD, NA, NA, NULL);
|
addflag(lastot->flags, F_GOESON, BP_HEAD, NA, NA, NULL);
|
||||||
|
@ -8823,6 +8826,7 @@ void initobjects(void) {
|
||||||
addflag(lastot->flags, F_OBHP, 10, 10, NA, NULL);
|
addflag(lastot->flags, F_OBHP, 10, 10, NA, NULL);
|
||||||
addflag(lastot->flags, F_EQUIPCONFER, F_DTIMMUNE, DT_POISONGAS, NA, NULL);
|
addflag(lastot->flags, F_EQUIPCONFER, F_DTIMMUNE, DT_POISONGAS, NA, NULL);
|
||||||
addflag(lastot->flags, F_EQUIPCONFER, F_VISRANGEMOD, -5, NA, NULL);
|
addflag(lastot->flags, F_EQUIPCONFER, F_VISRANGEMOD, -5, NA, NULL);
|
||||||
|
addflag(lastot->flags, F_NOQUALITY, B_TRUE, NA, NA, NULL);
|
||||||
addot(OT_HELM, "helmet", "A plain metal helmet.", MT_METAL, 2, OC_ARMOUR, SZ_SMALL);
|
addot(OT_HELM, "helmet", "A plain metal helmet.", MT_METAL, 2, OC_ARMOUR, SZ_SMALL);
|
||||||
addflag(lastot->flags, F_RARITY, H_DUNGEON, 100, RR_COMMON, NULL);
|
addflag(lastot->flags, F_RARITY, H_DUNGEON, 100, RR_COMMON, NULL);
|
||||||
addflag(lastot->flags, F_GOESON, BP_HEAD, NA, NA, NULL);
|
addflag(lastot->flags, F_GOESON, BP_HEAD, NA, NA, NULL);
|
||||||
|
|
22
save.c
22
save.c
|
@ -25,6 +25,8 @@ extern knowledge_t *knowledge;
|
||||||
extern region_t *firstregion,*lastregion;
|
extern region_t *firstregion,*lastregion;
|
||||||
extern regionoutline_t *firstregionoutline,*lastregionoutline;
|
extern regionoutline_t *firstregionoutline,*lastregionoutline;
|
||||||
|
|
||||||
|
extern long curtime, gamedays, gamesecs;
|
||||||
|
|
||||||
extern enum GAMEMODE gamemode;
|
extern enum GAMEMODE gamemode;
|
||||||
|
|
||||||
int loadall(void) {
|
int loadall(void) {
|
||||||
|
@ -40,13 +42,15 @@ int loadall(void) {
|
||||||
return B_TRUE;
|
return B_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// load region outlines first.
|
|
||||||
|
// load region outlines
|
||||||
if (loadregions()) {
|
if (loadregions()) {
|
||||||
// this isn't an error - just means no savegames
|
// this isn't an error - just means no savegames
|
||||||
if (db) dblog("No region data found.");
|
if (db) dblog("No region data found.");
|
||||||
return B_FALSE;
|
return B_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// for each map file in directory
|
// for each map file in directory
|
||||||
while ((ent = readdir(dir)) != NULL) {
|
while ((ent = readdir(dir)) != NULL) {
|
||||||
char *p;
|
char *p;
|
||||||
|
@ -692,6 +696,11 @@ int loadsavegame(void) {
|
||||||
printf("Error opening savegame file '%s'",ent->d_name);
|
printf("Error opening savegame file '%s'",ent->d_name);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
// load world data
|
||||||
|
if (loadworlddata(f)) {
|
||||||
|
printf("Error load world data from file '%s'", ent->d_name);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
if (!loadlf(f, NULL)) {
|
if (!loadlf(f, NULL)) {
|
||||||
printf("Error loading player from file '%s'",ent->d_name);
|
printf("Error loading player from file '%s'",ent->d_name);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -725,6 +734,10 @@ int savevars(FILE *f) {
|
||||||
return B_FALSE;
|
return B_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int loadworlddata(FILE *f) {
|
||||||
|
fscanf(f, "timedata:%ld,%ld,%ld\n",&curtime,&gamedays,&gamesecs);
|
||||||
|
return B_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
int saveflagpile(FILE *f, flagpile_t *fp) {
|
int saveflagpile(FILE *f, flagpile_t *fp) {
|
||||||
flag_t *fl;
|
flag_t *fl;
|
||||||
|
@ -811,6 +824,7 @@ int savegame(void) {
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char buf[BUFLEN];
|
char buf[BUFLEN];
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
rv = saveregions();
|
rv = saveregions();
|
||||||
if (rv) {
|
if (rv) {
|
||||||
msg("Could not save region data.");
|
msg("Could not save region data.");
|
||||||
|
@ -831,6 +845,7 @@ int savegame(void) {
|
||||||
msg("Could not open save file!");
|
msg("Could not open save file!");
|
||||||
return B_TRUE;
|
return B_TRUE;
|
||||||
}
|
}
|
||||||
|
saveworlddata(f);
|
||||||
savelf(f, player);
|
savelf(f, player);
|
||||||
saveknowledge(f);
|
saveknowledge(f);
|
||||||
savevars(f);
|
savevars(f);
|
||||||
|
@ -1016,6 +1031,11 @@ int saveregions(void) {
|
||||||
return B_FALSE;
|
return B_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int saveworlddata(FILE *f) {
|
||||||
|
fprintf(f, "timedata:%ld,%ld,%ld\n",curtime,gamedays,gamesecs);
|
||||||
|
return B_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
int showhiscores(lifeform_t *lf, int min, int max) {
|
int showhiscores(lifeform_t *lf, int min, int max) {
|
||||||
sqlite3 *db;
|
sqlite3 *db;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
2
save.h
2
save.h
|
@ -8,6 +8,7 @@ map_t *loadmap(char *basefile);
|
||||||
int loadob(FILE *f, obpile_t *op, long *id);
|
int loadob(FILE *f, obpile_t *op, long *id);
|
||||||
int loadregions(void);
|
int loadregions(void);
|
||||||
int loadsavegame(void);
|
int loadsavegame(void);
|
||||||
|
int loadworlddata(FILE *f);
|
||||||
int saveflagpile(FILE *f, flagpile_t *fp);
|
int saveflagpile(FILE *f, flagpile_t *fp);
|
||||||
int saveknowledge(FILE *f);
|
int saveknowledge(FILE *f);
|
||||||
int savelf(FILE *f, lifeform_t *l);
|
int savelf(FILE *f, lifeform_t *l);
|
||||||
|
@ -15,5 +16,6 @@ int savegame(void);
|
||||||
int savemap(map_t *m);
|
int savemap(map_t *m);
|
||||||
int saveob(FILE *f, object_t *o);
|
int saveob(FILE *f, object_t *o);
|
||||||
int saveregions(void);
|
int saveregions(void);
|
||||||
|
int saveworlddata(FILE *f);
|
||||||
int showhiscores(lifeform_t *lf, int min, int max);
|
int showhiscores(lifeform_t *lf, int min, int max);
|
||||||
int writehiscore(lifeform_t *lf, int *rank);
|
int writehiscore(lifeform_t *lf, int *rank);
|
||||||
|
|
Loading…
Reference in New Issue