- weapon draw code tested and old version removed.

# Conflicts:
#	source/games/duke/src/zz_player.cpp
This commit is contained in:
Christoph Oelckers 2020-05-20 10:38:56 +02:00
parent e827e7a59b
commit 603afdde87
11 changed files with 825 additions and 2470 deletions

View file

@ -196,7 +196,7 @@ void addweapon_r(struct player_struct* p, int weapon)
case KNEE_WEAPON:
case DYNAMITE_WEAPON:
case TRIPBOMB_WEAPON:
case HANDREMOTE_WEAPON:
case THROWINGDYNAMITE_WEAPON:
break;
case SHOTGUN_WEAPON:
spritesound(SHOTGUN_COCK, p->i);

View file

@ -107,6 +107,8 @@ void processinput_d(int snum);
void processinput_r(int snum);
void displayweapon_d(int snum);
void displayweapon_r(int snum);
void displaymasks_d(int snum);
void displaymasks_r(int snum);
@ -157,6 +159,7 @@ void SetDispatcher()
checkweapons_d,
processinput_d,
displayweapon_d,
displaymasks_d,
};
}
else
@ -202,6 +205,7 @@ void SetDispatcher()
checkweapons_r,
processinput_r,
displayweapon_r,
displaymasks_r,
};
}
}

View file

@ -533,6 +533,7 @@ struct Dispatcher
void (*checkweapons)(struct player_struct* p);
void (*processinput)(int snum);
void (*displayweapon)(int snum);
void (*displaymasks)(int snum);
};

View file

@ -198,7 +198,7 @@ int animateknuckles(int gs, int snum)
//
//---------------------------------------------------------------------------
void displaymasks(int snum)
void displaymasks_d(int snum)
{
int p;
@ -211,12 +211,12 @@ void displaymasks(int snum)
{
if (ud.screen_size > 4)
{
rotatesprite(43 << 16, (200 - 8 - tilesiz[SCUBAMASK].y) << 16, 65536, 0, SCUBAMASK, 0, p, 2 + 16, CRECT);
rotatesprite(44 << 16, (200 - 8 - tilesiz[SCUBAMASK].y) << 16, 65536, 0, SCUBAMASK, 0, p, 2 + 16, CRECT);
rotatesprite((320 - 43) << 16, (200 - 8 - tilesiz[SCUBAMASK].y) << 16, 65536, 1024, SCUBAMASK, 0, p, 2 + 4 + 16, CRECT);
}
else
{
rotatesprite(43 << 16, (200 - tilesiz[SCUBAMASK].y) << 16, 65536, 0, SCUBAMASK, 0, p, 2 + 16, CRECT);
rotatesprite(44 << 16, (200 - tilesiz[SCUBAMASK].y) << 16, 65536, 0, SCUBAMASK, 0, p, 2 + 16, CRECT);
rotatesprite((320 - 43) << 16, (200 - tilesiz[SCUBAMASK].y) << 16, 65536, 1024, SCUBAMASK, 0, p, 2 + 4 + 16, CRECT);
}
}
@ -294,7 +294,7 @@ int animateaccess(int gs,int snum)
void displayweapon_d(int snum)
{
int gun_pos, looking_arc, cw;
int weapon_xoffset, i, j, x1, y1, x2;
int weapon_xoffset, i, j;
int o,pal;
signed char gs;
struct player_struct *p;
@ -851,44 +851,46 @@ void displayweapon_d(int snum)
}
else
{
pin = (isWW2GI() || (duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) ? 0 : RS_ALIGN_R;
const int WEAPON2_RELOAD_TIME = 50;
auto reload_time = isWW2GI() ? aplWeaponReload[PISTOL_WEAPON][snum] : WEAPON2_RELOAD_TIME;
if (p->kickback_pic < 10)
hud_drawpal(194 - (p->look_ang >> 1), looking_arc + 230 - gun_pos, FIRSTGUN + 4, gs, o, pal);
hud_drawpal(194 - (p->look_ang >> 1), looking_arc + 230 - gun_pos, FIRSTGUN + 4, gs, o|pin, pal);
else if (p->kickback_pic < 15)
{
hud_drawpal(244 - (p->kickback_pic << 3) - (p->look_ang >> 1), looking_arc + 130 - gun_pos + (p->kickback_pic << 4), FIRSTGUN + 6, gs, o, pal);
hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 220 - gun_pos, FIRSTGUN + 5, gs, o, pal);
hud_drawpal(244 - (p->kickback_pic << 3) - (p->look_ang >> 1), looking_arc + 130 - gun_pos + (p->kickback_pic << 4), FIRSTGUN + 6, gs, o | pin, pal);
hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 220 - gun_pos, FIRSTGUN + 5, gs, o | pin, pal);
}
else if (p->kickback_pic < 20)
{
hud_drawpal(124 + (p->kickback_pic << 1) - (p->look_ang >> 1), looking_arc + 430 - gun_pos - (p->kickback_pic << 3), FIRSTGUN + 6, gs, o, pal);
hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 220 - gun_pos, FIRSTGUN + 5, gs, o, pal);
hud_drawpal(124 + (p->kickback_pic << 1) - (p->look_ang >> 1), looking_arc + 430 - gun_pos - (p->kickback_pic << 3), FIRSTGUN + 6, gs, o | pin, pal);
hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 220 - gun_pos, FIRSTGUN + 5, gs, o | pin, pal);
}
else if (p->kickback_pic < (reload_time - 12))
{
hud_drawpal(184 - (p->look_ang >> 1), looking_arc + 235 - gun_pos, FIRSTGUN + 8, gs, o, pal);
hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 210 - gun_pos, FIRSTGUN + 5, gs, o, pal);
hud_drawpal(184 - (p->look_ang >> 1), looking_arc + 235 - gun_pos, FIRSTGUN + 8, gs, o | pin, pal);
hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 210 - gun_pos, FIRSTGUN + 5, gs, o | pin, pal);
}
else if (p->kickback_pic < (reload_time - 6))
{
hud_drawpal(164 - (p->look_ang >> 1), looking_arc + 245 - gun_pos, FIRSTGUN + 8, gs, o, pal);
hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 220 - gun_pos, FIRSTGUN + 5, gs, o, pal);
hud_drawpal(164 - (p->look_ang >> 1), looking_arc + 245 - gun_pos, FIRSTGUN + 8, gs, o | pin, pal);
hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 220 - gun_pos, FIRSTGUN + 5, gs, o | pin, pal);
}
else if (p->kickback_pic < (reload_time))
hud_drawpal(194 - (p->look_ang >> 1), looking_arc + 235 - gun_pos, FIRSTGUN + 5, gs, o, pal);
else if (p->kickback_pic < 23)
{
hud_drawpal(184 - (p->look_ang >> 1), looking_arc + 235 - gun_pos, FIRSTGUN + 8, gs, o, pal);
hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 210 - gun_pos, FIRSTGUN + 5, gs, o, pal);
hud_drawpal(184 - (p->look_ang >> 1), looking_arc + 235 - gun_pos, FIRSTGUN + 8, gs, o | pin, pal);
hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 210 - gun_pos, FIRSTGUN + 5, gs, o | pin, pal);
}
else if (p->kickback_pic < 25)
{
hud_drawpal(164 - (p->look_ang >> 1), looking_arc + 245 - gun_pos, FIRSTGUN + 8, gs, o, pal);
hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 220 - gun_pos, FIRSTGUN + 5, gs, o, pal);
hud_drawpal(164 - (p->look_ang >> 1), looking_arc + 245 - gun_pos, FIRSTGUN + 8, gs, o | pin, pal);
hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 220 - gun_pos, FIRSTGUN + 5, gs, o | pin, pal);
}
else if (p->kickback_pic < 27)
hud_drawpal(194 - (p->look_ang >> 1), looking_arc + 235 - gun_pos, FIRSTGUN + 5, gs, o, pal);
hud_drawpal(194 - (p->look_ang >> 1), looking_arc + 235 - gun_pos, FIRSTGUN + 5, gs, o | pin, pal);
}
};

View file

@ -80,7 +80,7 @@ inline static void hud_draw(int x, int y, int tilenum, int shade, int orientatio
//
//---------------------------------------------------------------------------
void displaymasks(short snum)
void displaymasks_r(int snum)
{
short p;
@ -91,22 +91,13 @@ void displaymasks(short snum)
if (ps[snum].scuba_on)
{
if (ud.screen_size > 4)
{
hud_rotatesprite((320 - (tilesiz[SCUBAMASK].x >> 1) - 15) << 16, (200 - (tilesiz[SCUBAMASK].y >> 1) + (sintable[(int)totalclock & 2047] >> 10)) << 16, 49152, 0, SCUBAMASK, 0, p, 2 + 16, CRECT);
hud_rotatesprite((320 - tilesiz[SCUBAMASK + 4].x) << 16, (200 - tilesiz[SCUBAMASK + 4].y) << 16, 65536, 0, SCUBAMASK + 4, 0, p, 2 + 16, CRECT);
hud_rotatesprite(tilesiz[SCUBAMASK + 4].x << 16, (200 - tilesiz[SCUBAMASK + 4].y) << 16, 65536, 1024, SCUBAMASK + 4, 0, p, 2 + 4 + 16, CRECT);
hud_rotatesprite(35 << 16, (-1) << 16, 65536, 0, SCUBAMASK + 3, 0, p, 2 + 16, CRECT);
hud_rotatesprite(285 << 16, 200 << 16, 65536, 1024, SCUBAMASK + 3, 0, p, 2 + 16, CRECT);
}
else
{
hud_rotatesprite((320 - (tilesiz[SCUBAMASK].x >> 1) - 15) << 16, (200 - (tilesiz[SCUBAMASK].y >> 1) + (sintable[(int)totalclock & 2047] >> 10)) << 16, 49152, 0, SCUBAMASK, 0, p, 2 + 16, CRECT);
hud_rotatesprite((320 - tilesiz[SCUBAMASK + 4].x) << 16, (200 - tilesiz[SCUBAMASK + 4].y) << 16, 65536, 0, SCUBAMASK + 4, 0, p, 2 + 16, CRECT);
hud_rotatesprite(tilesiz[SCUBAMASK + 4].x << 16, (200 - tilesiz[SCUBAMASK + 4].y) << 16, 65536, 1024, SCUBAMASK + 4, 0, p, 2 + 4 + 16, CRECT);
hud_rotatesprite(35 << 16, (-1) << 16, 65536, 0, SCUBAMASK + 3, 0, p, 2 + 16, CRECT);
hud_rotatesprite(285 << 16, 200 << 16, 65536, 1024, SCUBAMASK + 3, 0, p, 2 + 16, CRECT);
}
int pin = 0;
if (!(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) pin = RS_STRETCH;
hud_rotatesprite((320 - (tilesiz[SCUBAMASK].x >> 1) - 15) << 16, (200 - (tilesiz[SCUBAMASK].y >> 1) + (sintable[(int)totalclock & 2047] >> 10)) << 16, 49152, 0, SCUBAMASK, 0, p, 2 + 16 + pin, CRECT);
hud_rotatesprite((320 - tilesiz[SCUBAMASK + 4].x) << 16, (200 - tilesiz[SCUBAMASK + 4].y) << 16, 65536, 0, SCUBAMASK + 4, 0, p, 2 + 16 + pin, CRECT);
hud_rotatesprite(tilesiz[SCUBAMASK + 4].x << 16, (200 - tilesiz[SCUBAMASK + 4].y) << 16, 65536, 1024, SCUBAMASK + 4, 0, p, 2 + 4 + 16 + pin, CRECT);
hud_rotatesprite(35 << 16, (-1) << 16, 65536, 0, SCUBAMASK + 3, 0, p, 2 + 16 + pin, CRECT);
hud_rotatesprite(285 << 16, 200 << 16, 65536, 1024, SCUBAMASK + 3, 0, p, 2 + 16 + pin, CRECT);
}
}
@ -134,7 +125,7 @@ void ShowBoat(int x, int y, short tilenum, signed char shade, char orientation,
//
//---------------------------------------------------------------------------
void displayweapon(int snum)
void displayweapon_r(int snum)
{
int gun_pos, looking_arc, cw;
int weapon_xoffset, i, j;
@ -337,141 +328,152 @@ void displayweapon(int snum)
looking_arc+200+(abs(sintable[(fistsign)&2047]>>8)),
FIST,gs,o|4);
}
else switch(cw)
else
{
case KNEE_WEAPON:
case SLINGBLADE_WEAPON:
if(sprite[p->i].pal == 1)
int pin = 0;
if (sprite[p->i].pal == 1)
pal = 1;
else
pal = sector[p->cursectnum].floorpal;
if (cw == KNEE_WEAPON)
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
auto displaycrowbar = [&]
{
static const short kb_frames[] = { 0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7 };
static const short kb_ox[] = { 310,342,364,418,350,316,282,288,0,0 };
static const short kb_oy[] = { 300,362,320,268,248,248,277,420,0,0 };
short x;
short y;
x = weapon_xoffset + ((kb_ox[kb_frames[*kb]]>>1) - 12);
y = 200 - (244-kb_oy[kb_frames[*kb]]);
hud_drawpal(x-(p->look_ang>>1),looking_arc+y-gun_pos,
KNEE+kb_frames[*kb],gs,0,pal);
}
else
x = weapon_xoffset + ((kb_ox[kb_frames[*kb]] >> 1) - 12);
y = 200 - (244 - kb_oy[kb_frames[*kb]]);
hud_drawpal(x - (p->look_ang >> 1), looking_arc + y - gun_pos,
KNEE + kb_frames[*kb], gs, 0, pal);
};
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
auto displayslingblade = [&]
{
static const short kb_frames[] = { 0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7 };
static const short kb_ox[] = { 580,676,310,491,356,210,310,614 };
static const short kb_oy[] = { 369,363,300,323,371,400,300,440 };
short x, y;
x = weapon_xoffset + ((kb_ox[kb_frames[*kb]]>>1) - 12);
y = 210 - (244-kb_oy[kb_frames[*kb]]);
hud_drawpal(x-(p->look_ang>>1)+20,looking_arc+y-gun_pos-80,
SLINGBLADE+kb_frames[*kb],gs,0,pal);
}
break;
x = weapon_xoffset + ((kb_ox[kb_frames[*kb]] >> 1) - 12);
y = 210 - (244 - kb_oy[kb_frames[*kb]]);
hud_drawpal(x - (p->look_ang >> 1) + 20, looking_arc + y - gun_pos - 80,
SLINGBLADE + kb_frames[*kb], gs, 0, pal);
};
case POWDERKEG_WEAPON:
case BOWLING_WEAPON:
if(sprite[p->i].pal == 1)
pal = 1;
else
pal = sector[p->cursectnum].floorpal;
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
auto displaybowlingball = [&]
{
weapon_xoffset += 8;
gun_pos -= 10;
if (cw == BOWLING_WEAPON)
{
if (p->ammo_amount[BOWLING_WEAPON])
{
hud_drawpal(weapon_xoffset+162-(p->look_ang>>1),
looking_arc+214-gun_pos+(*kb<<3),BOWLINGBALLH,gs,o,pal);
hud_drawpal(weapon_xoffset + 162 - (p->look_ang >> 1),
looking_arc + 214 - gun_pos + (*kb << 3), BOWLINGBALLH, gs, o, pal);
}
else
{
rdmyospal(weapon_xoffset+162-(p->look_ang>>1),
looking_arc+214-gun_pos,HANDTHROW+5,gs,o,pal);
rdmyospal(weapon_xoffset + 162 - (p->look_ang >> 1),
looking_arc + 214 - gun_pos, HANDTHROW + 5, gs, o, pal);
}
}
else
};
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
auto displaypowderkeg = [&]
{
weapon_xoffset += 8;
gun_pos -= 10;
if (p->ammo_amount[POWDERKEG_WEAPON])
{
rdmyospal(weapon_xoffset+180-(p->look_ang>>1),
looking_arc+214-gun_pos+(*kb<<3),POWDERH,gs,o,pal);
rdmyospal(weapon_xoffset+90-(p->look_ang>>1),
looking_arc+214-gun_pos+(*kb<<3),POWDERH,gs,o|4,pal);
rdmyospal(weapon_xoffset + 180 - (p->look_ang >> 1),
looking_arc + 214 - gun_pos + (*kb << 3), POWDERH, gs, o, pal);
rdmyospal(weapon_xoffset + 90 - (p->look_ang >> 1),
looking_arc + 214 - gun_pos + (*kb << 3), POWDERH, gs, o | 4, pal);
}
else
{
rdmyospal(weapon_xoffset+162-(p->look_ang>>1),
looking_arc+214-gun_pos,HANDTHROW+5,gs,o,pal);
rdmyospal(weapon_xoffset + 162 - (p->look_ang >> 1),
looking_arc + 214 - gun_pos, HANDTHROW + 5, gs, o, pal);
}
}
break;
};
case CROSSBOW_WEAPON:
case CHICKEN_WEAPON:
if(sprite[p->i].pal == 1)
pal = 1;
else pal = sector[p->cursectnum].floorpal;
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
if (cw == CROSSBOW_WEAPON)
auto displaycrossbow = [&]
{
if (*kb)
{
static const char kb_frames[] = { 0,1,1,2,2,3,2,3,2,3,2,2,2,2,2,2,2,2,2,4,4,4,4,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,7 };
if (kb_frames[*kb] == 2)
if (!(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) pin = RS_ALIGN_R;
static const uint8_t kb_frames[] = { 0,1,1,2,2,3,2,3,2,3,2,2,2,2,2,2,2,2,2,4,4,4,4,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,7 };
if (kb_frames[*kb] == 2 || kb_frames[*kb] == 3)
{
rdmyospal((weapon_xoffset + 200) - (p->look_ang >> 1),
looking_arc + 250 - gun_pos, RPGGUN + kb_frames[*kb], gs, o, pal);
}
else if (kb_frames[*kb] == 3)
{
rdmyospal((weapon_xoffset + 200) - (p->look_ang >> 1),
looking_arc + 250 - gun_pos, RPGGUN + kb_frames[*kb], gs, o, pal);
looking_arc + 250 - gun_pos, RPGGUN + kb_frames[*kb], gs, o | pin, pal);
}
else if (kb_frames[*kb] == 1)
{
rdmyospal((weapon_xoffset + 200) - (p->look_ang >> 1),
looking_arc + 250 - gun_pos, RPGGUN + kb_frames[*kb], 0, o, pal);
looking_arc + 250 - gun_pos, RPGGUN + kb_frames[*kb], 0, o | pin, pal);
}
else
{
rdmyospal((weapon_xoffset + 210) - (p->look_ang >> 1),
looking_arc + 255 - gun_pos, RPGGUN + kb_frames[*kb], gs, o, pal);
looking_arc + 255 - gun_pos, RPGGUN + kb_frames[*kb], gs, o | pin, pal);
}
}
else
{
rdmyospal((weapon_xoffset + 210) - (p->look_ang >> 1),
looking_arc + 255 - gun_pos, RPGGUN, gs, o, pal);
}
}
else
};
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
auto displaychicken = [&]
{
if (!(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) pin = RS_ALIGN_R;
if (*kb)
{
char kb_frames[] = { 0,1,1,2,2,3,2,3,2,3,2,2,2,2,2,2,2,2,2,4,4,4,4,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,7 };
if (kb_frames[*kb] == 2)
static const uint8_t kb_frames[] = { 0,1,1,2,2,3,2,3,2,3,2,2,2,2,2,2,2,2,2,4,4,4,4,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,7 };
if (kb_frames[*kb] == 2 || kb_frames[*kb] == 3)
{
rdmyospal((weapon_xoffset + 200) - (p->look_ang >> 1),
looking_arc + 250 - gun_pos, RPGGUN2 + kb_frames[*kb], gs, o, pal);
}
else if (kb_frames[*kb] == 3)
{
rdmyospal((weapon_xoffset + 200) - (p->look_ang >> 1),
looking_arc + 250 - gun_pos, RPGGUN2 + kb_frames[*kb], gs, o, pal);
looking_arc + 250 - gun_pos, RPGGUN2 + kb_frames[*kb], gs, o | pin, pal);
}
else if (kb_frames[*kb] == 1)
{
rdmyospal((weapon_xoffset + 200) - (p->look_ang >> 1),
looking_arc + 250 - gun_pos, RPGGUN2 + kb_frames[*kb], 0, o, pal);
looking_arc + 250 - gun_pos, RPGGUN2 + kb_frames[*kb], 0, o | pin, pal);
}
else
{
rdmyospal((weapon_xoffset + 210) - (p->look_ang >> 1),
looking_arc + 255 - gun_pos, RPGGUN2 + kb_frames[*kb], gs, o, pal);
looking_arc + 255 - gun_pos, RPGGUN2 + kb_frames[*kb], gs, o | pin, pal);
}
}
else
@ -481,39 +483,40 @@ void displayweapon(int snum)
if (chickenphase)
{
rdmyospal((weapon_xoffset + 210) - (p->look_ang >> 1),
looking_arc + 222 - gun_pos, RPGGUN2 + 7, gs, o, pal);
looking_arc + 222 - gun_pos, RPGGUN2 + 7, gs, o | pin, pal);
}
else if ((krand() & 15) == 5)
{
spritesound(327, p->i);
rdmyospal((weapon_xoffset + 210) - (p->look_ang >> 1),
looking_arc + 222 - gun_pos, RPGGUN2 + 7, gs, o, pal);
looking_arc + 222 - gun_pos, RPGGUN2 + 7, gs, o | pin, pal);
chickenphase = 6;
}
else
{
rdmyospal((weapon_xoffset + 210) - (p->look_ang >> 1),
looking_arc + 225 - gun_pos, RPGGUN2, gs, o, pal);
looking_arc + 225 - gun_pos, RPGGUN2, gs, o | pin, pal);
}
}
else
{
rdmyospal((weapon_xoffset + 210) - (p->look_ang >> 1),
looking_arc + 225 - gun_pos, RPGGUN2, gs, o, pal);
looking_arc + 225 - gun_pos, RPGGUN2, gs, o | pin, pal);
}
}
}
break;
};
case SHOTGUN_WEAPON:
if(sprite[p->i].pal == 1)
pal = 1;
else
pal = sector[p->cursectnum].floorpal;
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
auto displayshotgun = [&]
{
weapon_xoffset -= 8;
if(sprite[p->i].pal == 1)
if (sprite[p->i].pal == 1)
pal = 1;
else
pal = sector[p->cursectnum].floorpal;
@ -534,22 +537,22 @@ void displayweapon(int snum)
{
if (kb_frames[*kb] == 3 || kb_frames[*kb] == 4)
gs = 0;
x = weapon_xoffset+((kb_ox[kb_frames[*kb]]>>1)-12);
y = tm-(244-kb_oy[kb_frames[*kb]]);
hud_drawpal(x+64-(p->look_ang>>1),
y+looking_arc-gun_pos,SHOTGUN+kb_frames[*kb],gs,0,pal);
x = weapon_xoffset + ((kb_ox[kb_frames[*kb]] >> 1) - 12);
y = tm - (244 - kb_oy[kb_frames[*kb]]);
hud_drawpal(x + 64 - (p->look_ang >> 1),
y + looking_arc - gun_pos, SHOTGUN + kb_frames[*kb], gs, 0, pal);
}
else
{
if (kb_frames[*kb] > 0)
{
x = weapon_xoffset+((kb_ox[kb_frames[(*kb)-11]]>>1)-12);
y = tm-(244-kb_oy[kb_frames[(*kb)-11]]);
x = weapon_xoffset + ((kb_ox[kb_frames[(*kb) - 11]] >> 1) - 12);
y = tm - (244 - kb_oy[kb_frames[(*kb) - 11]]);
}
else
{
x = weapon_xoffset+((kb_ox[kb_frames[*kb]]>>1)-12);
y = tm-(244-kb_oy[kb_frames[*kb]]);
x = weapon_xoffset + ((kb_ox[kb_frames[*kb]] >> 1) - 12);
y = tm - (244 - kb_oy[kb_frames[*kb]]);
}
switch (*kb)
{
@ -560,9 +563,9 @@ void displayweapon(int snum)
y += 30;
break;
}
hud_drawpal(x+64-(p->look_ang>>1),y+looking_arc-gun_pos,SHOTGUN+kb_frames[*kb],gs,0,pal);
if(kb_frames[*kb] == 21)
hud_drawpal(x+96-(p->look_ang>>1),y+looking_arc-gun_pos,SHOTGUNSHELLS,gs,0,pal);
hud_drawpal(x + 64 - (p->look_ang >> 1), y + looking_arc - gun_pos, SHOTGUN + kb_frames[*kb], gs, 0, pal);
if (kb_frames[*kb] == 21)
hud_drawpal(x + 96 - (p->look_ang >> 1), y + looking_arc - gun_pos, SHOTGUNSHELLS, gs, 0, pal);
}
}
else
@ -573,32 +576,32 @@ void displayweapon(int snum)
{
if (kb_frames2[*kb] == 3 || kb_frames2[*kb] == 4)
gs = 0;
x = weapon_xoffset+((kb_ox[kb_frames2[*kb]]>>1)-12);
y = tm-(244-kb_oy[kb_frames2[*kb]]);
hud_drawpal(x+64-(p->look_ang>>1),
y+looking_arc-gun_pos,SHOTGUN+kb_frames2[*kb],gs,0,pal);
x = weapon_xoffset + ((kb_ox[kb_frames2[*kb]] >> 1) - 12);
y = tm - (244 - kb_oy[kb_frames2[*kb]]);
hud_drawpal(x + 64 - (p->look_ang >> 1),
y + looking_arc - gun_pos, SHOTGUN + kb_frames2[*kb], gs, 0, pal);
}
else
{
if (kb_frames3[*kb] == 1 || kb_frames3[*kb] == 2)
gs = 0;
x = weapon_xoffset+((kb_ox[kb_frames3[*kb]]>>1)-12);
y = tm-(244-kb_oy[kb_frames3[*kb]]);
hud_drawpal(x+64-(p->look_ang>>1),
y+looking_arc-gun_pos,SHOTGUN+kb_frames3[*kb],gs,0,pal);
x = weapon_xoffset + ((kb_ox[kb_frames3[*kb]] >> 1) - 12);
y = tm - (244 - kb_oy[kb_frames3[*kb]]);
hud_drawpal(x + 64 - (p->look_ang >> 1),
y + looking_arc - gun_pos, SHOTGUN + kb_frames3[*kb], gs, 0, pal);
}
}
else if (p->shotgun_state[0])
{
if (kb_frames2[*kb] > 0)
{
x = weapon_xoffset+((kb_ox[kb_frames2[(*kb)-11]]>>1)-12);
y = tm-(244-kb_oy[kb_frames2[(*kb)-11]]);
x = weapon_xoffset + ((kb_ox[kb_frames2[(*kb) - 11]] >> 1) - 12);
y = tm - (244 - kb_oy[kb_frames2[(*kb) - 11]]);
}
else
{
x = weapon_xoffset+((kb_ox[kb_frames2[*kb]]>>1)-12);
y = tm-(244-kb_oy[kb_frames2[*kb]]);
x = weapon_xoffset + ((kb_ox[kb_frames2[*kb]] >> 1) - 12);
y = tm - (244 - kb_oy[kb_frames2[*kb]]);
}
switch (*kb)
{
@ -609,53 +612,56 @@ void displayweapon(int snum)
y += 30;
break;
}
hud_drawpal(x+64-(p->look_ang>>1),y+looking_arc-gun_pos,SHOTGUN+kb_frames2[*kb],gs,0,pal);
if(kb_frames2[*kb] == 21)
hud_drawpal(x+96-(p->look_ang>>1),y+looking_arc-gun_pos,SHOTGUNSHELLS,gs,0,pal);
hud_drawpal(x + 64 - (p->look_ang >> 1), y + looking_arc - gun_pos, SHOTGUN + kb_frames2[*kb], gs, 0, pal);
if (kb_frames2[*kb] == 21)
hud_drawpal(x + 96 - (p->look_ang >> 1), y + looking_arc - gun_pos, SHOTGUNSHELLS, gs, 0, pal);
}
}
}
break;
};
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
auto displayrifle = [&]
{
if (*kb > 0)
gun_pos -= sintable[(*kb) << 7] >> 12;
case CHAINGUN_WEAPON:
if(sprite[p->i].pal == 1)
pal = 1;
else
pal = sector[p->cursectnum].floorpal;
if (*kb > 0 && sprite[p->i].pal != 1) weapon_xoffset += 1 - (rand() & 3);
if(*kb > 0)
gun_pos -= sintable[(*kb)<<7]>>12;
if(*kb > 0 && sprite[p->i].pal != 1) weapon_xoffset += 1-(rand()&3);
switch(*kb)
switch (*kb)
{
case 0:
hud_drawpal(weapon_xoffset+178-(p->look_ang>>1)+30,looking_arc+233-gun_pos+5,
CHAINGUN,gs,o,pal);
hud_drawpal(weapon_xoffset + 178 - (p->look_ang >> 1) + 30, looking_arc + 233 - gun_pos + 5,
CHAINGUN, gs, o, pal);
break;
default:
gs = 0;
if(*kb < 8)
if (*kb < 8)
{
i = rand()&7;
hud_drawpal(weapon_xoffset+178-(p->look_ang>>1)+30,looking_arc+233-gun_pos+5,
CHAINGUN+1,gs,o,pal);
i = rand() & 7;
hud_drawpal(weapon_xoffset + 178 - (p->look_ang >> 1) + 30, looking_arc + 233 - gun_pos + 5,
CHAINGUN + 1, gs, o, pal);
}
else hud_drawpal(weapon_xoffset+178-(p->look_ang>>1)+30,looking_arc+233-gun_pos+5,
CHAINGUN+2,gs,o,pal);
else hud_drawpal(weapon_xoffset + 178 - (p->look_ang >> 1) + 30, looking_arc + 233 - gun_pos + 5,
CHAINGUN + 2, gs, o, pal);
break;
}
break;
case PISTOL_WEAPON:
if(sprite[p->i].pal == 1)
pal = 1;
else
pal = sector[p->cursectnum].floorpal;
};
if( (*kb) < 22)
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
auto displaypistol = [&]
{
if ((*kb) < 22)
{
static const uint8_t kb_frames[] = { 0,0,1,1,2,2,3,3,4,4,6,6,6,6,5,5,4,4,3,3,0,0 };
static const short kb_ox[] = { 194,190,185,208,215,215,216,216,201,170 };
@ -663,14 +669,14 @@ void displayweapon(int snum)
short x;
short y;
x = weapon_xoffset+(kb_ox[kb_frames[*kb]]-12);
y = 244-(244-kb_oy[kb_frames[*kb]]);
x = weapon_xoffset + (kb_ox[kb_frames[*kb]] - 12);
y = 244 - (244 - kb_oy[kb_frames[*kb]]);
if (kb_frames[*kb])
gs = 0;
rdmyospal(x-(p->look_ang>>1),
y+looking_arc-gun_pos,FIRSTGUN+kb_frames[*kb],gs,0,pal);
rdmyospal(x - (p->look_ang >> 1),
y + looking_arc - gun_pos, FIRSTGUN + kb_frames[*kb], gs, 0, pal);
}
else
{
@ -682,8 +688,8 @@ void displayweapon(int snum)
short y;
short dy;
x = weapon_xoffset+(kb_ox[kb_frames[(*kb)-22]]-12);
y = 244-(244-kb_oy[kb_frames[(*kb)-22]]);
x = weapon_xoffset + (kb_ox[kb_frames[(*kb) - 22]] - 12);
y = 244 - (244 - kb_oy[kb_frames[(*kb) - 22]]);
switch (*kb)
{
case 28:
@ -727,25 +733,31 @@ void displayweapon(int snum)
dx = 0;
break;
}
rdmyospal(x-(p->look_ang>>1)-dx,
y+looking_arc-gun_pos+dy,FIRSTGUNRELOAD+kb_frames[(*kb)-22],gs,0,pal);
rdmyospal(x - (p->look_ang >> 1) - dx,
y + looking_arc - gun_pos + dy, FIRSTGUNRELOAD + kb_frames[(*kb) - 22], gs, 0, pal);
}
};
break;
case DYNAMITE_WEAPON:
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
auto displaydynamite = [&]
{
if(sprite[p->i].pal == 1)
pal = 1;
else
pal = sector[p->cursectnum].floorpal;
gun_pos -= 9 * (*kb);
gun_pos -= 9*(*kb);
rdmyospal(weapon_xoffset + 190 - (p->look_ang >> 1), looking_arc + 260 - gun_pos, HANDTHROW, gs, o, pal);
};
rdmyospal(weapon_xoffset+190-(p->look_ang>>1),looking_arc+260-gun_pos,HANDTHROW,gs,o,pal);
}
break;
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
case HANDREMOTE_WEAPON:
auto displaythrowingdynamite = [&]
{
int dx;
int x;
@ -753,50 +765,160 @@ void displayweapon(int snum)
dx = 25;
x = 100;
dy = 20;
if((*kb) < 20)
if ((*kb) < 20)
{
signed char remote_frames[] = {1,1,1,1,1,2,2,2,2,3,3,3,4,4,4,5,5,5,5,5,6,6,6};
if(sprite[p->i].pal == 1)
pal = 1;
else
pal = sector[p->cursectnum].floorpal;
if (!(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) pin = RS_ALIGN_R;
static const int8_t remote_frames[] = { 1,1,1,1,1,2,2,2,2,3,3,3,4,4,4,5,5,5,5,5,6,6,6 };
if (*kb)
{
if ((*kb) < 5)
{
rdmyospal(weapon_xoffset+x+190-(p->look_ang>>1)-dx,
looking_arc+258-gun_pos-64+p->at57e-dy,RRTILE1752,0,o,pal);
rdmyospal(weapon_xoffset + x + 190 - (p->look_ang >> 1) - dx,
looking_arc + 258 - gun_pos - 64 + p->at57e - dy, RRTILE1752, 0, o | pin, pal);
}
rdmyospal(weapon_xoffset+x+190-(p->look_ang>>1),
looking_arc+258-gun_pos-dy,HANDTHROW+remote_frames[*kb],gs,o,pal);
rdmyospal(weapon_xoffset + x + 190 - (p->look_ang >> 1),
looking_arc + 258 - gun_pos - dy, HANDTHROW + remote_frames[*kb], gs, o | pin, pal);
}
else
{
if ((*kb) < 5)
{
rdmyospal(weapon_xoffset+x+190-(p->look_ang>>1)-dx,
looking_arc+258-gun_pos-64+p->at57e-dy,RRTILE1752,0,o,pal);
rdmyospal(weapon_xoffset + x + 190 - (p->look_ang >> 1) - dx,
looking_arc + 258 - gun_pos - 64 + p->at57e - dy, RRTILE1752, 0, o | pin, pal);
}
rdmyospal(weapon_xoffset+x+190-(p->look_ang>>1),
looking_arc+258-gun_pos-dy,HANDTHROW+1,gs,o,pal);
rdmyospal(weapon_xoffset + x + 190 - (p->look_ang >> 1),
looking_arc + 258 - gun_pos - dy, HANDTHROW + 1, gs, o | pin, pal);
}
}
}
break;
case TIT_WEAPON:
if(sprite[p->i].pal == 1)
pal = 1;
else
pal = sector[p->cursectnum].floorpal;
};
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
auto displaytits = [&]
{
if (*kb)
{
gs = 0;
rd3myospal(150+(weapon_xoffset>>1)-(p->look_ang>>1),266+(looking_arc>>1)-gun_pos,DEVISTATOR,gs,o,pal);
rd3myospal(150 + (weapon_xoffset >> 1) - (p->look_ang >> 1), 266 + (looking_arc >> 1) - gun_pos, DEVISTATOR, gs, o, pal);
}
else
rd3myospal(150+(weapon_xoffset>>1)-(p->look_ang>>1),266+(looking_arc>>1)-gun_pos,DEVISTATOR+1,gs,o,pal);
rd3myospal(150 + (weapon_xoffset >> 1) - (p->look_ang >> 1), 266 + (looking_arc >> 1) - gun_pos, DEVISTATOR + 1, gs, o, pal);
};
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
auto displayblaster = [&]
{
if (!(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) pin = RS_ALIGN_R;
if ((*kb))
{
char cat_frames[] = { 0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
rdmyospal(weapon_xoffset + 260 - (p->look_ang >> 1), looking_arc + 215 - gun_pos, FREEZE + cat_frames[*kb], -32, o | pin, pal);
}
else rdmyospal(weapon_xoffset + 260 - (p->look_ang >> 1), looking_arc + 215 - gun_pos, FREEZE, gs, o | pin, pal);
};
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
auto displaysaw = [&]
{
weapon_xoffset += 28;
looking_arc += 18;
if ((*kb) == 0)
{
rd2myospal(weapon_xoffset + 188 - (p->look_ang >> 1),
looking_arc + 240 - gun_pos, SHRINKER, gs, o, pal);
}
else
{
if (sprite[p->i].pal != 1)
{
weapon_xoffset += rand() & 3;
gun_pos += (rand() & 3);
}
if (cw == BUZZSAW_WEAPON)
{
rd2myospal(weapon_xoffset + 184 - (p->look_ang >> 1),
looking_arc + 240 - gun_pos, GROWSPARK + ((*kb) & 2), gs, o, 0);
}
else
{
signed char kb_frames[] = { 1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0 };
short frm = kb_frames[*kb];
rd2myospal(weapon_xoffset + 184 - (p->look_ang >> 1),
looking_arc + 240 - gun_pos, SHRINKER + frm, gs, o, 0);
}
}
};
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
switch (cw)
{
case KNEE_WEAPON:
displaycrowbar();
break;
case SLINGBLADE_WEAPON:
displayslingblade();
break;
case POWDERKEG_WEAPON:
displaypowderkeg();
break;
case BOWLING_WEAPON:
displaybowlingball();
break;
case CROSSBOW_WEAPON:
displaycrossbow();
break;
case CHICKEN_WEAPON:
displaychicken();
break;
case SHOTGUN_WEAPON:
displayshotgun();
break;
case RIFLEGUN_WEAPON:
displayrifle();
break;
case PISTOL_WEAPON:
displaypistol();
break;
case DYNAMITE_WEAPON:
displaydynamite();
break;
case THROWINGDYNAMITE_WEAPON:
displaythrowingdynamite();
break;
case TIT_WEAPON:
displaytits();
break;
case MOTORCYCLE_WEAPON:
@ -804,56 +926,15 @@ void displayweapon(int snum)
break;
case ALIENBLASTER_WEAPON:
if(sprite[p->i].pal == 1)
pal = 1;
else
pal = sector[p->cursectnum].floorpal;
if((*kb))
{
char cat_frames[] = { 0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
rdmyospal(weapon_xoffset+260-(p->look_ang>>1),looking_arc+215-gun_pos,FREEZE+cat_frames[*kb],-32,o,pal);
}
else rdmyospal(weapon_xoffset+260-(p->look_ang>>1),looking_arc+215-gun_pos,FREEZE,gs,o,pal);
displayblaster();
break;
case THROWSAW_WEAPON:
case BUZZSAW_WEAPON:
weapon_xoffset += 28;
looking_arc += 18;
if(sprite[p->i].pal == 1)
pal = 1;
else
pal = sector[p->cursectnum].floorpal;
if((*kb) == 0)
{
rd2myospal(weapon_xoffset+188-(p->look_ang>>1),
looking_arc+240-gun_pos,SHRINKER,gs,o,pal);
}
else
{
if(sprite[p->i].pal != 1)
{
weapon_xoffset += rand()&3;
gun_pos += (rand()&3);
}
if(cw == BUZZSAW_WEAPON)
{
rd2myospal(weapon_xoffset+184-(p->look_ang>>1),
looking_arc+240-gun_pos,GROWSPARK+((*kb)&2),gs,o,0);
}
else
{
signed char kb_frames[] = { 1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0 };
short frm = kb_frames[*kb];
rd2myospal(weapon_xoffset+184-(p->look_ang>>1),
looking_arc+240-gun_pos,SHRINKER+frm,gs,o,0);
}
}
displaysaw();
break;
}
}
}
END_DUKE_NS

View file

@ -54,8 +54,4 @@ enum dukeinvicon_t
ICON_MAX
};
extern int const icon_to_inv[ICON_MAX];
extern int const inv_to_icon[GET_MAX];
END_DUKE_NS

View file

@ -3602,7 +3602,7 @@ enum redneck_weapon_t
ALIENBLASTER_WEAPON = 7,
POWDERKEG_WEAPON = 8,
TIT_WEAPON = 9,
//HANDREMOTE_WEAPON = 10;
THROWINGDYNAMITE_WEAPON = 10,
BUZZSAW_WEAPON = 11,
BOWLING_WEAPON = 12,
MOTORCYCLE_WEAPON = 13,

View file

@ -402,7 +402,6 @@ inline void addammo(int weaponNum, DukePlayer_t* pPlayer, int addAmount)
}
void P_AddWeapon(DukePlayer_t *pPlayer, int weaponNum);
void P_CheckWeapon(DukePlayer_t *pPlayer);
void P_DisplayScuba(void);
void P_DisplayWeapon(void);
void checkweapons(DukePlayer_t* const pPlayer);
int findotherplayer(int p, int* d);
@ -423,8 +422,6 @@ inline void setpal(DukePlayer_t* pPlayer)
void P_EndLevel(void);
void P_CheckWeaponI(int playerNum);
int P_GetHudPal(const DukePlayer_t *pPlayer);
int P_GetKneePal(const DukePlayer_t *pPlayer);
int P_GetKneePal(const DukePlayer_t *pPlayer, int hudPal);
int P_GetOverheadPal(const DukePlayer_t *pPlayer);
void madenoise(int playerNum);
int haskey(int sect, int snum);

View file

@ -997,7 +997,7 @@ void selectweapon_r(int snum, int j)
if (sprite[k].picnum == HEAVYHBOMB && sprite[k].owner == p->i)
{
p->gotweapon.Set(DYNAMITE_WEAPON);
j = HANDREMOTE_WEAPON;
j = THROWINGDYNAMITE_WEAPON;
break;
}
k = nextspritestat[k];
@ -1124,10 +1124,10 @@ void selectweapon_r(int snum, int j)
}
break;
case HANDREMOTE_WEAPON: // what's up with this? RR doesn't define this weapon.
case THROWINGDYNAMITE_WEAPON:
if (k >= 0) // Found in list of [1]'s
{
p->curr_weapon = HANDREMOTE_WEAPON;
p->curr_weapon = THROWINGDYNAMITE_WEAPON;
p->last_weapon = -1;
p->weapon_pos = 10;
}
@ -2667,7 +2667,7 @@ static void fireweapon(int snum)
if (p->ammo_amount[DYNAMITE_WEAPON] > 0)
p->kickback_pic = 1;
break;
case HANDREMOTE_WEAPON:
case THROWINGDYNAMITE_WEAPON:
p->hbomb_hold_delay = 0;
p->kickback_pic = 1;
break;
@ -2794,7 +2794,7 @@ static void operateweapon(int snum, int sb_snum, int psect)
if (p->kickback_pic > 19)
{
p->kickback_pic = 0;
p->curr_weapon = HANDREMOTE_WEAPON;
p->curr_weapon = THROWINGDYNAMITE_WEAPON;
p->last_weapon = -1;
p->weapon_pos = 10;
p->detonate_time = 45;
@ -2805,7 +2805,7 @@ static void operateweapon(int snum, int sb_snum, int psect)
break;
case HANDREMOTE_WEAPON:
case THROWINGDYNAMITE_WEAPON:
p->kickback_pic++;
@ -3682,7 +3682,7 @@ void processinput_r(int snum)
fi.doincrements(p);
if (p->curr_weapon == HANDREMOTE_WEAPON) processweapon(snum, sb_snum, psect);
if (p->curr_weapon == THROWINGDYNAMITE_WEAPON) processweapon(snum, sb_snum, psect);
return;
}

File diff suppressed because it is too large Load diff

View file

@ -744,10 +744,9 @@ void G_DisplayRest(int32_t smoothratio)
{
PspTwoDSetter set;
fi.displayweapon(screenpeek);
//P_DisplayWeapon();
if (pp->over_shoulder_on == 0)
P_DisplayScuba();
fi.displaymasks(screenpeek);
}
if (!RR)
G_MoveClouds();