diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 0158720c1..e5dda6a4c 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -1150,19 +1150,19 @@ static int32_t G_GetInvAmount(const DukePlayer_t *p) { switch (p->inven_icon) { - case 1: + case ICON_FIRSTAID: return p->inv_amount[GET_FIRSTAID]; - case 2: + case ICON_STEROIDS: return ((p->inv_amount[GET_STEROIDS]+3)>>2); - case 3: + case ICON_HOLODUKE: return ((p->inv_amount[GET_HOLODUKE]+15)/24); - case 4: + case ICON_JETPACK: return ((p->inv_amount[GET_JETPACK]+15)>>4); - case 5: + case ICON_HEATS: return p->inv_amount[GET_HEATS]/12; - case 6: + case ICON_SCUBA: return ((p->inv_amount[GET_SCUBA]+63)>>6); - case 7: + case ICON_BOOTS: return (p->inv_amount[GET_BOOTS]>>1); } @@ -1173,11 +1173,11 @@ static int32_t G_GetInvOn(const DukePlayer_t *p) { switch (p->inven_icon) { - case 3: + case ICON_HOLODUKE: return p->holoduke_on; - case 4: + case ICON_JETPACK: return p->jetpack_on; - case 5: + case ICON_HEATS: return p->heat_on; } @@ -1310,7 +1310,7 @@ static void G_DrawStatusBar(int32_t snum) { const int32_t orient = 10+16+permbit+256; - i = ((unsigned)p->inven_icon < 8) ? item_icons[p->inven_icon] : -1; + i = ((unsigned)p->inven_icon < ICON_MAX) ? item_icons[p->inven_icon] : -1; if (i >= 0) { if (getrendermode() >= 3 && althud_shadows) @@ -1340,7 +1340,7 @@ static void G_DrawStatusBar(int32_t snum) minitext(284-30-o,180-3,"Off",2, orient+ROTATESPRITE_MAX); } - if (p->inven_icon >= 6) + if (p->inven_icon >= ICON_SCUBA) { if (getrendermode() >= 3 && althud_shadows) minitext(284-35-o+1,180-3+1,"Auto",4, POLYMOSTTRANS+orient+ROTATESPRITE_MAX); @@ -1392,7 +1392,7 @@ static void G_DrawStatusBar(int32_t snum) { // orient |= permbit; - i = ((unsigned)p->inven_icon < 8) ? item_icons[p->inven_icon] : -1; + i = ((unsigned)p->inven_icon < ICON_MAX) ? item_icons[p->inven_icon] : -1; if (i >= 0) rotatesprite_fs(sbarx(231-o), yofssh+sbary(200-21), sb16, 0, i, 0, 0, orient); @@ -1412,7 +1412,7 @@ static void G_DrawStatusBar(int32_t snum) else if ((uint32_t)j != 0x80000000) minitext(284-30-o, 180, "Off", 2, orient); - if (p->inven_icon >= 6) + if (p->inven_icon >= ICON_SCUBA) minitext(284-35-o, 180, "Auto", 2, orient); minitext_yofs = 0; @@ -1628,11 +1628,11 @@ static void G_DrawStatusBar(int32_t snum) if (u&(2048+4096)) { - i = ((unsigned)p->inven_icon < 8) ? item_icons[p->inven_icon] : -1; + i = ((unsigned)p->inven_icon < ICON_MAX) ? item_icons[p->inven_icon] : -1; // XXX: i < 0? rotatesprite_fs(sbarx(231-o),sbary(SBY+13),sb16,0,i,0,0,10+16+permbit); minitext(292-30-o,SBY+24,"%",6,10+16+permbit + ROTATESPRITE_MAX); - if (p->inven_icon >= 6) minitext(284-35-o,SBY+14,"Auto",2,10+16+permbit + ROTATESPRITE_MAX); + if (p->inven_icon >= ICON_SCUBA) minitext(284-35-o,SBY+14,"Auto",2,10+16+permbit + ROTATESPRITE_MAX); } if (u&(2048+4096)) @@ -7268,7 +7268,7 @@ FOUNDCHEAT: P_DoQuote(QUOTE_CHEAT_EVERYTHING, g_player[myconnectindex].ps); // P_DoQuote(QUOTE_21,g_player[myconnectindex].ps); - g_player[myconnectindex].ps->inven_icon = 1; + g_player[myconnectindex].ps->inven_icon = ICON_FIRSTAID; end_cheat(); return; diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 92c407f5a..c1779a282 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -3147,7 +3147,7 @@ nullquote: { case GET_STEROIDS: ps->inv_amount[GET_STEROIDS] = *insptr; - ps->inven_icon = 2; + ps->inven_icon = ICON_STEROIDS; break; case GET_SHIELD: @@ -3158,17 +3158,17 @@ nullquote: case GET_SCUBA: ps->inv_amount[GET_SCUBA] = *insptr;// 1600; - ps->inven_icon = 6; + ps->inven_icon = ICON_SCUBA; break; case GET_HOLODUKE: ps->inv_amount[GET_HOLODUKE] = *insptr;// 1600; - ps->inven_icon = 3; + ps->inven_icon = ICON_HOLODUKE; break; case GET_JETPACK: ps->inv_amount[GET_JETPACK] = *insptr;// 1600; - ps->inven_icon = 4; + ps->inven_icon = ICON_JETPACK; break; case GET_ACCESS: @@ -3188,16 +3188,16 @@ nullquote: case GET_HEATS: ps->inv_amount[GET_HEATS] = *insptr; - ps->inven_icon = 5; + ps->inven_icon = ICON_HEATS; break; case GET_FIRSTAID: - ps->inven_icon = 1; + ps->inven_icon = ICON_FIRSTAID; ps->inv_amount[GET_FIRSTAID] = *insptr; break; case GET_BOOTS: - ps->inven_icon = 7; + ps->inven_icon = ICON_BOOTS; ps->inv_amount[GET_BOOTS] = *insptr; break; default: diff --git a/polymer/eduke32/source/global.c b/polymer/eduke32/source/global.c index 4f443fac0..ebcc7d3ea 100644 --- a/polymer/eduke32/source/global.c +++ b/polymer/eduke32/source/global.c @@ -50,7 +50,7 @@ int16_t cyclers[MAXCYCLERS][6],g_numCyclers; char *ScriptQuotes[MAXQUOTES], *ScriptQuoteRedefinitions[MAXQUOTES]; -char tempbuf[2048], packbuf[PACKBUF_SIZE], menutextbuf[128], buf[1024]; +char tempbuf[MAXSECTORS<<1], packbuf[PACKBUF_SIZE], menutextbuf[128], buf[1024]; int16_t camsprite; int16_t g_mirrorWall[64], g_mirrorSector[64], g_mirrorCount; diff --git a/polymer/eduke32/source/global.h b/polymer/eduke32/source/global.h index 9d5b9dcec..d47a68db5 100644 --- a/polymer/eduke32/source/global.h +++ b/polymer/eduke32/source/global.h @@ -64,7 +64,7 @@ G_EXTERN char pus,pub; G_EXTERN char ready2send; G_EXTERN char setupfilename[BMAX_PATH]; G_EXTERN char szPlayerName[32]; -G_EXTERN char tempbuf[2048],packbuf[PACKBUF_SIZE],menutextbuf[128],buf[1024]; +G_EXTERN char tempbuf[MAXSECTORS<<1],packbuf[PACKBUF_SIZE],menutextbuf[128],buf[1024]; G_EXTERN char typebuflen,typebuf[141]; G_EXTERN const char *s_buildDate; G_EXTERN input_t avg; diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index f062968f4..863d179f7 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -3267,7 +3267,7 @@ static int32_t P_DoCounters(DukePlayer_t *p) if (p->inv_amount[GET_SCUBA] > 0) { p->scuba_on = 1; - p->inven_icon = 6; + p->inven_icon = ICON_SCUBA; P_DoQuote(QUOTE_SCUBA_ON,p); } else @@ -3414,20 +3414,20 @@ void P_AddWeapon(DukePlayer_t *p,int32_t weapon) void P_SelectNextInvItem(DukePlayer_t *p) { if (p->inv_amount[GET_FIRSTAID] > 0) - p->inven_icon = 1; + p->inven_icon = ICON_FIRSTAID; else if (p->inv_amount[GET_STEROIDS] > 0) - p->inven_icon = 2; + p->inven_icon = ICON_STEROIDS; else if (p->inv_amount[GET_JETPACK] > 0) - p->inven_icon = 4; + p->inven_icon = ICON_JETPACK; else if (p->inv_amount[GET_HOLODUKE] > 0) - p->inven_icon = 3; + p->inven_icon = ICON_HOLODUKE; else if (p->inv_amount[GET_HEATS] > 0) - p->inven_icon = 5; + p->inven_icon = ICON_HEATS; else if (p->inv_amount[GET_SCUBA] > 0) - p->inven_icon = 6; + p->inven_icon = ICON_SCUBA; else if (p->inv_amount[GET_BOOTS] > 0) - p->inven_icon = 7; - else p->inven_icon = 0; + p->inven_icon = ICON_BOOTS; + else p->inven_icon = ICON_NONE; } void P_CheckWeapon(DukePlayer_t *p) @@ -5060,7 +5060,7 @@ void P_ProcessInput(int32_t snum) if (p->inv_amount[GET_BOOTS] > 0) { p->inv_amount[GET_BOOTS]--; - p->inven_icon = 7; + p->inven_icon = ICON_BOOTS; if (p->inv_amount[GET_BOOTS] <= 0) P_SelectNextInvItem(p); } diff --git a/polymer/eduke32/source/player.h b/polymer/eduke32/source/player.h index 0037fa89a..a373a5a4b 100644 --- a/polymer/eduke32/source/player.h +++ b/polymer/eduke32/source/player.h @@ -54,6 +54,19 @@ enum dukeinv_t { GET_MAX }; +// these are not in the same order as the above, and it can't be changed for compat reasons. lame! +enum dukeinvicon_t { + ICON_NONE, + ICON_FIRSTAID, + ICON_STEROIDS, + ICON_HOLODUKE, + ICON_JETPACK, + ICON_HEATS, + ICON_SCUBA, + ICON_BOOTS, + ICON_MAX +}; + enum dukeweapon_t { KNEE_WEAPON, // 0 PISTOL_WEAPON, diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index 2cb87985e..435256bdb 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -501,7 +501,7 @@ void G_CacheMapData(void) #ifdef USE_OPENGL // PRECACHE - if (ud.config.useprecache) + if (ud.config.useprecache && bpp > 8) { int32_t k,type; @@ -545,7 +545,7 @@ void G_CacheMapData(void) if ((j&7) == 0) G_HandleAsync(); - if (totalclock - tc > TICRATE/4) + if (bpp > 8 && totalclock - tc > TICRATE/4) { /*Bsprintf(tempbuf,"%d resources remaining\n",g_precacheCount-pc+1);*/ tc = min(100,100*pc/g_precacheCount); @@ -789,7 +789,7 @@ void P_ResetStatus(int32_t snum) if (p->inv_amount[GET_STEROIDS] < 400) { p->inv_amount[GET_STEROIDS] = 0; - p->inven_icon = 0; + p->inven_icon = ICON_NONE; } p->heat_on = 0; p->jetpack_on = 0; @@ -863,14 +863,12 @@ void P_ResetInventory(int32_t snum) Bmemset(p->inv_amount, 0, sizeof(p->inv_amount)); - p->inven_icon = 0; p->scuba_on = 0; p->heat_on = 0; p->jetpack_on = 0; p->holoduke_on = -1; - p->inv_amount[GET_SHIELD] = g_startArmorAmount; - p->inven_icon = 0; + p->inven_icon = ICON_NONE; VM_OnEvent(EVENT_RESETINVENTORY, p->i, snum, -1, 0); } diff --git a/polymer/eduke32/source/sector.c b/polymer/eduke32/source/sector.c index fe8acb6a7..6f228274c 100644 --- a/polymer/eduke32/source/sector.c +++ b/polymer/eduke32/source/sector.c @@ -2520,7 +2520,6 @@ void P_HandleSharedKeys(int32_t snum) } } - // j = sb_snum & ((15<<8)|(1<<12)|(1<<15)|(1<<16)|(1<<22)|(1<<19)|(1<<20)|(1<<21)|(1<<24)|(1<<25)|(1<<27)|(1<<28)|(1<<29)|(1<<30)|(1<<31)); j = sb_snum & ((15<inven_icon) { - case 4: + case ICON_JETPACK: sb_snum |= BIT(SK_JETPACK); break; - case 3: + case ICON_HOLODUKE: sb_snum |= BIT(SK_HOLODUKE); break; - case 5: + case ICON_HEATS: sb_snum |= BIT(SK_NIGHTVISION); break; - case 1: + case ICON_FIRSTAID: sb_snum |= BIT(SK_MEDKIT); break; - case 2: + case ICON_STEROIDS: sb_snum |= BIT(SK_STEROIDS); break; } @@ -2586,7 +2585,7 @@ void P_HandleSharedKeys(int32_t snum) { p->heat_on = !p->heat_on; P_UpdateScreenPal(p); - p->inven_icon = 5; + p->inven_icon = ICON_HEATS; A_PlaySound(NITEVISION_ONOFF,p->i); P_DoQuote(QUOTE_NVG_OFF-!!p->heat_on,p); } @@ -2603,7 +2602,7 @@ void P_HandleSharedKeys(int32_t snum) P_DoQuote(QUOTE_USED_STEROIDS,p); } if (p->inv_amount[GET_STEROIDS] > 0) - p->inven_icon = 2; + p->inven_icon = ICON_STEROIDS; } return; // is there significance to returning? } @@ -2629,44 +2628,44 @@ CHECKINV1: switch (dainv) { - case 4: + case ICON_JETPACK: if (p->inv_amount[GET_JETPACK] > 0 && i > 1) break; if (k) dainv++; else dainv--; goto CHECKINV1; - case 6: + case ICON_SCUBA: if (p->inv_amount[GET_SCUBA] > 0 && i > 1) break; if (k) dainv++; else dainv--; goto CHECKINV1; - case 2: + case ICON_STEROIDS: if (p->inv_amount[GET_STEROIDS] > 0 && i > 1) break; if (k) dainv++; else dainv--; goto CHECKINV1; - case 3: + case ICON_HOLODUKE: if (p->inv_amount[GET_HOLODUKE] > 0 && i > 1) break; if (k) dainv++; else dainv--; goto CHECKINV1; - case 0: - case 1: + case ICON_NONE: + case ICON_FIRSTAID: if (p->inv_amount[GET_FIRSTAID] > 0 && i > 1) break; if (k) dainv = 2; else dainv = 7; goto CHECKINV1; - case 5: + case ICON_HEATS: if (p->inv_amount[GET_HEATS] > 0 && i > 1) break; if (k) dainv++; else dainv--; goto CHECKINV1; - case 7: + case ICON_BOOTS: if (p->inv_amount[GET_BOOTS] > 0 && i > 1) break; if (k) dainv = 1; @@ -2888,7 +2887,7 @@ CHECKINV1: { if (p->inv_amount[GET_HOLODUKE] > 0) { - p->inven_icon = 3; + p->inven_icon = ICON_HOLODUKE; if (p->cursectnum > -1) { @@ -2927,7 +2926,7 @@ CHECKINV1: { p->inv_amount[GET_FIRSTAID] -= j; sprite[p->i].extra = p->max_player_health; - p->inven_icon = 1; + p->inven_icon = ICON_FIRSTAID; } else { @@ -2949,7 +2948,7 @@ CHECKINV1: p->jetpack_on = !p->jetpack_on; if (p->jetpack_on) { - p->inven_icon = 4; + p->inven_icon = ICON_JETPACK; if (p->scream_voice > FX_Ok) { FX_StopSound(p->scream_voice);