- Redneck Rampage fixes for changes in timer and mouse input interface.

This commit is contained in:
Christoph Oelckers 2019-09-20 22:07:53 +02:00
parent 5503ee98a0
commit 94cfcb4fbd
16 changed files with 226 additions and 223 deletions

View file

@ -3512,7 +3512,7 @@ default_case:
A_SetSprite(newSprite, CLIPMASK0);
}
actor[sectSprite].lasttransport = (totalclock & UINT8_MAX);
actor[sectSprite].lasttransport = ((int32_t)totalclock & UINT8_MAX);
if (sectLotag == ST_1_ABOVE_WATER || sectLotag == ST_2_UNDERWATER)
{

View file

@ -535,7 +535,7 @@ int32_t Anim_Play(const char *fn)
g_restorePalette = 0;
}
frametime = totalclock;
frametime = (int32_t)totalclock;
videoClearScreen(0);

View file

@ -564,7 +564,7 @@ void G_DoCheats(void)
{
pPlayer->over_shoulder_on ^= 1;
CAMERADIST = 0;
CAMERACLOCK = totalclock;
CAMERACLOCK = (int32_t) totalclock;
// P_DoQuote(QUOTE_CHEATS_DISABLED,pPlayer);
}
end_cheat(pPlayer);
@ -719,7 +719,7 @@ void G_DoCheats(void)
case CHEAT_RAAARON:
pPlayer->drug_mode = pPlayer->drug_mode ? 0 : 5;
pPlayer->drug_timer = totalclock;
pPlayer->drug_timer = (int32_t) totalclock;
end_cheat(pPlayer);
KB_FlushKeyboardQueue();
return;

View file

@ -669,7 +669,7 @@ RECHECK:
lastsyncofs = ktell(g_demo_recFilePtr);
initsyncofs = lastsyncofs;
lastsynctic = g_demo_cnt;
lastsyncclock = totalclock;
lastsyncclock = (int32_t)totalclock;
outofsync = 0;
#if KRANDDEBUG
krd_enable(2);
@ -822,7 +822,7 @@ RECHECK:
{
lastsyncofs = ktell(g_demo_recFilePtr);
lastsynctic = g_demo_cnt;
lastsyncclock = totalclock;
lastsyncclock = (int32_t)totalclock;
if (kread(g_demo_recFilePtr, tmpbuf, 4) != 4)
CORRUPT(7);
@ -988,7 +988,7 @@ nextdemo_nomenu:
}
else
{
j = calc_smoothratio(totalclock, ototalclock);
j = calc_smoothratio((int32_t)totalclock, (int32_t)ototalclock);
if (g_demo_paused && g_demo_rewind)
j = 65536-j;

View file

@ -212,7 +212,7 @@ void G_GameQuit(void)
if (g_gameQuit == 0)
{
g_gameQuit = 1;
g_quitDeadline = totalclock+120;
g_quitDeadline = (int32_t)totalclock + 120;
g_netDisconnect = 1;
}
@ -484,8 +484,8 @@ static int32_t G_DoThirdPerson(const DukePlayer_t *pp, vec3_t *vect, int16_t *vs
vect->y += mulscale16(n.y,CAMERADIST);
vect->z += mulscale16(n.z,CAMERADIST);
CAMERADIST = min(CAMERADIST+((totalclock-CAMERACLOCK)<<10),65536);
CAMERACLOCK = totalclock;
CAMERADIST = min(CAMERADIST + (((int32_t)totalclock - CAMERACLOCK) << 10), 65536);
CAMERACLOCK = (int32_t)totalclock;
updatesectorz(vect->x,vect->y,vect->z,vsectnum);
@ -963,7 +963,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
if (ud.pause_on || pPlayer->on_crane > -1)
smoothRatio = 65536;
else
smoothRatio = calc_smoothratio(totalclock, ototalclock);
smoothRatio = calc_smoothratio((int32_t)totalclock, (int32_t)ototalclock);
if (RRRA && g_fogType)
pPlayer->visibility = ud.const_visibility;
@ -1539,7 +1539,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
}
pPlayer->visibility += visinc;
lastvist = totalclock;
lastvist = (int32_t)totalclock;
}
}
@ -4737,7 +4737,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo
if (t->lotag == SE_27_DEMO_CAM && ud.recstat == 1)
{
t->picnum = 11+((totalclock>>3)&1);
t->picnum = 11 + (((int32_t)totalclock >> 3) & 1);
t->cstat |= 128;
}
else
@ -4921,7 +4921,7 @@ default_case1:
case RESPAWNMARKERYELLOW__STATICRR:
case RESPAWNMARKERGREEN__STATICRR:
if (!RR) goto default_case2;
t->picnum = 861 + ((totalclock >> 4) & 13);
t->picnum = 861 + (((int32_t)totalclock >> 4) & 13);
if (pSprite->picnum == RESPAWNMARKERRED)
t->pal = 0;
else if (pSprite->picnum == RESPAWNMARKERYELLOW)
@ -5005,7 +5005,7 @@ default_case1:
t->z -= ZOFFSET6;
break;
case CRYSTALAMMO__STATIC:
t->shade = (sintable[(totalclock<<4)&2047]>>10);
t->shade = (sintable[((int32_t)totalclock << 4) & 2047] >> 10);
if (RR) break;
continue;
case VIEWSCREEN__STATIC:
@ -5052,33 +5052,33 @@ default_case1:
{
if (RRRA && (sprite[pSprite->owner].picnum == CHEER || sprite[pSprite->owner].picnum == CHEERSTAYPUT))
{
t->picnum = CHEERBLADE + ((totalclock >> 4) & 3);
t->picnum = CHEERBLADE + (((int32_t)totalclock >> 4) & 3);
t->shade = -127;
}
else
t->picnum = SHRINKSPARK + ((totalclock >> 4) & 7);
t->picnum = SHRINKSPARK + (((int32_t)totalclock >> 4) & 7);
}
else
t->picnum = SHRINKSPARK+((totalclock>>4)&3);
t->picnum = SHRINKSPARK + (((int32_t)totalclock >> 4) & 3);
break;
case CHEERBOMB__STATICRR:
if (!RRRA) goto default_case2;
t->picnum = CHEERBOMB+( (totalclock>>4)&3 );
t->picnum = CHEERBOMB + (((int32_t)totalclock >> 4) & 3);
break;
case GROWSPARK__STATIC:
if (RR) goto default_case2;
t->picnum = GROWSPARK+((totalclock>>4)&3);
t->picnum = GROWSPARK + (((int32_t)totalclock >> 4) & 3);
break;
case SPIT__STATIC:
if (!RR) goto default_case2;
t->picnum = SPIT + ((totalclock >> 4) & 3);
t->picnum = SPIT + (((int32_t)totalclock >> 4) & 3);
if (RRRA)
{
if (sprite[pSprite->owner].picnum == MINION && sprite[pSprite->owner].pal == 8)
t->picnum = RRTILE3500 + ((totalclock >> 4) % 6);
t->picnum = RRTILE3500 + (((int32_t)totalclock >> 4) % 6);
else if (sprite[pSprite->owner].picnum == MINION && sprite[pSprite->owner].pal == 19)
{
t->picnum = RRTILE5090 + ((totalclock >> 4) & 3);
t->picnum = RRTILE5090 + (((int32_t)totalclock >> 4) & 3);
t->shade = -127;
}
else if (sprite[pSprite->owner].picnum == MAMA)
@ -5713,7 +5713,7 @@ rrcoolexplosion1:
t->pal = 0;
}
else if (RR && t->picnum == FIRELASER)
t->picnum = FIRELASER+((totalclock>>2)&5);
t->picnum = FIRELASER + (((int32_t)totalclock >> 2) & 5);
t->shade = -127;
t->cstat |= 8192+1024;
break;
@ -5828,11 +5828,11 @@ rrcoolexplosion1:
t->shade = -127;
break;
case RRTILE2034__STATICRR:
t->picnum = RRTILE2034 + (totalclock & 1);
t->picnum = RRTILE2034 + ((int32_t)totalclock & 1);
break;
case RRTILE2944__STATICRR:
t->shade = -127;
t->picnum = RRTILE2944 + ((totalclock >> 2) & 4);
t->picnum = RRTILE2944 + (((int32_t)totalclock >> 2) & 4);
break;
case PLAYERONWATER__STATIC:
#ifdef USE_OPENGL
@ -6443,7 +6443,7 @@ FAKE_F3:
g_player[myconnectindex].ps->over_shoulder_on = !g_player[myconnectindex].ps->over_shoulder_on;
CAMERADIST = 0;
CAMERACLOCK = totalclock;
CAMERACLOCK = (int32_t)totalclock;
P_DoQuote(QUOTE_VIEW_MODE_OFF + g_player[myconnectindex].ps->over_shoulder_on, g_player[myconnectindex].ps);
}
@ -6509,7 +6509,7 @@ FAKE_F3:
if (ud.overhead_on != 0)
{
int const timerOffset = (totalclock - nonsharedtimer);
int const timerOffset = ((int32_t)totalclock - nonsharedtimer);
nonsharedtimer += timerOffset;
if (BUTTON(gamefunc_Enlarge_Screen))
@ -8309,7 +8309,7 @@ MAIN_LOOP_RESTART:
ototalclock += TICSPERFRAME;
int const moveClock = totalclock;
int const moveClock = (int32_t)totalclock;
if (((ud.show_help == 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU) || ud.recstat == 2 || (g_netServer || ud.multimode > 1)) &&
(g_player[myconnectindex].ps->gm&MODE_GAME))
@ -8363,7 +8363,7 @@ MAIN_LOOP_RESTART:
= ((ud.show_help == 0 && (!g_netServer && ud.multimode < 2) && !(g_player[myconnectindex].ps->gm & MODE_MENU))
|| (g_netServer || ud.multimode > 1)
|| ud.recstat == 2)
? calc_smoothratio(totalclock, ototalclock)
? calc_smoothratio((int32_t)totalclock, (int32_t)ototalclock)
: 65536;
G_DrawRooms(screenpeek, smoothRatio);

View file

@ -1100,7 +1100,7 @@ static int32_t VM_ResetPlayer(int const playerNum, int32_t vmFlags)
if (playerNum == myconnectindex)
{
CAMERADIST = 0;
CAMERACLOCK = totalclock;
CAMERACLOCK = (int32_t)totalclock;
}
if (g_fakeMultiMode)

View file

@ -136,7 +136,7 @@ G_EXTERN int16_t g_mirrorWall[64];
G_EXTERN int32_t *labelcode;
G_EXTERN int32_t *labeltype;
G_EXTERN int32_t lockclock;
G_EXTERN int32_t ototalclock;
G_EXTERN ClockTicks ototalclock;
G_EXTERN int32_t g_wupass;
G_EXTERN int32_t g_chickenPlant;

View file

@ -136,7 +136,7 @@ static void Menu_DrawTopBarCaption(const char *caption, const vec2_t origin)
static FORCE_INLINE int32_t Menu_CursorShade(void)
{
return 4-(sintable[(totalclock<<4)&2047]>>11);
return 4-(sintable[((int32_t)totalclock<<4)&2047]>>11);
}
static void Menu_DrawCursorCommon(int32_t x, int32_t y, int32_t z, int32_t picnum, int32_t ydim_upper = 0, int32_t ydim_lower = ydim-1)
{
@ -145,12 +145,12 @@ static void Menu_DrawCursorCommon(int32_t x, int32_t y, int32_t z, int32_t picnu
static void Menu_DrawCursorLeft(int32_t x, int32_t y, int32_t z)
{
const int frames = RR ? 16 : 7;
Menu_DrawCursorCommon(x, y, z, SPINNINGNUKEICON+((totalclock>>3)%frames));
Menu_DrawCursorCommon(x, y, z, SPINNINGNUKEICON + (((int32_t)totalclock >> 3) % frames));
}
static void Menu_DrawCursorRight(int32_t x, int32_t y, int32_t z)
{
const int frames = RR ? 16 : 7;
Menu_DrawCursorCommon(x, y, z, SPINNINGNUKEICON+frames-1-((frames-1+(totalclock>>3))%frames));
Menu_DrawCursorCommon(x, y, z, SPINNINGNUKEICON + frames - 1 - ((frames - 1 + ((int32_t)totalclock >> 3)) % frames));
}
static void Menu_DrawCursorTextTile(int32_t x, int32_t y, int32_t h, int32_t picnum, vec2_16_t const & siz, int32_t ydim_upper = 0, int32_t ydim_lower = ydim-1)
{
@ -168,7 +168,7 @@ static void Menu_DrawCursorText(int32_t x, int32_t y, int32_t h, int32_t ydim_up
return;
}
Menu_DrawCursorTextTile(x, y, h, SPINNINGNUKEICON+((totalclock>>3)%frames), siz, ydim_upper, ydim_lower);
Menu_DrawCursorTextTile(x, y, h, SPINNINGNUKEICON + (((int32_t)totalclock >> 3) % frames), siz, ydim_upper, ydim_lower);
}
@ -840,9 +840,9 @@ static MenuEntry_t ME_MOUSESETUP_SMOOTH = MAKE_MENUENTRY( "Filter input:", &MF_R
static MenuLink_t MEO_MOUSESETUP_ADVANCED = { MENU_MOUSEADVANCED, MA_Advance, };
static MenuEntry_t ME_MOUSESETUP_ADVANCED = MAKE_MENUENTRY( "Advanced setup", &MF_Redfont, &MEF_BigOptionsRt, &MEO_MOUSESETUP_ADVANCED, Link );
#endif
static MenuRangeInt32_t MEO_MOUSEADVANCED_SCALEX = MAKE_MENURANGE(&ud.config.MouseAnalogueScale[0], &MF_Redfont, 0, 65536, 65536, 63, 3);
static MenuRangeInt32_t MEO_MOUSEADVANCED_SCALEX = MAKE_MENURANGE(&ud.config.MouseAnalogueScale[0], &MF_Redfont, -262144, 262144, 65536, 161, 3);
static MenuEntry_t ME_MOUSEADVANCED_SCALEX = MAKE_MENUENTRY("X-Scale:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_MOUSEADVANCED_SCALEX, RangeInt32);
static MenuRangeInt32_t MEO_MOUSEADVANCED_SCALEY = MAKE_MENURANGE(&ud.config.MouseAnalogueScale[1], &MF_Redfont, 0, 65536, 65536, 63, 3);
static MenuRangeInt32_t MEO_MOUSEADVANCED_SCALEY = MAKE_MENURANGE(&ud.config.MouseAnalogueScale[1], &MF_Redfont, -262144, 262144, 65536, 161, 3);
static MenuEntry_t ME_MOUSEADVANCED_SCALEY = MAKE_MENUENTRY("Y-Scale:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_MOUSEADVANCED_SCALEY, RangeInt32);
static MenuEntry_t *MEL_MOUSESETUP[] = {
@ -2235,7 +2235,7 @@ static void Menu_PreDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin)
{
rotatesprite_fs(origin.x + (MENU_MARGIN_CENTER<<16), origin.y + ((28+l)<<16), 65536L,0,INGAMEDUKETHREEDEE,0,0,10);
if (PLUTOPAK) // JBF 20030804
rotatesprite_fs(origin.x + ((MENU_MARGIN_CENTER+100)<<16), origin.y + (36<<16), 65536L,0,PLUTOPAKSPRITE+2,(sintable[(totalclock<<4)&2047]>>11),0,2+8);
rotatesprite_fs(origin.x + ((MENU_MARGIN_CENTER+100)<<16), origin.y + (36<<16), 65536L,0,PLUTOPAKSPRITE+2,(sintable[((int32_t)totalclock<<4)&2047]>>11),0,2+8);
}
break;
@ -2245,9 +2245,9 @@ static void Menu_PreDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin)
case MENU_PLAYER:
if (RR)
rotatesprite_fs(origin.x + (260<<16), origin.y + ((24+(tilesiz[APLAYER].y>>2))<<16), 24576L,0,3845+36-((((8-(totalclock>>4)))&7)*5),0,entry == &ME_PLAYER_TEAM ? G_GetTeamPalette(ud.team) : ud.color,10);
rotatesprite_fs(origin.x + (260<<16), origin.y + ((24+(tilesiz[APLAYER].y>>2))<<16), 24576L,0,3845+36-((((8-((int32_t)totalclock>>4)))&7)*5),0,entry == &ME_PLAYER_TEAM ? G_GetTeamPalette(ud.team) : ud.color,10);
else
rotatesprite_fs(origin.x + (260<<16), origin.y + ((24+(tilesiz[APLAYER].y>>1))<<16), 49152L,0,1441-((((4-(totalclock>>4)))&3)*5),0,entry == &ME_PLAYER_TEAM ? G_GetTeamPalette(ud.team) : ud.color,10);
rotatesprite_fs(origin.x + (260<<16), origin.y + ((24+(tilesiz[APLAYER].y>>1))<<16), 49152L,0,1441-((((4-((int32_t)totalclock>>4)))&3)*5),0,entry == &ME_PLAYER_TEAM ? G_GetTeamPalette(ud.team) : ud.color,10);
break;
case MENU_MACROS:
@ -4377,19 +4377,19 @@ MenuAnimation_t m_animation;
int32_t Menu_Anim_SinOutRight(MenuAnimation_t *animdata)
{
return sintable[divscale10(totalclock - animdata->start, animdata->length) + 512] - 16384;
return sintable[divscale10((int32_t)totalclock - animdata->start, animdata->length) + 512] - 16384;
}
int32_t Menu_Anim_SinInRight(MenuAnimation_t *animdata)
{
return sintable[divscale10(totalclock - animdata->start, animdata->length) + 512] + 16384;
return sintable[divscale10((int32_t)totalclock - animdata->start, animdata->length) + 512] + 16384;
}
int32_t Menu_Anim_SinOutLeft(MenuAnimation_t *animdata)
{
return -sintable[divscale10(totalclock - animdata->start, animdata->length) + 512] + 16384;
return -sintable[divscale10((int32_t)totalclock - animdata->start, animdata->length) + 512] + 16384;
}
int32_t Menu_Anim_SinInLeft(MenuAnimation_t *animdata)
{
return -sintable[divscale10(totalclock - animdata->start, animdata->length) + 512] - 16384;
return -sintable[divscale10((int32_t)totalclock - animdata->start, animdata->length) + 512] - 16384;
}
void Menu_AnimateChange(int32_t cm, MenuAnimationType_t animtype)
@ -4404,7 +4404,7 @@ void Menu_AnimateChange(int32_t cm, MenuAnimationType_t animtype)
{
m_animation.out = Menu_Anim_SinOutRight;
m_animation.in = Menu_Anim_SinInRight;
m_animation.start = totalclock;
m_animation.start = (int32_t)totalclock;
m_animation.length = 30;
m_animation.previous = previousMenu;
@ -4421,7 +4421,7 @@ void Menu_AnimateChange(int32_t cm, MenuAnimationType_t animtype)
{
m_animation.out = Menu_Anim_SinOutLeft;
m_animation.in = Menu_Anim_SinInLeft;
m_animation.start = totalclock;
m_animation.start = (int32_t)totalclock;
m_animation.length = 30;
m_animation.previous = previousMenu;
@ -4843,7 +4843,7 @@ void Menu_Close(uint8_t playerID)
{
ready2send = 1;
totalclock = ototalclock;
CAMERACLOCK = totalclock;
CAMERACLOCK =(int32_t) totalclock;
CAMERADIST = 65536;
m_animation.start = 0;
m_animation.length = 0;
@ -4851,7 +4851,7 @@ void Menu_Close(uint8_t playerID)
// Reset next-viewscreen-redraw counter.
// XXX: are there any other cases like that in need of handling?
if (g_curViewscreen >= 0)
actor[g_curViewscreen].t_data[0] = totalclock;
actor[g_curViewscreen].t_data[0] = (int32_t)totalclock;
}
walock[TILE_SAVESHOT] = 199;
@ -4898,7 +4898,7 @@ enum MenuTextFlags_t
static void Menu_GetFmt(const MenuFont_t *font, uint8_t const status, int32_t *s)
{
if (status & MT_Selected)
*s = sintable[(totalclock<<5)&2047]>>12;
*s = sintable[((int32_t)totalclock << 5) & 2047] >> 12;
else
*s = font->shade_deselected;
// sum shade values
@ -5967,7 +5967,7 @@ static void Menu_Run_MouseReturn(Menu_t *cm, const vec2_t origin)
uint32_t const posx = tilesiz[SELECTDIR].y * SELECTDIR_z;
rotatesprite_(origin.x + posx, 0, SELECTDIR_z, 512, SELECTDIR,
Menu_RunInput_MouseReturn_status ? 4 - (sintable[(totalclock << 4) & 2047] >> 11) : 6, 0,
Menu_RunInput_MouseReturn_status ? 4 - (sintable[((int32_t)totalclock << 4) & 2047] >> 11) : 6, 0,
2 | 8 | 16 | RS_ALIGN_L, MOUSEALPHA, 0, xdim_from_320_16(origin.x + x_widescreen_left()), 0,
xdim_from_320_16(origin.x + x_widescreen_left() + (posx>>1)), ydim - 1);
}
@ -7619,14 +7619,14 @@ void M_DisplayMenus(void)
m_menuchange_watchpoint++;
#endif
if (totalclock < m_animation.start)
if ((int32_t)totalclock < m_animation.start)
{
m_animation.start = 0;
m_animation.length = 0;
}
// Determine animation values.
if (totalclock < m_animation.start + m_animation.length)
if ((int32_t)totalclock < m_animation.start + m_animation.length)
{
const int32_t screenwidth = scale(240<<16, xdim, ydim);
@ -7640,7 +7640,7 @@ void M_DisplayMenus(void)
}
// Display the menu, with a transition animation if applicable.
if (totalclock < m_animation.start + m_animation.length)
if ((int32_t)totalclock < m_animation.start + m_animation.length)
{
Menu_Run(m_animation.previous, previousOrigin);
Menu_Run(m_animation.current, origin);
@ -7667,7 +7667,7 @@ void M_DisplayMenus(void)
if (MOUSEACTIVECONDITIONAL(mouseAdvanceClickState()) || m_mousepos.x != m_prevmousepos.x || m_mousepos.y != m_prevmousepos.y)
{
m_prevmousepos = m_mousepos;
m_mouselastactivity = totalclock;
m_mouselastactivity = (int32_t)totalclock;
}
#if !defined EDUKE32_TOUCH_DEVICES
else
@ -7710,7 +7710,7 @@ void M_DisplayMenus(void)
if ((g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU)
{
G_UpdateScreenArea();
CAMERACLOCK = totalclock;
CAMERACLOCK = (int32_t)totalclock;
CAMERADIST = 65536;
}
}

View file

@ -513,8 +513,8 @@ extern int32_t m_mousewake_watchpoint, m_menuchange_watchpoint;
// alpha increments of 3 --> 255 / 3 = 85 --> round up to power of 2 --> 128 --> divide by 2 --> 64 alphatabs required
// use 16 anyway :P
# define MOUSEUSEALPHA (videoGetRenderMode() != REND_CLASSIC || numalphatabs >= 15)
# define MOUSEALPHA (MOUSEUSEALPHA ? clamp((totalclock - m_mouselastactivity - 90)*3, 0, 255) : 0)
# define CURSORALPHA (MOUSEUSEALPHA ? clamp((totalclock - m_mouselastactivity - 90)*2 + (255/3), (255/3), 255) : 255/3)
#define MOUSEALPHA (MOUSEUSEALPHA ? clamp(((int32_t)totalclock - m_mouselastactivity - 90) * 3, 0, 255) : 0)
#define CURSORALPHA (MOUSEUSEALPHA ? clamp(((int32_t)totalclock - m_mouselastactivity - 90) * 2 + (255 / 3), (255 / 3), 255) : 255 / 3)
# define MOUSEACTIVECONDITION (totalclock - m_mouselastactivity < M_MOUSETIMEOUT)
# define MOUSEACTIVECONDITIONAL(condition) (MOUSEACTIVECONDITION && (condition))
# define MOUSEINACTIVECONDITIONAL(condition) (!MOUSEACTIVECONDITION && (condition))

View file

@ -152,7 +152,7 @@ void Net_SyncPlayer(ENetEvent *event)
event->peer->data = (void *)(intptr_t)i;
g_player[i].netsynctime = totalclock;
g_player[i].netsynctime = (int32_t)totalclock;
g_player[i].playerquitflag = 1;
//g_player[i].revision = g_netMapRevision;
@ -1823,7 +1823,7 @@ void Net_SendMessage(void)
int32_t const text_x = fullwidth >= (320<<16) ? (320<<16) - fullwidth : mpgametext_x;
mpgametext(text_x, y, typebuf, 1, 2|8|16|ROTATESPRITE_FULL16, 0, TEXT_YCENTER|TEXT_LITERALESCAPE);
int32_t const cursor_x = text_x + width + textsc((tilesiz[SPINNINGNUKEICON].x<<14)+(1<<16));
rotatesprite_fs(cursor_x, y, textsc(32768), 0, SPINNINGNUKEICON+((totalclock>>3)%7), 4-(sintable[(totalclock<<4)&2047]>>11), 0, 2|8);
rotatesprite_fs(cursor_x, y, textsc(32768), 0, SPINNINGNUKEICON+(((int32_t)totalclock>>3)%7), 4-(sintable[((int32_t)totalclock<<4)&2047]>>11), 0, 2|8);
if (hitstate == 1)
{

View file

@ -1623,7 +1623,7 @@ void P_DisplayScuba(void)
if (!(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING))
{
G_DrawTileScaled(320 - (tilesiz[SCUBAMASK].x >> 1) - 15, 200 - (tilesiz[SCUBAMASK].y >> 1) + (sintable[totalclock & 2047] >> 10),
G_DrawTileScaled(320 - (tilesiz[SCUBAMASK].x >> 1) - 15, 200 - (tilesiz[SCUBAMASK].y >> 1) + (sintable[(int32_t)totalclock & 2047] >> 10),
SCUBAMASK, 0, 2 + 16 + DRAWEAP_CENTER+512, scubaPal,49152);
G_DrawTileScaled(320 - tilesiz[SCUBAMASK+4].x, 200 - tilesiz[SCUBAMASK+4].y, SCUBAMASK+4, 0, 2 + 16 + DRAWEAP_CENTER + 1024, scubaPal);
G_DrawTileScaled(tilesiz[SCUBAMASK+4].x, 200 - tilesiz[SCUBAMASK+4].y, SCUBAMASK+4, 0, 2 + 4 + 16 + DRAWEAP_CENTER + 1024, scubaPal);
@ -1636,7 +1636,7 @@ void P_DisplayScuba(void)
}
else
{
G_DrawTileScaled(320 - (tilesiz[SCUBAMASK].x >> 1) - 15, 200 - (tilesiz[SCUBAMASK].y >> 1) + (sintable[totalclock & 2047] >> 10),
G_DrawTileScaled(320 - (tilesiz[SCUBAMASK].x >> 1) - 15, 200 - (tilesiz[SCUBAMASK].y >> 1) + (sintable[(int32_t)totalclock & 2047] >> 10),
SCUBAMASK, 0, 2 + 16 + DRAWEAP_CENTER, scubaPal,49152);
G_DrawTileScaled(320 - tilesiz[SCUBAMASK+4].x, 200 - tilesiz[SCUBAMASK+4].y, SCUBAMASK+4, 0, 2 + 16 + DRAWEAP_CENTER, scubaPal);
G_DrawTileScaled(tilesiz[SCUBAMASK+4].x, 200 - tilesiz[SCUBAMASK+4].y, SCUBAMASK+4, 0, 2 + 4 + 16 + DRAWEAP_CENTER, scubaPal);
@ -2749,26 +2749,19 @@ enddisplayweapon:
int32_t g_myAimMode = 0, g_myAimStat = 0, g_oldAimStat = 0;
int32_t mouseyaxismode = -1;
int32_t g_emuJumpTics = 0;
void P_GetInput(int playerNum)
void P_GetInput(int const playerNum)
{
static ControlInfo info[2];
static int32_t turnHeldTime = 0; // MED
static int32_t lastControlInput = 0; // MED
DukePlayer_t * pPlayer = g_player[playerNum].ps;
static input_t staticInput;
static int32_t dyaw;
auto const pPlayer = g_player[playerNum].ps;
ControlInfo info;
if ((pPlayer->gm & (MODE_MENU|MODE_TYPE)) || (ud.pause_on && !KB_KeyPressed(sc_Pause)))
if ((pPlayer->gm & (MODE_MENU | MODE_TYPE)) || (ud.pause_on && !KB_KeyPressed(sc_Pause)))
{
if (!(pPlayer->gm&MODE_MENU))
CONTROL_GetInput(&info[0]);
if (!(pPlayer->gm & MODE_MENU))
CONTROL_GetInput(&info);
dyaw = 0;
Bmemset(&localInput, 0, sizeof(input_t));
localInput.bits = (((int32_t)g_gameQuit) << SK_GAMEQUIT);
localInput.extbits = (g_player[playerNum].pteam != g_player[playerNum].ps->team) << 6;
localInput.extbits |= (1 << 7);
return;
@ -2790,92 +2783,100 @@ void P_GetInput(int playerNum)
}
}
int32_t const aimMode = (g_myAimMode) ? (int32_t)analog_lookingupanddown : ud.config.MouseAnalogueAxes[1];
if (aimMode != mouseyaxismode)
{
CONTROL_MapAnalogAxis(1, aimMode, controldevice_mouse);
mouseyaxismode = aimMode;
}
CONTROL_GetInput(&info[0]);
CONTROL_GetInput(&info);
if (ud.config.MouseDeadZone)
{
if (info[0].dpitch > 0)
info[0].dpitch = (info[0].dpitch > ud.config.MouseDeadZone) ? info[0].dpitch - ud.config.MouseDeadZone : 0;
else if (info[0].dpitch < 0)
info[0].dpitch = (info[0].dpitch < -ud.config.MouseDeadZone) ? info[0].dpitch + ud.config.MouseDeadZone : 0;
if (info.mousey > 0)
info.mousey = max(info.mousey - ud.config.MouseDeadZone, 0);
else if (info.mousey < 0)
info.mousey = min(info.mousey + ud.config.MouseDeadZone, 0);
if (info[0].dyaw > 0)
info[0].dyaw = (info[0].dyaw > ud.config.MouseDeadZone) ? info[0].dyaw - ud.config.MouseDeadZone : 0;
else if (info[0].dyaw < 0)
info[0].dyaw = (info[0].dyaw < -ud.config.MouseDeadZone) ? info[0].dyaw + ud.config.MouseDeadZone : 0;
if (info.mousex > 0)
info.mousex = max(info.mousex - ud.config.MouseDeadZone, 0);
else if (info.mousex < 0)
info.mousex = min(info.mousex + ud.config.MouseDeadZone, 0);
}
if (ud.config.MouseBias)
{
if (klabs(info[0].dyaw) > klabs(info[0].dpitch))
info[0].dpitch = tabledivide32_noinline(info[0].dpitch, ud.config.MouseBias);
else info[0].dyaw = tabledivide32_noinline(info[0].dyaw, ud.config.MouseBias);
if (klabs(info.mousex) > klabs(info.mousey))
info.mousey = tabledivide32_noinline(info.mousey, ud.config.MouseBias);
else
info.mousex = tabledivide32_noinline(info.mousex, ud.config.MouseBias);
}
int const elapsedTics = totalclock-lastControlInput;
lastControlInput = totalclock;
// JBF: Run key behaviour is selectable
int const playerRunning = (ud.runkey_mode) ? (BUTTON(gamefunc_Run) | ud.auto_run) : (ud.auto_run ^ BUTTON(gamefunc_Run));
staticInput.svel = staticInput.fvel = staticInput.q16avel = staticInput.q16horz = 0;
if (BUTTON(gamefunc_Strafe))
{
staticInput.svel = -(info[0].dyaw + dyaw) >> 3;
dyaw = (info[0].dyaw + dyaw) % 8;
}
else
staticInput.q16avel = fix16_div(fix16_from_int(info[0].dyaw), F16(32));
staticInput.q16horz = fix16_div(fix16_from_int(info[0].dpitch), F16(128));
if (ud.mouseflip) staticInput.q16horz = -staticInput.q16horz;
staticInput.svel -= info[0].dx;
staticInput.fvel = -info[0].dz >> 6;
// OSD_Printf("running: %d\n", running);
int const turnAmount = playerRunning ? (NORMALTURN << 1) : NORMALTURN;
constexpr int const analogTurnAmount = (NORMALTURN << 1);
int const keyMove = playerRunning ? (NORMALKEYMOVE << 1) : NORMALKEYMOVE;
constexpr int const analogExtent = 32767; // KEEPINSYNC sdlayer.cpp
input_t input {};
if (BUTTON(gamefunc_Strafe))
{
if (BUTTON(gamefunc_Turn_Left) && !(g_player[playerNum].ps->movement_lock&4))
staticInput.svel -= -keyMove;
if (BUTTON(gamefunc_Turn_Right) && !(g_player[playerNum].ps->movement_lock&8))
staticInput.svel -= keyMove;
static int strafeyaw;
input.svel = -(info.mousex + strafeyaw) >> 3;
strafeyaw = (info.mousex + strafeyaw) % 8;
input.svel -= info.dyaw * keyMove / analogExtent;
}
else
{
input.q16avel = fix16_div(fix16_from_int(info.mousex), F16(32));
input.q16avel += fix16_from_int(info.dyaw) / analogExtent * (analogTurnAmount << 1);
}
if (g_myAimMode)
input.q16horz = fix16_div(fix16_from_int(info.mousey), F16(64));
else
input.fvel = -(info.mousey >> 6);
if (ud.mouseflip)
input.q16horz = -input.q16horz;
input.q16horz -= fix16_from_int(info.dpitch) / analogExtent * analogTurnAmount;
input.svel -= info.dx * keyMove / analogExtent;
input.fvel -= info.dz * keyMove / analogExtent;
if (BUTTON(gamefunc_Strafe))
{
if (BUTTON(gamefunc_Turn_Left) && !(pPlayer->movement_lock & 4))
input.svel -= -keyMove;
if (BUTTON(gamefunc_Turn_Right) && !(pPlayer->movement_lock & 8))
input.svel -= keyMove;
}
else
{
static int32_t turnHeldTime = 0;
static int32_t lastInputClock = 0; // MED
int32_t const elapsedTics = (int32_t)totalclock - lastInputClock;
lastInputClock = (int32_t)totalclock;
if (BUTTON(gamefunc_Turn_Left))
{
turnHeldTime += elapsedTics;
staticInput.q16avel -= fix16_from_int((turnHeldTime >= TURBOTURNTIME) ? (turnAmount << 1) : (PREAMBLETURN << 1));
input.q16avel -= fix16_from_int((turnHeldTime >= TURBOTURNTIME) ? (turnAmount << 1) : (PREAMBLETURN << 1));
}
else if (BUTTON(gamefunc_Turn_Right))
{
turnHeldTime += elapsedTics;
staticInput.q16avel += fix16_from_int((turnHeldTime >= TURBOTURNTIME) ? (turnAmount << 1) : (PREAMBLETURN << 1));
input.q16avel += fix16_from_int((turnHeldTime >= TURBOTURNTIME) ? (turnAmount << 1) : (PREAMBLETURN << 1));
}
else
turnHeldTime=0;
turnHeldTime = 0;
}
if (BUTTON(gamefunc_Strafe_Left) && !(g_player[playerNum].ps->movement_lock & 4))
staticInput.svel += keyMove;
if (BUTTON(gamefunc_Strafe_Left) && !(pPlayer->movement_lock & 4))
input.svel += keyMove;
if (BUTTON(gamefunc_Strafe_Right) && !(g_player[playerNum].ps->movement_lock & 8))
staticInput.svel += -keyMove;
if (BUTTON(gamefunc_Strafe_Right) && !(pPlayer->movement_lock & 8))
input.svel += -keyMove;
if (RR)
{
@ -2890,45 +2891,46 @@ void P_GetInput(int playerNum)
{
if (BUTTON(gamefunc_Move_Forward))
{
staticInput.fvel += keyMove;
input.fvel += keyMove;
if (pPlayer->drink_amt & 1)
staticInput.svel += keyMove;
input.svel += keyMove;
else
staticInput.svel -= keyMove;
input.svel -= keyMove;
}
if (BUTTON(gamefunc_Move_Backward))
{
staticInput.fvel += -keyMove;
input.fvel += -keyMove;
if (pPlayer->drink_amt & 1)
staticInput.svel -= keyMove;
input.svel -= keyMove;
else
staticInput.svel += keyMove;
input.svel += keyMove;
}
}
else
{
if (BUTTON(gamefunc_Move_Forward))
staticInput.fvel += keyMove;
input.fvel += keyMove;
if (BUTTON(gamefunc_Move_Backward))
staticInput.fvel += -keyMove;
input.fvel += -keyMove;
}
}
}
else
{
if (BUTTON(gamefunc_Move_Forward) && !(g_player[playerNum].ps->movement_lock & 1))
staticInput.fvel += keyMove;
if (BUTTON(gamefunc_Move_Forward) && !(pPlayer->movement_lock & 1))
input.fvel += keyMove;
if (BUTTON(gamefunc_Move_Backward) && !(g_player[playerNum].ps->movement_lock & 2))
staticInput.fvel += -keyMove;
if (BUTTON(gamefunc_Move_Backward) && !(pPlayer->movement_lock & 2))
input.fvel += -keyMove;
}
staticInput.fvel = clamp(staticInput.fvel, -MAXVEL, MAXVEL);
staticInput.svel = clamp(staticInput.svel, -MAXSVEL, MAXSVEL);
staticInput.q16avel = fix16_clamp(staticInput.q16avel, F16(-MAXANGVEL), F16(MAXANGVEL));
staticInput.q16horz = fix16_clamp(staticInput.q16horz, F16(-MAXHORIZ), F16(MAXHORIZ));
input.fvel = clamp(input.fvel, -MAXVEL, MAXVEL);
input.svel = clamp(input.svel, -MAXSVEL, MAXSVEL);
input.q16avel = fix16_clamp(input.q16avel, F16(-MAXANGVEL), F16(MAXANGVEL));
input.q16horz = fix16_clamp(input.q16horz, F16(-MAXHORIZ), F16(MAXHORIZ));
int weaponSelection;
@ -2944,10 +2946,10 @@ void P_GetInput(int playerNum)
if (weaponSelection == gamefunc_Weapon_1-1)
weaponSelection = 0;
if (BUTTON(gamefunc_Previous_Weapon) || (BUTTON(gamefunc_Dpad_Select) && staticInput.fvel < 0))
if (BUTTON(gamefunc_Previous_Weapon) || (BUTTON(gamefunc_Dpad_Select) && input.fvel < 0))
weaponSelection = 11;
if (BUTTON(gamefunc_Next_Weapon) || (BUTTON(gamefunc_Dpad_Select) && staticInput.fvel > 0))
if (BUTTON(gamefunc_Next_Weapon) || (BUTTON(gamefunc_Dpad_Select) && input.fvel > 0))
weaponSelection = 12;
if (BUTTON(gamefunc_Alt_Weapon))
@ -2968,8 +2970,8 @@ void P_GetInput(int playerNum)
if (RR && TEST_SYNC_KEY(localInput.bits, SK_CROUCH))
localInput.bits &= ~(1<< SK_JUMP);
localInput.bits |= BUTTON(gamefunc_Fire) << SK_FIRE;
localInput.bits |= (BUTTON(gamefunc_Aim_Up) || (BUTTON(gamefunc_Dpad_Aiming) && staticInput.fvel > 0)) << SK_AIM_UP;
localInput.bits |= (BUTTON(gamefunc_Aim_Down) || (BUTTON(gamefunc_Dpad_Aiming) && staticInput.fvel < 0)) << SK_AIM_DOWN;
localInput.bits |= (BUTTON(gamefunc_Aim_Up) || (BUTTON(gamefunc_Dpad_Aiming) && input.fvel > 0)) << SK_AIM_UP;
localInput.bits |= (BUTTON(gamefunc_Aim_Down) || (BUTTON(gamefunc_Dpad_Aiming) && input.fvel < 0)) << SK_AIM_DOWN;
localInput.bits |= ((ud.runkey_mode) ? (ud.auto_run | BUTTON(gamefunc_Run)) : (BUTTON(gamefunc_Run) ^ ud.auto_run)) << SK_RUN;
localInput.bits |= BUTTON(gamefunc_Look_Left) << SK_LOOK_LEFT;
if (RR && pPlayer->drink_amt > 88)
@ -2986,7 +2988,7 @@ void P_GetInput(int playerNum)
localInput.bits |= BUTTON(gamefunc_Center_View) << SK_CENTER_VIEW;
localInput.bits |= BUTTON(gamefunc_Holster_Weapon) << SK_HOLSTER;
localInput.bits |= (BUTTON(gamefunc_Inventory_Left) ||
(BUTTON(gamefunc_Dpad_Select) && (staticInput.svel > 0 || staticInput.q16avel < 0))) << SK_INV_LEFT;
(BUTTON(gamefunc_Dpad_Select) && (input.svel > 0 || input.q16avel < 0))) << SK_INV_LEFT;
localInput.bits |= KB_KeyPressed(sc_Pause) << SK_PAUSE;
localInput.bits |= BUTTON(gamefunc_Quick_Kick) << SK_QUICK_KICK;
localInput.bits |= g_myAimMode << SK_AIMMODE;
@ -2994,7 +2996,7 @@ void P_GetInput(int playerNum)
localInput.bits |= BUTTON(gamefunc_Jetpack) << SK_JETPACK;
localInput.bits |= (g_gameQuit << SK_GAMEQUIT);
localInput.bits |= (BUTTON(gamefunc_Inventory_Right) ||
(BUTTON(gamefunc_Dpad_Select) && (staticInput.svel < 0 || staticInput.q16avel > 0))) << SK_INV_RIGHT;
(BUTTON(gamefunc_Dpad_Select) && (input.svel < 0 || input.q16avel > 0))) << SK_INV_RIGHT;
localInput.bits |= BUTTON(gamefunc_TurnAround) << SK_TURNAROUND;
localInput.bits |= BUTTON(gamefunc_Open) << SK_OPEN;
localInput.bits |= BUTTON(gamefunc_Inventory) << SK_INVENTORY;
@ -3002,45 +3004,46 @@ void P_GetInput(int playerNum)
if (BUTTON(gamefunc_Dpad_Select))
{
staticInput.fvel = 0;
staticInput.svel = 0;
staticInput.q16avel = 0;
input.fvel = 0;
input.svel = 0;
input.q16avel = 0;
}
if (BUTTON(gamefunc_Dpad_Aiming))
staticInput.fvel = 0;
input.fvel = 0;
localInput.extbits = (BUTTON(gamefunc_Move_Forward) || (staticInput.fvel > 0));
localInput.extbits |= (BUTTON(gamefunc_Move_Backward) || (staticInput.fvel < 0))<<1;
localInput.extbits |= (BUTTON(gamefunc_Strafe_Left) || (staticInput.svel > 0))<<2;
localInput.extbits |= (BUTTON(gamefunc_Strafe_Right) || (staticInput.svel < 0))<<3;
// used for changing team
localInput.extbits |= (g_player[playerNum].pteam != g_player[playerNum].ps->team)<<6;
localInput.extbits = (BUTTON(gamefunc_Move_Forward) || (input.fvel > 0));
localInput.extbits |= (BUTTON(gamefunc_Move_Backward) || (input.fvel < 0)) << 1;
localInput.extbits |= (BUTTON(gamefunc_Strafe_Left) || (input.svel > 0)) << 2;
localInput.extbits |= (BUTTON(gamefunc_Strafe_Right) || (input.svel < 0)) << 3;
localInput.extbits |= BUTTON(gamefunc_Turn_Left) << 4;
localInput.extbits |= BUTTON(gamefunc_Turn_Right) << 5;
//localInput.extbits |= BUTTON(gamefunc_Alt_Fire) << 6;
if (ud.scrollmode && ud.overhead_on)
{
ud.folfvel = staticInput.fvel;
ud.folavel = fix16_to_int(staticInput.q16avel);
ud.folfvel = input.fvel;
ud.folavel = fix16_to_int(input.q16avel);
localInput.fvel = 0;
localInput.svel = 0;
localInput.q16avel = 0;
localInput.q16horz = 0;
return;
}
int16_t const q16ang = fix16_to_int(pPlayer->q16ang);
localInput.fvel = mulscale9(staticInput.fvel, sintable[(q16ang + 2560) & 2047]) +
mulscale9(staticInput.svel, sintable[(q16ang + 2048) & 2047]) +
pPlayer->fric.x;
localInput.fvel = mulscale9(input.fvel, sintable[(q16ang + 2560) & 2047]) + mulscale9(input.svel, sintable[(q16ang + 2048) & 2047])
+ (pPlayer->fric.x);
localInput.svel = mulscale9(staticInput.fvel, sintable[(q16ang + 2048) & 2047]) +
mulscale9(staticInput.svel, sintable[(q16ang + 1536) & 2047]) +
pPlayer->fric.y;
localInput.svel = mulscale9(input.fvel, sintable[(q16ang + 2048) & 2047]) + mulscale9(input.svel, sintable[(q16ang + 1536) & 2047])
+ (pPlayer->fric.y);
localInput.q16avel = staticInput.q16avel;
localInput.q16horz = staticInput.q16horz;
localInput.q16avel = input.q16avel;
localInput.q16horz = input.q16horz;
}
void P_GetInputMotorcycle(int playerNum)
@ -3111,8 +3114,8 @@ void P_GetInputMotorcycle(int playerNum)
else info[0].dyaw = tabledivide32_noinline(info[0].dyaw, ud.config.MouseBias);
}
int const elapsedTics = totalclock-lastControlInput;
lastControlInput = totalclock;
int const elapsedTics = (int32_t)totalclock - lastControlInput;
lastControlInput = (int32_t)totalclock;
staticInput.svel = staticInput.fvel = staticInput.q16avel = staticInput.q16horz = 0;
@ -3414,8 +3417,8 @@ void P_GetInputBoat(int playerNum)
else info[0].dyaw = tabledivide32_noinline(info[0].dyaw, ud.config.MouseBias);
}
int const elapsedTics = totalclock-lastControlInput;
lastControlInput = totalclock;
int const elapsedTics = (int32_t)totalclock - lastControlInput;
lastControlInput = (int32_t)totalclock;
staticInput.svel = staticInput.fvel = staticInput.q16avel = staticInput.q16horz = 0;
@ -4020,7 +4023,7 @@ static int32_t P_DoCounters(int playerNum)
}
A_PlaySound(soundId, pPlayer->i);
}
else if (totalclock > 1024)
else if ((int32_t)totalclock > 1024)
if (playerNum == screenpeek || GTFLAGS(GAMETYPE_COOPSOUND))
{
if (rand()&1)
@ -4940,7 +4943,7 @@ static void P_ProcessWeapon(int playerNum)
pPlayer->noise_radius = 8192;
P_MadeNoise(playerNum);
lastvisinc = totalclock+32;
lastvisinc = (int32_t)totalclock+32;
pPlayer->visibility = 0;
flashColor = 255+(95<<8);
if (sectorLotag != 857)
@ -5010,7 +5013,7 @@ static void P_ProcessWeapon(int playerNum)
pPlayer->noise_radius = 8192;
P_MadeNoise(playerNum);
lastvisinc = totalclock + 32;
lastvisinc = (int32_t)totalclock + 32;
pPlayer->visibility = 0;
flashColor = 255+(95<<8);
}
@ -5118,7 +5121,7 @@ static void P_ProcessWeapon(int playerNum)
A_Shoot(pPlayer->i, CHAINGUN);
pPlayer->noise_radius = 8192;
P_MadeNoise(playerNum);
lastvisinc = totalclock + 32;
lastvisinc = (int32_t)totalclock + 32;
pPlayer->visibility = 0;
flashColor = 255+(95<<8);
if (sectorLotag != 857)
@ -5188,7 +5191,7 @@ static void P_ProcessWeapon(int playerNum)
{
pPlayer->visibility = 0;
flashColor = 255 + (95 << 8);
lastvisinc = totalclock + 32;
lastvisinc = (int32_t)totalclock + 32;
A_PlaySound(CHAINGUN_FIRE, pPlayer->i);
A_Shoot(pPlayer->i, SHOTSPARK1);
pPlayer->noise_radius = 16384;
@ -5217,7 +5220,7 @@ static void P_ProcessWeapon(int playerNum)
{
pPlayer->visibility = 0;
flashColor = 255 + (95 << 8);
lastvisinc = totalclock + 32;
lastvisinc = (int32_t)totalclock + 32;
A_PlaySound(CHAINGUN_FIRE, pPlayer->i);
A_Shoot(pPlayer->i, CHAINGUN);
pPlayer->noise_radius = 16384;
@ -5278,7 +5281,7 @@ static void P_ProcessWeapon(int playerNum)
pPlayer->ammo_amount[FREEZE_WEAPON]--;
pPlayer->visibility = 0;
flashColor = 72 + (88 << 8) + (140 << 16);
lastvisinc = totalclock + 32;
lastvisinc = (int32_t)totalclock + 32;
P_CheckWeapon(pPlayer);
}
else if ((*weaponFrame) == 12)
@ -5388,7 +5391,7 @@ static void P_ProcessWeapon(int playerNum)
pPlayer->ammo_amount[RPG_WEAPON]--;
if (pPlayer->ammo_amount[HANDBOMB_WEAPON])
pPlayer->ammo_amount[HANDBOMB_WEAPON]--;
lastvisinc = totalclock + 32;
lastvisinc = (int32_t)totalclock + 32;
pPlayer->visibility = 0;
flashColor = 255+(95<<8);
A_Shoot(pPlayer->i, RPG);
@ -5407,7 +5410,7 @@ static void P_ProcessWeapon(int playerNum)
if (++(*weaponFrame) == 4)
{
pPlayer->ammo_amount[CHICKEN_WEAPON]--;
lastvisinc = totalclock + 32;
lastvisinc = (int32_t)totalclock + 32;
pPlayer->visibility = 0;
flashColor = 255+(95<<8);
A_Shoot(pPlayer->i, RPG2);
@ -5511,7 +5514,7 @@ static void P_ProcessWeapon(int playerNum)
{
A_Shoot(pPlayer->i, SHOTSPARK1);
A_PlaySound(PISTOL_FIRE, pPlayer->i);
lastvisinc = totalclock+32;
lastvisinc = (int32_t)totalclock+32;
pPlayer->visibility = 0;
flashColor = 255+(95<<8);
}
@ -5563,7 +5566,7 @@ static void P_ProcessWeapon(int playerNum)
A_PlaySound(SHOTGUN_FIRE, pPlayer->i);
lastvisinc = totalclock + 32;
lastvisinc = (int32_t)totalclock + 32;
pPlayer->visibility = 0;
flashColor = 255+(95<<8);
}
@ -5613,7 +5616,7 @@ static void P_ProcessWeapon(int playerNum)
A_PlaySound(CHAINGUN_FIRE, pPlayer->i);
A_Shoot(pPlayer->i, CHAINGUN);
lastvisinc = totalclock + 32;
lastvisinc = (int32_t)totalclock + 32;
pPlayer->visibility = 0;
flashColor = 255+(95<<8);
P_CheckWeapon(pPlayer);
@ -5654,7 +5657,7 @@ static void P_ProcessWeapon(int playerNum)
pPlayer->visibility = 0;
flashColor = 216+(52<<8)+(20<<16);
lastvisinc = totalclock + 32;
lastvisinc = (int32_t)totalclock + 32;
P_CheckWeapon(pPlayer);
}
else
@ -5674,7 +5677,7 @@ static void P_ProcessWeapon(int playerNum)
pPlayer->visibility = 0;
flashColor = 176+(252<<8)+(120<<16);
lastvisinc = totalclock + 32;
lastvisinc = (int32_t)totalclock + 32;
P_CheckWeapon(pPlayer);
}
else
@ -5690,7 +5693,7 @@ static void P_ProcessWeapon(int playerNum)
{
pPlayer->visibility = 0;
flashColor = 255+(95<<8);
lastvisinc = totalclock + 32;
lastvisinc = (int32_t)totalclock + 32;
A_Shoot(pPlayer->i, RPG);
pPlayer->ammo_amount[DEVISTATOR_WEAPON]--;
P_CheckWeapon(pPlayer);
@ -5710,7 +5713,7 @@ static void P_ProcessWeapon(int playerNum)
pPlayer->ammo_amount[FREEZE_WEAPON]--;
pPlayer->visibility = 0;
flashColor = 72+(88<<8)+(140<<16);
lastvisinc = totalclock + 32;
lastvisinc = (int32_t)totalclock + 32;
A_Shoot(pPlayer->i, FREEZEBLAST);
P_CheckWeapon(pPlayer);
}
@ -5782,7 +5785,7 @@ static void P_ProcessWeapon(int playerNum)
if (++(*weaponFrame) == 4)
{
pPlayer->ammo_amount[RPG_WEAPON]--;
lastvisinc = totalclock + 32;
lastvisinc = (int32_t)totalclock + 32;
pPlayer->visibility = 0;
flashColor = 255+(95<<8);
A_Shoot(pPlayer->i, RPG);
@ -7805,7 +7808,7 @@ HORIZONLY:;
{
sprite[spriteNum].pal = 0;
pPlayer->drug_mode = 5;
pPlayer->drug_timer = totalclock;
pPlayer->drug_timer = (int32_t)totalclock;
sprite[pPlayer->i].extra = pPlayer->max_player_health;
}
}

View file

@ -595,7 +595,7 @@ void G_CacheMapData(void)
G_CacheSpriteNum(j);
}
tc = totalclock;
tc = (int32_t)totalclock;
j = 0;
int lpc = -1;
@ -674,14 +674,14 @@ void G_CacheMapData(void)
if (totalclock - tc >= 1)
{
tc = totalclock;
tc = (int32_t)totalclock;
lpc++;
}
// OSD_Printf("percentage %d lpc %d\n", percentage, lpc);
}
tc = totalclock;
tc = (int32_t)totalclock;
}
}
@ -2177,7 +2177,7 @@ static inline void clearfrags(void)
void G_ResetTimers(uint8_t keepgtics)
{
totalclock = g_cloudClock = ototalclock = lockclock = 0;
ototalclock = totalclock = g_cloudClock = lockclock = 0;
ready2send = 1;
g_levelTextTime = 85;

View file

@ -419,9 +419,9 @@ static struct {
static void G_SaveTimers(void)
{
g_timers.totalclock = totalclock;
g_timers.totalclocklock = totalclocklock;
g_timers.ototalclock = ototalclock;
g_timers.totalclock = (int32_t)totalclock;
g_timers.totalclocklock = (int32_t)totalclocklock;
g_timers.ototalclock = (int32_t)ototalclock;
g_timers.lockclock = lockclock;
}

View file

@ -711,11 +711,11 @@ void G_DrawStatusBar(int32_t snum)
if (sprite[p->i].pal == 1 && p->last_extra < 2)
G_DrawAltDigiNum(44, -(hudoffset-22), 1, -16, 10+16+256);
else if (!althud_flashing || p->last_extra >(p->max_player_health>>2) || totalclock&32)
else if (!althud_flashing || p->last_extra > (p->max_player_health >> 2) || (int32_t)totalclock & 32)
{
int32_t s = -8;
if (althud_flashing && p->last_extra > p->max_player_health)
s += (sintable[(totalclock<<5)&2047]>>10);
s += (sintable[((int32_t)totalclock << 5) & 2047] >> 10);
G_DrawAltDigiNum(44, -(hudoffset-22), p->last_extra, s, 10+16+256);
}
@ -738,7 +738,7 @@ void G_DrawStatusBar(int32_t snum)
else i = p->curr_weapon;
if (p->curr_weapon != KNEE_WEAPON && p->curr_weapon != SLINGBLADE_WEAPON &&
(!althud_flashing || totalclock&32 || p->ammo_amount[i] > (p->max_ammo_amount[i]/10)))
(!althud_flashing || (int32_t)totalclock&32 || p->ammo_amount[i] > (p->max_ammo_amount[i]/10)))
G_DrawAltDigiNum(-20, -(hudoffset-22), p->ammo_amount[i], -16, 10+16+512);
o = 102;
@ -806,11 +806,11 @@ void G_DrawStatusBar(int32_t snum)
if (sprite[p->i].pal == 1 && p->last_extra < 2)
G_DrawAltDigiNum(40, -(hudoffset-22), 1, -16, 10+16+256);
else if (!althud_flashing || p->last_extra >(p->max_player_health>>2) || totalclock&32)
else if (!althud_flashing || p->last_extra > (p->max_player_health >> 2) || (int32_t)totalclock & 32)
{
int32_t s = -8;
if (althud_flashing && p->last_extra > p->max_player_health)
s += (sintable[(totalclock<<5)&2047]>>10);
s += (sintable[((int32_t)totalclock << 5) & 2047] >> 10);
G_DrawAltDigiNum(40, -(hudoffset-22), p->last_extra, s, 10+16+256);
}
@ -827,7 +827,7 @@ void G_DrawStatusBar(int32_t snum)
else i = p->curr_weapon;
if (p->curr_weapon != KNEE_WEAPON &&
(!althud_flashing || totalclock&32 || p->ammo_amount[i] > (p->max_ammo_amount[i]/10)))
(!althud_flashing || (int32_t)totalclock&32 || p->ammo_amount[i] > (p->max_ammo_amount[i]/10)))
G_DrawAltDigiNum(-20, -(hudoffset-22), p->ammo_amount[i], -16, 10+16+512);
o = 102;

View file

@ -273,12 +273,12 @@ static void G_DrawCameraText(int16_t i)
rotatesprite_win(22<<16, 163<<16, 65536L, 512, CAMCORNER+1, 0, 0, 2+4);
rotatesprite_win((310-10)<<16, 163<<16, 65536L, 512, CAMCORNER+1, 0, 0, 2);
if (totalclock&16)
if ((int32_t)totalclock & 16)
rotatesprite_win(46<<16, 32<<16, 65536L, 0, CAMLIGHT, 0, 0, 2);
}
else
{
int32_t flipbits = (totalclock<<1)&48;
int32_t flipbits = ((int32_t)totalclock << 1) & 48;
for (bssize_t x=-64; x<394; x+=64)
for (bssize_t y=0; y<200; y+=64)
@ -290,10 +290,10 @@ static inline void G_MoveClouds(void)
{
int32_t i;
if (totalclock <= g_cloudClock && totalclock >= (g_cloudClock-7))
if ((int32_t)totalclock <= g_cloudClock && (int32_t)totalclock >= (g_cloudClock - 7))
return;
g_cloudClock = totalclock+6;
g_cloudClock = (int32_t)totalclock + 6;
g_cloudX += sintable[(fix16_to_int(g_player[screenpeek].ps->q16ang)+512)&2047]>>9;
g_cloudY += sintable[fix16_to_int(g_player[screenpeek].ps->q16ang)&2047]>>9;
@ -584,7 +584,7 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16
if (p == screenpeek || GTFLAGS(GAMETYPE_OTHERPLAYERSINMAP))
{
if (pSprite->xvel > 16 && pPlayer->on_ground)
i = APLAYERTOP+((totalclock>>4)&3);
i = APLAYERTOP + (((int32_t)totalclock >> 4) & 3);
else
i = APLAYERTOP;
@ -653,7 +653,7 @@ static void G_PrintCoords(int32_t snum)
y += 7;
Bsprintf(tempbuf, "THOLD= %d", ps->transporter_hold);
printext256(x, y+54, COLOR_WHITE, -1, tempbuf, 0);
Bsprintf(tempbuf, "GAMETIC= %u, TOTALCLOCK=%d", g_moveThingsCount, totalclock);
Bsprintf(tempbuf, "GAMETIC= %u, TOTALCLOCK=%d", g_moveThingsCount, (int32_t)totalclock);
printext256(x, y+63, COLOR_WHITE, -1, tempbuf, 0);
#ifdef DEBUGGINGAIDS
Bsprintf(tempbuf, "NUMSPRITES= %d", Numsprites);
@ -1046,7 +1046,7 @@ void G_DisplayRest(int32_t smoothratio)
if (ud.overhead_on > 0)
{
// smoothratio = min(max(smoothratio,0),65536);
smoothratio = calc_smoothratio(totalclock, ototalclock);
smoothratio = calc_smoothratio((int32_t)totalclock, (int32_t)ototalclock);
G_DoInterpolations(smoothratio);
if (ud.scrollmode == 0)
@ -1340,8 +1340,8 @@ void G_FadePalette(int32_t r, int32_t g, int32_t b, int32_t e)
videoFadePalette(r, g, b, e);
videoNextPage();
int32_t tc = totalclock;
while (totalclock < tc + 4)
int32_t tc = (int32_t)totalclock;
while ((int32_t)totalclock < tc + 4)
G_HandleAsync();
}
@ -1649,7 +1649,7 @@ void G_DisplayLogo(void)
soundanm++;
S_PlaySound(PIPEBOMB_EXPLODE);
}
rotatesprite_fs(160<<16, 104<<16, (totalclock-120)<<10, 0, DUKENUKEM, 0, 0, 2+8);
rotatesprite_fs(160 << 16, 104 << 16, ((int32_t)totalclock - 120) << 10, 0, DUKENUKEM, 0, 0, 2 + 8);
}
else if (totalclock >= (120+60))
rotatesprite_fs(160<<16, (104)<<16, 60<<10, 0, DUKENUKEM, 0, 0, 2+8);
@ -1663,7 +1663,7 @@ void G_DisplayLogo(void)
}
rotatesprite_fs(160<<16, (104)<<16, 60<<10, 0, DUKENUKEM, 0, 0, 2+8);
rotatesprite_fs(160<<16, (129)<<16, (totalclock - 220)<<11, 0, THREEDEE, 0, 0, 2+8);
rotatesprite_fs(160 << 16, (129) << 16, ((int32_t)totalclock - 220) << 11, 0, THREEDEE, 0, 0, 2 + 8);
}
else if (totalclock >= (220+30))
rotatesprite_fs(160<<16, (129)<<16, 30<<11, 0, THREEDEE, 0, 0, 2+8);
@ -1673,7 +1673,7 @@ void G_DisplayLogo(void)
// JBF 20030804
if (totalclock >= 280 && totalclock < 395)
{
rotatesprite_fs(160<<16, (151)<<16, (410-totalclock)<<12, 0, PLUTOPAKSPRITE+1, (sintable[(totalclock<<4)&2047]>>11), 0, 2+8);
rotatesprite_fs(160<<16, (151)<<16, (410-(int32_t)totalclock)<<12, 0, PLUTOPAKSPRITE+1, (sintable[((int32_t)totalclock<<4)&2047]>>11), 0, 2+8);
if (soundanm == 2)
{
soundanm++;
@ -1687,7 +1687,7 @@ void G_DisplayLogo(void)
soundanm++;
S_PlaySound(PIPEBOMB_EXPLODE);
}
rotatesprite_fs(160<<16, (151)<<16, 30<<11, 0, PLUTOPAKSPRITE+1, (sintable[(totalclock<<4)&2047]>>11), 0, 2+8);
rotatesprite_fs(160<<16, (151)<<16, 30<<11, 0, PLUTOPAKSPRITE+1, (sintable[((int32_t)totalclock<<4)&2047]>>11), 0, 2+8);
}
}
@ -2354,7 +2354,7 @@ void G_BonusScreen(int32_t bonusonly)
if (totalclock >= 1000000000 && totalclock < 1000000320)
{
switch ((totalclock>>4)%15)
switch (((int32_t)totalclock >> 4) % 15)
{
case 0:
if (bonuscnt == 6)
@ -2391,10 +2391,10 @@ void G_BonusScreen(int32_t bonusonly)
break;
}
}
else if (totalclock > (10240+120L)) break;
else if ((int32_t)totalclock > (10240+120L)) break;
else
{
switch ((totalclock>>5)&3)
switch (((int32_t)totalclock >> 5) & 3)
{
case 1:
case 3:
@ -2948,7 +2948,7 @@ void G_BonusScreenRRRA(int32_t bonusonly)
if (totalclock >= 1000000000 && totalclock < 1000000320)
{
switch ((totalclock>>4)%15)
switch (((uint32_t)totalclock>>4)%15)
{
case 0:
if (bonuscnt == 6)
@ -2981,10 +2981,10 @@ void G_BonusScreenRRRA(int32_t bonusonly)
break;
}
}
else if (totalclock > (10240+120L)) break;
else if ((int32_t)totalclock > (10240+120L)) break;
else
{
switch ((totalclock>>5)&3)
switch (((int32_t)totalclock >> 5) & 3)
{
case 1:
case 3:
@ -3177,7 +3177,7 @@ void G_BonusScreenRRRA(int32_t bonusonly)
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1);
while (1)
{
switch ((totalclock >> 4) & 1)
switch (((int32_t)totalclock >> 4) & 1)
{
case 0:
rotatesprite(0,0,65536,0,RRTILE8677,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1);

View file

@ -552,7 +552,7 @@ void G_AnimateCamSprite(int smoothRatio)
#endif
}
T1(spriteNum) = totalclock;
T1(spriteNum) = (int32_t)totalclock;
}
}