A couple of trivial changes.

git-svn-id: https://svn.eduke32.com/eduke32@2961 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-08-24 18:54:01 +00:00
parent a8af22ba9a
commit 9abc415a24
3 changed files with 30 additions and 19 deletions

View file

@ -73,23 +73,23 @@ void demo_preparewarp(void)
static int32_t G_OpenDemoRead(int32_t g_whichDemo) // 0 = mine static int32_t G_OpenDemoRead(int32_t g_whichDemo) // 0 = mine
{ {
char d[14]; char demofn[14];
int32_t i; int32_t i;
savehead_t saveh; savehead_t saveh;
Bstrcpy(d, "edemo_.edm"); Bstrcpy(demofn, "edemo_.edm");
if (g_whichDemo == 10) if (g_whichDemo == 10)
d[5] = 'x'; demofn[5] = 'x';
else else
d[5] = '0' + g_whichDemo; demofn[5] = '0' + g_whichDemo;
if (g_whichDemo == 1 && firstdemofile[0] != 0) if (g_whichDemo == 1 && firstdemofile[0] != 0)
{ {
if ((g_demo_recFilePtr = kopen4loadfrommod(firstdemofile,g_loadFromGroupOnly)) == -1) return(0); if ((g_demo_recFilePtr = kopen4loadfrommod(firstdemofile,g_loadFromGroupOnly)) == -1) return(0);
} }
else if ((g_demo_recFilePtr = kopen4loadfrommod(d,g_loadFromGroupOnly)) == -1) return(0); else if ((g_demo_recFilePtr = kopen4loadfrommod(demofn,g_loadFromGroupOnly)) == -1) return(0);
Bassert(g_whichDemo >= 1); Bassert(g_whichDemo >= 1);
i = sv_loadsnapshot(g_demo_recFilePtr, -g_whichDemo, &saveh); i = sv_loadsnapshot(g_demo_recFilePtr, -g_whichDemo, &saveh);
@ -108,7 +108,7 @@ static int32_t G_OpenDemoRead(int32_t g_whichDemo) // 0 = mine
demo_synccompress &= 1; demo_synccompress &= 1;
i = g_demo_totalCnt/(TICRATE/TICSPERFRAME); i = g_demo_totalCnt/(TICRATE/TICSPERFRAME);
OSD_Printf("demo duration: %d min %d sec\n", i/60, i%60); OSD_Printf("demo %d duration: %d min %d sec\n", g_whichDemo, i/60, i%60);
g_demo_cnt=1; g_demo_cnt=1;
ud.reccnt = 0; ud.reccnt = 0;
@ -130,7 +130,7 @@ extern int32_t krd_print(const char *filename);
void G_OpenDemoWrite(void) void G_OpenDemoWrite(void)
{ {
char d[BMAX_PATH]; char demofn[BMAX_PATH];
int32_t i, demonum=1; int32_t i, demonum=1;
if (ud.recstat == 2) if (ud.recstat == 2)
@ -173,23 +173,23 @@ void G_OpenDemoWrite(void)
if (demonum == 10000) return; if (demonum == 10000) return;
if (g_modDir[0] != '/') if (g_modDir[0] != '/')
nch=Bsnprintf(d, sizeof(d), "%s/edemo%d.edm", g_modDir, demonum++); nch=Bsnprintf(demofn, sizeof(demofn), "%s/edemo%d.edm", g_modDir, demonum++);
else nch=Bsnprintf(d, sizeof(d), "edemo%d.edm", demonum++); else nch=Bsnprintf(demofn, sizeof(demofn), "edemo%d.edm", demonum++);
if ((unsigned)nch >= sizeof(d)-1) if ((unsigned)nch >= sizeof(demofn)-1)
{ {
// TODO: factor out this out and use everywhere else. // TODO: factor out this out and use everywhere else.
initprintf("Couldn't start demo writing: INTERNAL ERROR: file name too long\n"); initprintf("Couldn't start demo writing: INTERNAL ERROR: file name too long\n");
goto error_wopen_demo; goto error_wopen_demo;
} }
g_demo_filePtr = Bfopen(d, "rb"); g_demo_filePtr = Bfopen(demofn, "rb");
if (g_demo_filePtr == NULL) break; if (g_demo_filePtr == NULL) break;
Bfclose(g_demo_filePtr); Bfclose(g_demo_filePtr);
} }
while (1); while (1);
if ((g_demo_filePtr = Bfopen(d,"wb")) == NULL) return; if ((g_demo_filePtr = Bfopen(demofn,"wb")) == NULL) return;
i=sv_saveandmakesnapshot(g_demo_filePtr, -1, demorec_diffs_cvar, demorec_diffcompress_cvar, i=sv_saveandmakesnapshot(g_demo_filePtr, -1, demorec_diffs_cvar, demorec_diffcompress_cvar,
demorec_synccompress_cvar|(demorec_seeds_cvar<<1)); demorec_synccompress_cvar|(demorec_seeds_cvar<<1));

View file

@ -320,6 +320,8 @@ void P_SetGamePalette(DukePlayer_t *player, uint8_t palid, int32_t set)
} }
// flags
// 4: small font, wrap strings?
int32_t G_PrintGameText(int32_t f, int32_t tile, int32_t x, int32_t y, const char *t, int32_t G_PrintGameText(int32_t f, int32_t tile, int32_t x, int32_t y, const char *t,
int32_t s, int32_t p, int32_t o, int32_t s, int32_t p, int32_t o,
int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t z) int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t z)
@ -1782,6 +1784,7 @@ void G_PrintGameQuotes(int32_t snum)
const DukePlayer_t *const ps = g_player[snum].ps; const DukePlayer_t *const ps = g_player[snum].ps;
const int32_t reserved_quote = (ps->ftq >= QUOTE_RESERVED && ps->ftq <= QUOTE_RESERVED3); const int32_t reserved_quote = (ps->ftq >= QUOTE_RESERVED && ps->ftq <= QUOTE_RESERVED3);
// NOTE: QUOTE_RESERVED4 is not included.
k = calc_ybase(1); k = calc_ybase(1);
@ -2974,7 +2977,7 @@ void G_DisplayRest(int32_t smoothratio)
(myps->player_par/REALGAMETICSPERSEC)%60, (myps->player_par/REALGAMETICSPERSEC)%60,
((myps->player_par%REALGAMETICSPERSEC)*33)/10 ((myps->player_par%REALGAMETICSPERSEC)*33)/10
); );
G_PrintGameText(13,STARTALPHANUM, j,scale(200-i,ud.config.ScreenHeight,200)-textsc(21), G_PrintGameText(8+4+1,STARTALPHANUM, j,scale(200-i,ud.config.ScreenHeight,200)-textsc(21),
tempbuf,0,10,26,0, 0, xdim-1, ydim-1, 65536); tempbuf,0,10,26,0, 0, xdim-1, ydim-1, 65536);
if (ud.player_skill > 3 || ((g_netServer || ud.multimode > 1) && !GTFLAGS(GAMETYPE_PLAYERSFRIENDLY))) if (ud.player_skill > 3 || ((g_netServer || ud.multimode > 1) && !GTFLAGS(GAMETYPE_PLAYERSFRIENDLY)))
@ -2991,13 +2994,13 @@ void G_DisplayRest(int32_t smoothratio)
myps->max_actors_killed>myps->actors_killed? myps->max_actors_killed>myps->actors_killed?
myps->max_actors_killed:myps->actors_killed); myps->max_actors_killed:myps->actors_killed);
} }
G_PrintGameText(13,STARTALPHANUM, j,scale(200-i,ud.config.ScreenHeight,200)-textsc(14), G_PrintGameText(8+4+1,STARTALPHANUM, j,scale(200-i,ud.config.ScreenHeight,200)-textsc(14),
tempbuf,0,10,26,0, 0, xdim-1, ydim-1, 65536); tempbuf,0,10,26,0, 0, xdim-1, ydim-1, 65536);
if (myps->secret_rooms == myps->max_secret_rooms) if (myps->secret_rooms == myps->max_secret_rooms)
Bsprintf(tempbuf,"S:%d/%d", myps->secret_rooms, myps->max_secret_rooms); Bsprintf(tempbuf,"S:%d/%d", myps->secret_rooms, myps->max_secret_rooms);
else Bsprintf(tempbuf,"S:^15%d/%d", myps->secret_rooms, myps->max_secret_rooms); else Bsprintf(tempbuf,"S:^15%d/%d", myps->secret_rooms, myps->max_secret_rooms);
G_PrintGameText(13,STARTALPHANUM, j,scale(200-i,ud.config.ScreenHeight,200)-textsc(7), G_PrintGameText(8+4+1,STARTALPHANUM, j,scale(200-i,ud.config.ScreenHeight,200)-textsc(7),
tempbuf,0,10,26,0, 0, xdim-1, ydim-1, 65536); tempbuf,0,10,26,0, 0, xdim-1, ydim-1, 65536);
} }

View file

@ -2967,16 +2967,24 @@ cheat_for_port_credits:
mgametextpal(d,yy, ud.tickrate ? "Yes" : "No", MENUHIGHLIGHT(io), 0); mgametextpal(d,yy, ud.tickrate ? "Yes" : "No", MENUHIGHLIGHT(io), 0);
break; break;
case 11: case 11:
{
DukePlayer_t *ps = g_player[myconnectindex].ps;
if (x==io) if (x==io)
{ {
enabled = !((g_player[myconnectindex].ps->gm&MODE_GAME) && ud.m_recstat != 1); enabled = !((ps->gm&MODE_GAME) && ud.m_recstat != 1);
if ((g_player[myconnectindex].ps->gm&MODE_GAME)) G_CloseDemoWrite();
if ((ps->gm&MODE_GAME)) G_CloseDemoWrite();
else ud.m_recstat = !ud.m_recstat; else ud.m_recstat = !ud.m_recstat;
} }
if ((g_player[myconnectindex].ps->gm&MODE_GAME) && ud.m_recstat != 1)
if ((ps->gm&MODE_GAME) && ud.m_recstat != 1)
enabled = 0; enabled = 0;
mgametextpal(d,yy,ud.m_recstat?((enabled && g_player[myconnectindex].ps->gm&MODE_GAME)?"Running":"On"):"Off",enabled?MENUHIGHLIGHT(io):DISABLEDMENUSHADE,enabled?0:1);
mgametextpal(d, yy, ud.m_recstat ? ((enabled && ps->gm&MODE_GAME)?"Running":"On"):"Off",
enabled ? MENUHIGHLIGHT(io) : DISABLEDMENUSHADE, !enabled);
break; break;
}
case 12: case 12:
if (x==io) ChangeToMenu(201); if (x==io) ChangeToMenu(201);
break; break;