mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-21 20:11:12 +00:00
Merge branch 'next' into any-resolution
This commit is contained in:
commit
bb1292a8de
61 changed files with 4696 additions and 5642 deletions
|
@ -47,8 +47,6 @@
|
|||
# HAVE_MINIUPNPC=1 - Enable automated port forwarding.
|
||||
# Already enabled by default for 32-bit
|
||||
# Windows.
|
||||
# NOPNG=1 - Disable PNG graphics support. (TODO: double
|
||||
# check netplay compatible.)
|
||||
# NOCURL=1 - Disable libcurl--HTTP capability.
|
||||
# NOGME=1 - Disable game music emu, retro VGM support.
|
||||
# NOOPENMPT=1 - Disable module (tracker) music support.
|
||||
|
@ -69,8 +67,6 @@
|
|||
# NOEXECINFO=1 - Disable stack trace dump support
|
||||
# DEBUGMODE=1 - Enable various debugging capabilities.
|
||||
# Also disables optimizations.
|
||||
# NOZLIB=1 - Disable some compression capability. Implies
|
||||
# NOPNG=1.
|
||||
#
|
||||
# Development flags:
|
||||
#
|
||||
|
|
|
@ -22,8 +22,6 @@ ifndef NOMD5
|
|||
sources+=md5.c
|
||||
endif
|
||||
|
||||
ifndef NOZLIB
|
||||
ifndef NOPNG
|
||||
ifdef PNG_PKGCONFIG
|
||||
$(eval $(call Use_pkg_config,PNG_PKGCONFIG))
|
||||
else
|
||||
|
@ -36,8 +34,6 @@ opts+=-D_LARGEFILE64_SOURCE
|
|||
endif
|
||||
opts+=-DHAVE_PNG
|
||||
sources+=apng.c
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef NOCURL
|
||||
CURLCONFIG?=curl-config
|
||||
|
|
|
@ -589,8 +589,9 @@ void B_RespawnBot(INT32 playernum)
|
|||
}
|
||||
else
|
||||
P_SetMobjState(tails, S_PLAY_FALL);
|
||||
P_SetScale(tails, sonic->scale);
|
||||
P_SetScale(tails, sonic->scale, false);
|
||||
tails->destscale = sonic->destscale;
|
||||
tails->old_scale = sonic->old_scale;
|
||||
}
|
||||
|
||||
void B_HandleFlightIndicator(player_t *player)
|
||||
|
|
|
@ -861,12 +861,6 @@ static void CON_InputDelSelection(void)
|
|||
|
||||
Lock_state();
|
||||
|
||||
if (!input_cur)
|
||||
{
|
||||
Unlock_state();
|
||||
return;
|
||||
}
|
||||
|
||||
if (input_cur > input_sel)
|
||||
{
|
||||
start = input_sel;
|
||||
|
@ -1706,11 +1700,11 @@ static void CON_DrawHudlines(void)
|
|||
}
|
||||
if (c >= con_width)
|
||||
break;
|
||||
if (*p < HU_FONTSTART)
|
||||
if (*p < FONTSTART)
|
||||
;//charwidth = 4 * con_scalefactor;
|
||||
else
|
||||
{
|
||||
//charwidth = (hu_font['A'-HU_FONTSTART]->width) * con_scalefactor;
|
||||
//charwidth = (hu_font.chars['A'-FONTSTART]->width) * con_scalefactor;
|
||||
V_DrawCharacter(x, y, (INT32)(*p) | charflags | cv_constextsize.value | V_NOSCALESTART, true);
|
||||
}
|
||||
}
|
||||
|
|
12
src/d_main.c
12
src/d_main.c
|
@ -476,6 +476,18 @@ static void D_Display(void)
|
|||
if (gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction && curbghide && (!hidetitlemap)))
|
||||
{
|
||||
// draw the view directly
|
||||
if (cv_debug)
|
||||
{
|
||||
r_renderwalls = cv_renderwalls.value;
|
||||
r_renderfloors = cv_renderfloors.value;
|
||||
r_renderthings = cv_renderthings.value;
|
||||
}
|
||||
else
|
||||
{
|
||||
r_renderwalls = true;
|
||||
r_renderfloors = true;
|
||||
r_renderthings = true;
|
||||
}
|
||||
|
||||
if (!automapactive && !dedicated && cv_renderview.value)
|
||||
{
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
/// \brief Lua SOC library
|
||||
|
||||
#include "deh_lua.h"
|
||||
#include "g_input.h"
|
||||
|
||||
// freeslot takes a name (string only!)
|
||||
// and allocates it to the appropriate free slot.
|
||||
|
@ -596,12 +597,20 @@ static int ScanConstants(lua_State *L, boolean mathlib, const char *word)
|
|||
return luaL_error(L, "translation '%s' could not be found.\n", word);
|
||||
}
|
||||
|
||||
// TODO: 2.3: Delete this alias
|
||||
if (fastcmp(word, "BT_USE"))
|
||||
// TODO: 2.3: Delete these aliases
|
||||
else if (fastcmp(word, "BT_USE"))
|
||||
{
|
||||
CacheAndPushConstant(L, word, (lua_Integer)BT_SPIN);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if (fastcmp(word, "GC_WEPSLOT8") || fastcmp(word, "GC_WEPSLOT9") || fastcmp(word, "GC_WEPSLOT10"))
|
||||
{
|
||||
// Using GC_WEPSLOT7 isn't accurate, but ensures that "if x >= GC_WEPSLOT1 and x <= GC_WEPSLOT10" keeps the intended effect
|
||||
CacheAndPushConstant(L, word, (lua_Integer)GC_WEPSLOT7);
|
||||
if (!mathlib)
|
||||
LUA_Deprecated(L, "GC_WEPSLOT8\"-\"GC_WEPSLOT10", "GC_WEPSLOT1\"-\"GC_WEPSLOT7");
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (i = 0; INT_CONST[i].n; i++)
|
||||
if (fastcmp(word,INT_CONST[i].n)) {
|
||||
|
|
|
@ -5096,6 +5096,10 @@ struct int_const_s const INT_CONST[] = {
|
|||
{"RF_SHADOWEFFECTS",RF_SHADOWEFFECTS},
|
||||
{"RF_DROPSHADOW",RF_DROPSHADOW},
|
||||
|
||||
// Animation flags
|
||||
{"SPR2F_MASK",SPR2F_MASK},
|
||||
{"SPR2F_SUPER",SPR2F_SUPER},
|
||||
|
||||
// Level flags
|
||||
{"LF_SCRIPTISFILE",LF_SCRIPTISFILE},
|
||||
{"LF_SPEEDMUSIC",LF_SPEEDMUSIC},
|
||||
|
@ -5738,6 +5742,7 @@ struct int_const_s const INT_CONST[] = {
|
|||
{"JA_DIGITAL",JA_DIGITAL},
|
||||
{"JA_JUMP",JA_JUMP},
|
||||
{"JA_SPIN",JA_SPIN},
|
||||
{"JA_SHIELD",JA_SHIELD},
|
||||
{"JA_FIRE",JA_FIRE},
|
||||
{"JA_FIRENORMAL",JA_FIRENORMAL},
|
||||
{"JOYAXISRANGE",JOYAXISRANGE},
|
||||
|
|
|
@ -82,6 +82,7 @@
|
|||
#include "version.h"
|
||||
#include "doomtype.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -648,6 +649,7 @@ UINT32 quickncasehash (const char *p, size_t n)
|
|||
#else
|
||||
#define I_Assert(e) ((void)0)
|
||||
#endif
|
||||
#define I_StaticAssert(e) static_assert(e, "Static assertion failed: " #e)
|
||||
|
||||
// The character that separates pathnames. Forward slash on
|
||||
// most systems, but reverse solidus (\) on Windows.
|
||||
|
|
|
@ -108,6 +108,7 @@ char *nongnu_strcasestr(const char *in, const char *what);
|
|||
|
||||
int startswith (const char *base, const char *tag);
|
||||
int endswith (const char *base, const char *tag);
|
||||
char *xstrtok(char *line, const char *delims);
|
||||
|
||||
#if defined (_WIN32) || defined (__HAIKU__)
|
||||
#define HAVE_DOSSTR_FUNCS
|
||||
|
|
|
@ -3530,7 +3530,7 @@ void F_TitleDemoTicker(void)
|
|||
// ==========
|
||||
|
||||
static skin_t *contskins[2];
|
||||
static UINT8 cont_spr2[2][6];
|
||||
static UINT16 cont_spr2[2][6];
|
||||
static UINT8 *contcolormaps[2];
|
||||
|
||||
void F_StartContinue(void)
|
||||
|
|
46
src/g_demo.c
46
src/g_demo.c
|
@ -98,7 +98,7 @@ demoghost *ghosts = NULL;
|
|||
// DEMO RECORDING
|
||||
//
|
||||
|
||||
#define DEMOVERSION 0x0011
|
||||
#define DEMOVERSION 0x0012
|
||||
#define DEMOHEADER "\xF0" "SRB2Replay" "\x0F"
|
||||
|
||||
#define DF_GHOST 0x01 // This demo contains ghost data too!
|
||||
|
@ -183,7 +183,11 @@ void G_ReadDemoTiccmd(ticcmd_t *cmd, INT32 playernum)
|
|||
if (ziptic & ZT_ANGLE)
|
||||
oldcmd.angleturn = READINT16(demo_p);
|
||||
if (ziptic & ZT_BUTTONS)
|
||||
{
|
||||
oldcmd.buttons = (oldcmd.buttons & (BT_CAMLEFT|BT_CAMRIGHT)) | (READUINT16(demo_p) & ~(BT_CAMLEFT|BT_CAMRIGHT));
|
||||
if (demoversion < 0x0012 && oldcmd.buttons & BT_SPIN)
|
||||
oldcmd.buttons |= BT_SHIELD; // Copy BT_SPIN to BT_SHIELD for pre-Shield-button demos
|
||||
}
|
||||
if (ziptic & ZT_AIMING)
|
||||
oldcmd.aiming = READINT16(demo_p);
|
||||
if (ziptic & ZT_LATENCY)
|
||||
|
@ -409,7 +413,7 @@ void G_WriteGhostTic(mobj_t *ghost)
|
|||
{
|
||||
oldghost.sprite2 = ghost->sprite2;
|
||||
ziptic |= GZT_SPR2;
|
||||
WRITEUINT8(demo_p,oldghost.sprite2);
|
||||
WRITEUINT16(demo_p,oldghost.sprite2);
|
||||
}
|
||||
|
||||
// Check for sprite set changes
|
||||
|
@ -509,7 +513,7 @@ void G_WriteGhostTic(mobj_t *ghost)
|
|||
temp = ghost->player->followmobj->z-ghost->z;
|
||||
WRITEFIXED(demo_p,temp);
|
||||
if (followtic & FZT_SKIN)
|
||||
WRITEUINT8(demo_p,ghost->player->followmobj->sprite2);
|
||||
WRITEUINT16(demo_p,ghost->player->followmobj->sprite2);
|
||||
WRITEUINT16(demo_p,ghost->player->followmobj->sprite);
|
||||
WRITEUINT8(demo_p,(ghost->player->followmobj->frame & FF_FRAMEMASK));
|
||||
WRITEUINT16(demo_p,ghost->player->followmobj->color);
|
||||
|
@ -571,7 +575,7 @@ void G_ConsGhostTic(void)
|
|||
if (ziptic & GZT_FRAME)
|
||||
demo_p++;
|
||||
if (ziptic & GZT_SPR2)
|
||||
demo_p++;
|
||||
demo_p += (demoversion < 0x0011) ? sizeof(UINT8) : sizeof(UINT16);
|
||||
|
||||
if (ziptic & GZT_EXTRA)
|
||||
{ // But wait, there's more!
|
||||
|
@ -640,7 +644,7 @@ void G_ConsGhostTic(void)
|
|||
// momx, momy and momz
|
||||
demo_p += (demoversion < 0x000e) ? sizeof(INT16) * 3 : sizeof(fixed_t) * 3;
|
||||
if (followtic & FZT_SKIN)
|
||||
demo_p++;
|
||||
demo_p += (demoversion < 0x0011) ? sizeof(UINT8) : sizeof(UINT16);
|
||||
demo_p += sizeof(UINT16);
|
||||
demo_p++;
|
||||
demo_p += (demoversion==0x000c) ? 1 : sizeof(UINT16);
|
||||
|
@ -722,7 +726,7 @@ void G_GhostTicker(void)
|
|||
if (ziptic & GZT_FRAME)
|
||||
g->oldmo.frame = READUINT8(g->p);
|
||||
if (ziptic & GZT_SPR2)
|
||||
g->oldmo.sprite2 = READUINT8(g->p);
|
||||
g->oldmo.sprite2 = (g->version < 0x0011) ? READUINT8(g->p) : READUINT16(g->p);
|
||||
|
||||
// Update ghost
|
||||
P_UnsetThingPosition(g->mo);
|
||||
|
@ -771,7 +775,7 @@ void G_GhostTicker(void)
|
|||
{
|
||||
g->mo->destscale = READFIXED(g->p);
|
||||
if (g->mo->destscale != g->mo->scale)
|
||||
P_SetScale(g->mo, g->mo->destscale);
|
||||
P_SetScale(g->mo, g->mo->destscale, false);
|
||||
}
|
||||
if (xziptic & EZT_THOKMASK)
|
||||
{ // Let's only spawn ONE of these per frame, thanks.
|
||||
|
@ -810,7 +814,7 @@ void G_GhostTicker(void)
|
|||
mobj->frame = (states[mobjinfo[type].spawnstate].frame & FF_FRAMEMASK) | tr_trans60<<FF_TRANSSHIFT;
|
||||
mobj->color = g->mo->color;
|
||||
mobj->skin = g->mo->skin;
|
||||
P_SetScale(mobj, (mobj->destscale = g->mo->scale));
|
||||
P_SetScale(mobj, g->mo->scale, true);
|
||||
|
||||
if (type == MT_THOK) // spintrail-specific modification for MT_THOK
|
||||
{
|
||||
|
@ -926,7 +930,7 @@ void G_GhostTicker(void)
|
|||
else
|
||||
follow->destscale = g->mo->destscale;
|
||||
if (follow->destscale != follow->scale)
|
||||
P_SetScale(follow, follow->destscale);
|
||||
P_SetScale(follow, follow->destscale, false);
|
||||
|
||||
P_UnsetThingPosition(follow);
|
||||
temp = (g->version < 0x000e) ? READINT16(g->p)<<8 : READFIXED(g->p);
|
||||
|
@ -937,7 +941,7 @@ void G_GhostTicker(void)
|
|||
follow->z = g->mo->z + temp;
|
||||
P_SetThingPosition(follow);
|
||||
if (followtic & FZT_SKIN)
|
||||
follow->sprite2 = READUINT8(g->p);
|
||||
follow->sprite2 = (g->version < 0x0011) ? READUINT8(g->p) : READUINT16(g->p);
|
||||
else
|
||||
follow->sprite2 = 0;
|
||||
follow->sprite = READUINT16(g->p);
|
||||
|
@ -1052,7 +1056,7 @@ void G_ReadMetalTic(mobj_t *metal)
|
|||
oldmetal.frame = G_ConvertOldFrameFlags(oldmetal.frame);
|
||||
}
|
||||
if (ziptic & GZT_SPR2)
|
||||
oldmetal.sprite2 = READUINT8(metal_p);
|
||||
oldmetal.sprite2 = (metalversion < 0x0011) ? READUINT8(metal_p) : READUINT16(metal_p);
|
||||
|
||||
// Set movement, position, and angle
|
||||
// oldmetal contains where you're supposed to be.
|
||||
|
@ -1079,7 +1083,7 @@ void G_ReadMetalTic(mobj_t *metal)
|
|||
{
|
||||
metal->destscale = READFIXED(metal_p);
|
||||
if (metal->destscale != metal->scale)
|
||||
P_SetScale(metal, metal->destscale);
|
||||
P_SetScale(metal, metal->destscale, false);
|
||||
}
|
||||
if (xziptic & EZT_THOKMASK)
|
||||
{ // Let's only spawn ONE of these per frame, thanks.
|
||||
|
@ -1117,7 +1121,7 @@ void G_ReadMetalTic(mobj_t *metal)
|
|||
mobj->angle = metal->angle;
|
||||
mobj->color = metal->color;
|
||||
mobj->skin = metal->skin;
|
||||
P_SetScale(mobj, (mobj->destscale = metal->scale));
|
||||
P_SetScale(mobj, metal->scale, true);
|
||||
|
||||
if (type == MT_THOK) // spintrail-specific modification for MT_THOK
|
||||
{
|
||||
|
@ -1184,7 +1188,7 @@ void G_ReadMetalTic(mobj_t *metal)
|
|||
else
|
||||
follow->destscale = metal->destscale;
|
||||
if (follow->destscale != follow->scale)
|
||||
P_SetScale(follow, follow->destscale);
|
||||
P_SetScale(follow, follow->destscale, false);
|
||||
|
||||
P_UnsetThingPosition(follow);
|
||||
temp = (metalversion < 0x000e) ? READINT16(metal_p)<<8 : READFIXED(metal_p);
|
||||
|
@ -1195,7 +1199,7 @@ void G_ReadMetalTic(mobj_t *metal)
|
|||
follow->z = metal->z + temp;
|
||||
P_SetThingPosition(follow);
|
||||
if (followtic & FZT_SKIN)
|
||||
follow->sprite2 = READUINT8(metal_p);
|
||||
follow->sprite2 = (metalversion < 0x0011) ? READUINT8(metal_p) : READUINT16(metal_p);
|
||||
else
|
||||
follow->sprite2 = 0;
|
||||
follow->sprite = READUINT16(metal_p);
|
||||
|
@ -1203,7 +1207,7 @@ void G_ReadMetalTic(mobj_t *metal)
|
|||
if (metalversion < 0x000f)
|
||||
follow->frame = G_ConvertOldFrameFlags(follow->frame);
|
||||
follow->angle = metal->angle;
|
||||
follow->color = (metalversion==0x000c) ? READUINT8(metal_p) : READUINT16(metal_p);
|
||||
follow->color = (metalversion == 0x000c) ? READUINT8(metal_p) : READUINT16(metal_p);
|
||||
|
||||
if (!(followtic & FZT_SPAWNED))
|
||||
{
|
||||
|
@ -1304,7 +1308,7 @@ void G_WriteMetalTic(mobj_t *metal)
|
|||
{
|
||||
oldmetal.sprite2 = metal->sprite2;
|
||||
ziptic |= GZT_SPR2;
|
||||
WRITEUINT8(demo_p,oldmetal.sprite2);
|
||||
WRITEUINT16(demo_p,oldmetal.sprite2);
|
||||
}
|
||||
|
||||
// Check for sprite set changes
|
||||
|
@ -1379,7 +1383,7 @@ void G_WriteMetalTic(mobj_t *metal)
|
|||
temp = metal->player->followmobj->z-metal->z;
|
||||
WRITEFIXED(demo_p,temp);
|
||||
if (followtic & FZT_SKIN)
|
||||
WRITEUINT8(demo_p,metal->player->followmobj->sprite2);
|
||||
WRITEUINT16(demo_p,metal->player->followmobj->sprite2);
|
||||
WRITEUINT16(demo_p,metal->player->followmobj->sprite);
|
||||
WRITEUINT32(demo_p,metal->player->followmobj->frame); // NOT & FF_FRAMEMASK here, so 32 bits
|
||||
WRITEUINT16(demo_p,metal->player->followmobj->color);
|
||||
|
@ -2603,10 +2607,10 @@ void G_AddGhost(char *defdemoname)
|
|||
}
|
||||
gh->oldmo.color = gh->mo->color;
|
||||
|
||||
gh->mo->state = states+S_PLAY_STND;
|
||||
gh->mo->state = &states[S_PLAY_STND];
|
||||
gh->mo->sprite = gh->mo->state->sprite;
|
||||
gh->mo->sprite2 = (gh->mo->state->frame & FF_FRAMEMASK);
|
||||
//gh->mo->frame = tr_trans30<<FF_TRANSSHIFT;
|
||||
gh->mo->sprite2 = P_GetStateSprite2(gh->mo->state);
|
||||
gh->mo->frame = (gh->mo->state->frame & ~FF_FRAMEMASK) | P_GetSprite2StateFrame(gh->mo->state);
|
||||
gh->mo->flags2 |= MF2_DONTDRAW;
|
||||
gh->fadein = (9-3)*6; // fade from invisible to trans30 over as close to 35 tics as possible
|
||||
gh->mo->tics = -1;
|
||||
|
|
55
src/g_game.c
55
src/g_game.c
|
@ -403,27 +403,29 @@ consvar_t cv_cam_lockonboss[2] = {
|
|||
CVAR_INIT ("cam2_lockaimassist", "Full", CV_SAVE|CV_ALLOWLUA, lockedassist_cons_t, NULL),
|
||||
};
|
||||
|
||||
consvar_t cv_moveaxis = CVAR_INIT ("joyaxis_move", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_sideaxis = CVAR_INIT ("joyaxis_side", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_lookaxis = CVAR_INIT ("joyaxis_look", "X-Rudder-", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_turnaxis = CVAR_INIT ("joyaxis_turn", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_jumpaxis = CVAR_INIT ("joyaxis_jump", "None", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_spinaxis = CVAR_INIT ("joyaxis_spin", "None", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_fireaxis = CVAR_INIT ("joyaxis_fire", "Z-Rudder", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_firenaxis = CVAR_INIT ("joyaxis_firenormal", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_deadzone = CVAR_INIT ("joy_deadzone", "0.125", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL);
|
||||
consvar_t cv_digitaldeadzone = CVAR_INIT ("joy_digdeadzone", "0.25", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL);
|
||||
consvar_t cv_moveaxis = CVAR_INIT ("joyaxis_move", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_sideaxis = CVAR_INIT ("joyaxis_side", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_lookaxis = CVAR_INIT ("joyaxis_look", "X-Rudder-", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_turnaxis = CVAR_INIT ("joyaxis_turn", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_jumpaxis = CVAR_INIT ("joyaxis_jump", "None", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_spinaxis = CVAR_INIT ("joyaxis_spin", "None", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_shieldaxis = CVAR_INIT ("joyaxis_shield", "None", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_fireaxis = CVAR_INIT ("joyaxis_fire", "Z-Rudder", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_firenaxis = CVAR_INIT ("joyaxis_firenormal", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_deadzone = CVAR_INIT ("joy_deadzone", "0.125", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL);
|
||||
consvar_t cv_digitaldeadzone = CVAR_INIT ("joy_digdeadzone", "0.25", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL);
|
||||
|
||||
consvar_t cv_moveaxis2 = CVAR_INIT ("joyaxis2_move", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_sideaxis2 = CVAR_INIT ("joyaxis2_side", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_lookaxis2 = CVAR_INIT ("joyaxis2_look", "X-Rudder-", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_turnaxis2 = CVAR_INIT ("joyaxis2_turn", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_jumpaxis2 = CVAR_INIT ("joyaxis2_jump", "None", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_spinaxis2 = CVAR_INIT ("joyaxis2_spin", "None", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_fireaxis2 = CVAR_INIT ("joyaxis2_fire", "Z-Rudder", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_firenaxis2 = CVAR_INIT ("joyaxis2_firenormal", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_deadzone2 = CVAR_INIT ("joy_deadzone2", "0.125", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL);
|
||||
consvar_t cv_digitaldeadzone2 = CVAR_INIT ("joy_digdeadzone2", "0.25", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL);
|
||||
consvar_t cv_moveaxis2 = CVAR_INIT ("joyaxis2_move", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_sideaxis2 = CVAR_INIT ("joyaxis2_side", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_lookaxis2 = CVAR_INIT ("joyaxis2_look", "X-Rudder-", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_turnaxis2 = CVAR_INIT ("joyaxis2_turn", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_jumpaxis2 = CVAR_INIT ("joyaxis2_jump", "None", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_spinaxis2 = CVAR_INIT ("joyaxis2_spin", "None", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_shieldaxis2 = CVAR_INIT ("joyaxis2_shield", "None", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_fireaxis2 = CVAR_INIT ("joyaxis2_fire", "Z-Rudder", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_firenaxis2 = CVAR_INIT ("joyaxis2_firenormal", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL);
|
||||
consvar_t cv_deadzone2 = CVAR_INIT ("joy_deadzone2", "0.125", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL);
|
||||
consvar_t cv_digitaldeadzone2 = CVAR_INIT ("joy_digdeadzone2", "0.25", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL);
|
||||
|
||||
player_t *seenplayer; // player we're aiming at right now
|
||||
|
||||
|
@ -894,6 +896,9 @@ INT32 JoyAxis(joyaxis_e axissel)
|
|||
case JA_SPIN:
|
||||
axisval = cv_spinaxis.value;
|
||||
break;
|
||||
case JA_SHIELD:
|
||||
axisval = cv_shieldaxis.value;
|
||||
break;
|
||||
case JA_FIRE:
|
||||
axisval = cv_fireaxis.value;
|
||||
break;
|
||||
|
@ -967,6 +972,9 @@ INT32 Joy2Axis(joyaxis_e axissel)
|
|||
case JA_SPIN:
|
||||
axisval = cv_spinaxis2.value;
|
||||
break;
|
||||
case JA_SHIELD:
|
||||
axisval = cv_shieldaxis2.value;
|
||||
break;
|
||||
case JA_FIRE:
|
||||
axisval = cv_fireaxis2.value;
|
||||
break;
|
||||
|
@ -1334,8 +1342,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
if (PLAYERINPUTDOWN(ssplayer, GC_WEAPONPREV))
|
||||
cmd->buttons |= BT_WEAPONPREV; // Previous Weapon
|
||||
|
||||
#if NUM_WEAPONS > 10
|
||||
"Add extra inputs to g_input.h/gamecontrols_e"
|
||||
#if NUM_WEAPONS > 7
|
||||
"Add extra inputs to g_input.h/gamecontrols_e, and fix conflicts in d_ticcmd.h/ticcmd_t/buttons"
|
||||
#endif
|
||||
//use the three avaliable bits to determine the weapon.
|
||||
cmd->buttons &= ~BT_WEAPONMASK;
|
||||
|
@ -1361,7 +1369,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
cmd->buttons |= BT_TOSSFLAG;
|
||||
|
||||
// Shield button
|
||||
if (PLAYERINPUTDOWN(ssplayer, GC_SHIELD))
|
||||
axis = PlayerJoyAxis(ssplayer, JA_SHIELD);
|
||||
if (PLAYERINPUTDOWN(ssplayer, GC_SHIELD) || (usejoystick && axis > 0))
|
||||
cmd->buttons |= BT_SHIELD;
|
||||
|
||||
// Lua scriptable buttons
|
||||
|
|
|
@ -71,8 +71,8 @@ typedef enum {
|
|||
#define P_ControlStyle(player) ((((player)->pflags & PF_ANALOGMODE) ? CS_LMAOGALOG : 0) | (((player)->pflags & PF_DIRECTIONCHAR) ? CS_STANDARD : 0))
|
||||
|
||||
extern consvar_t cv_autobrake, cv_autobrake2;
|
||||
extern consvar_t cv_sideaxis,cv_turnaxis,cv_moveaxis,cv_lookaxis,cv_jumpaxis,cv_spinaxis,cv_fireaxis,cv_firenaxis,cv_deadzone,cv_digitaldeadzone;
|
||||
extern consvar_t cv_sideaxis2,cv_turnaxis2,cv_moveaxis2,cv_lookaxis2,cv_jumpaxis2,cv_spinaxis2,cv_fireaxis2,cv_firenaxis2,cv_deadzone2,cv_digitaldeadzone2;
|
||||
extern consvar_t cv_sideaxis, cv_turnaxis, cv_moveaxis, cv_lookaxis, cv_jumpaxis, cv_spinaxis, cv_shieldaxis, cv_fireaxis, cv_firenaxis, cv_deadzone, cv_digitaldeadzone;
|
||||
extern consvar_t cv_sideaxis2,cv_turnaxis2,cv_moveaxis2,cv_lookaxis2,cv_jumpaxis2,cv_spinaxis2,cv_shieldaxis2,cv_fireaxis2,cv_firenaxis2,cv_deadzone2,cv_digitaldeadzone2;
|
||||
extern consvar_t cv_ghost_bestscore, cv_ghost_besttime, cv_ghost_bestrings, cv_ghost_last, cv_ghost_guest;
|
||||
|
||||
// hi here's some new controls
|
||||
|
@ -100,6 +100,7 @@ typedef enum
|
|||
|
||||
JA_JUMP = JA_DIGITAL,
|
||||
JA_SPIN,
|
||||
JA_SHIELD,
|
||||
JA_FIRE,
|
||||
JA_FIRENORMAL,
|
||||
} joyaxis_e;
|
||||
|
|
|
@ -743,34 +743,34 @@ void G_DefineDefaultControls(void)
|
|||
// Gamepad controls -- same for both schemes
|
||||
gamecontroldefault[i][GC_JUMP ][1] = KEY_JOY1+0; // A
|
||||
gamecontroldefault[i][GC_SPIN ][1] = KEY_JOY1+2; // X
|
||||
gamecontroldefault[i][GC_CUSTOM1 ][1] = KEY_JOY1+1; // B
|
||||
gamecontroldefault[i][GC_CUSTOM2 ][1] = KEY_JOY1+3; // Y
|
||||
gamecontroldefault[i][GC_CUSTOM3 ][1] = KEY_JOY1+8; // Left Stick
|
||||
gamecontroldefault[i][GC_SHIELD ][1] = KEY_JOY1+4; // LB
|
||||
gamecontroldefault[i][GC_SHIELD ][1] = KEY_JOY1+1; // B
|
||||
gamecontroldefault[i][GC_CUSTOM1 ][1] = KEY_JOY1+3; // Y
|
||||
gamecontroldefault[i][GC_CUSTOM2 ][1] = KEY_JOY1+4; // LB
|
||||
gamecontroldefault[i][GC_CENTERVIEW ][1] = KEY_JOY1+5; // RB
|
||||
gamecontroldefault[i][GC_CUSTOM3 ][1] = KEY_JOY1+8; // Left Stick
|
||||
gamecontroldefault[i][GC_CAMTOGGLE ][1] = KEY_JOY1+9; // Right Stick
|
||||
gamecontroldefault[i][GC_SCORES ][1] = KEY_JOY1+6; // Back
|
||||
gamecontroldefault[i][GC_SYSTEMMENU ][0] = KEY_JOY1+7; // Start
|
||||
gamecontroldefault[i][GC_VIEWPOINTNEXT][1] = KEY_HAT1+0; // D-Pad Up
|
||||
gamecontroldefault[i][GC_TOSSFLAG ][1] = KEY_HAT1+1; // D-Pad Down
|
||||
gamecontroldefault[i][GC_WEAPONPREV ][1] = KEY_HAT1+2; // D-Pad Left
|
||||
gamecontroldefault[i][GC_WEAPONNEXT ][1] = KEY_HAT1+3; // D-Pad Right
|
||||
gamecontroldefault[i][GC_VIEWPOINTNEXT][1] = KEY_JOY1+9; // Right Stick
|
||||
gamecontroldefault[i][GC_TOSSFLAG ][1] = KEY_HAT1+0; // D-Pad Up
|
||||
gamecontroldefault[i][GC_CAMTOGGLE ][1] = KEY_HAT1+1; // D-Pad Down
|
||||
|
||||
// Second player controls only have joypad defaults
|
||||
gamecontrolbisdefault[i][GC_JUMP ][1] = KEY_2JOY1+0; // A
|
||||
gamecontrolbisdefault[i][GC_SPIN ][1] = KEY_2JOY1+2; // X
|
||||
gamecontrolbisdefault[i][GC_CUSTOM1 ][1] = KEY_2JOY1+1; // B
|
||||
gamecontrolbisdefault[i][GC_CUSTOM2 ][1] = KEY_2JOY1+3; // Y
|
||||
gamecontrolbisdefault[i][GC_CUSTOM3 ][1] = KEY_2JOY1+8; // Left Stick
|
||||
gamecontrolbisdefault[i][GC_SHIELD ][1] = KEY_2JOY1+4; // LB
|
||||
gamecontrolbisdefault[i][GC_SHIELD ][1] = KEY_2JOY1+1; // B
|
||||
gamecontrolbisdefault[i][GC_CUSTOM1 ][1] = KEY_2JOY1+3; // Y
|
||||
gamecontrolbisdefault[i][GC_CUSTOM2 ][1] = KEY_2JOY1+4; // LB
|
||||
gamecontrolbisdefault[i][GC_CENTERVIEW ][1] = KEY_2JOY1+5; // RB
|
||||
gamecontrolbisdefault[i][GC_CUSTOM3 ][1] = KEY_2JOY1+8; // Left Stick
|
||||
gamecontrolbisdefault[i][GC_CAMTOGGLE ][1] = KEY_2JOY1+9; // Right Stick
|
||||
//gamecontrolbisdefault[i][GC_SCORES ][1] = KEY_2JOY1+6; // Back
|
||||
//gamecontrolbisdefault[i][GC_SYSTEMMENU ][0] = KEY_2JOY1+7; // Start
|
||||
gamecontrolbisdefault[i][GC_VIEWPOINTNEXT][1] = KEY_2HAT1+0; // D-Pad Up
|
||||
gamecontrolbisdefault[i][GC_TOSSFLAG ][1] = KEY_2HAT1+1; // D-Pad Down
|
||||
gamecontrolbisdefault[i][GC_WEAPONPREV ][1] = KEY_2HAT1+2; // D-Pad Left
|
||||
gamecontrolbisdefault[i][GC_WEAPONNEXT ][1] = KEY_2HAT1+3; // D-Pad Right
|
||||
gamecontrolbisdefault[i][GC_VIEWPOINTNEXT][1] = KEY_2JOY1+9; // Right Stick
|
||||
gamecontrolbisdefault[i][GC_TOSSFLAG ][1] = KEY_2HAT1+0; // D-Pad Up
|
||||
gamecontrolbisdefault[i][GC_CAMTOGGLE ][1] = KEY_2HAT1+1; // D-Pad Down
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1001,7 +1001,6 @@ static void setcontrol(INT32 (*gc)[2])
|
|||
|
||||
// TODO: 2.3: Delete the "use" alias
|
||||
namectrl = (stricmp(COM_Argv(1), "use")) ? COM_Argv(1) : "spin";
|
||||
|
||||
|
||||
for (numctrl = 0; numctrl < NUM_GAMECONTROLS && stricmp(namectrl, gamecontrolname[numctrl]);
|
||||
numctrl++)
|
||||
|
|
|
@ -98,13 +98,11 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
|||
if (position + count >= pblockheight)
|
||||
count = pblockheight - position;
|
||||
|
||||
dest = block + (position*blockmodulo);
|
||||
while (count > 0)
|
||||
for (dest = block + (position*blockmodulo); count > 0; count--, dest += blockmodulo, yfrac += yfracstep)
|
||||
{
|
||||
count--;
|
||||
|
||||
texel = source[yfrac>>FRACBITS];
|
||||
alpha = 0xFF;
|
||||
|
||||
// Make pixel transparent if chroma keyed
|
||||
if ((mipmap->flags & TF_CHROMAKEYED) && (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX))
|
||||
alpha = 0x00;
|
||||
|
@ -115,11 +113,20 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
|||
switch (bpp)
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
texelu16 = *((UINT16*)dest);
|
||||
if ((originPatch != NULL) && (originPatch->style != AST_COPY))
|
||||
texel = ASTBlendPaletteIndexes(*(dest+1), texel, originPatch->style, originPatch->alpha);
|
||||
{
|
||||
if (originPatch->style == AST_TRANSLUCENT && originPatch->alpha < ASTTextureBlendingThreshold[0])
|
||||
continue;
|
||||
if (!(texelu16 & 0xFF00) && originPatch->alpha <= ASTTextureBlendingThreshold[1])
|
||||
continue;
|
||||
texel = ASTBlendPaletteIndexes(texelu16 & 0xFF, texel, originPatch->style, originPatch->alpha);
|
||||
}
|
||||
texelu16 = (UINT16)((alpha<<8) | texel);
|
||||
memcpy(dest, &texelu16, sizeof(UINT16));
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
colortemp = palette[texel];
|
||||
if ((originPatch != NULL) && (originPatch->style != AST_COPY))
|
||||
|
@ -149,9 +156,6 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
|||
*dest = texel;
|
||||
break;
|
||||
}
|
||||
|
||||
dest += blockmodulo;
|
||||
yfrac += yfracstep;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -202,13 +206,11 @@ static void HWR_DrawFlippedColumnInCache(const column_t *patchcol, UINT8 *block,
|
|||
if (position + count >= pblockheight)
|
||||
count = pblockheight - position;
|
||||
|
||||
dest = block + (position*blockmodulo);
|
||||
while (count > 0)
|
||||
for (dest = block + (position*blockmodulo); count > 0; count--, dest += blockmodulo, yfrac -= yfracstep)
|
||||
{
|
||||
count--;
|
||||
|
||||
texel = source[yfrac>>FRACBITS];
|
||||
alpha = 0xFF;
|
||||
|
||||
// Make pixel transparent if chroma keyed
|
||||
if ((mipmap->flags & TF_CHROMAKEYED) && (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX))
|
||||
alpha = 0x00;
|
||||
|
@ -219,8 +221,15 @@ static void HWR_DrawFlippedColumnInCache(const column_t *patchcol, UINT8 *block,
|
|||
switch (bpp)
|
||||
{
|
||||
case 2:
|
||||
texelu16 = *((UINT16*)dest);
|
||||
if ((originPatch != NULL) && (originPatch->style != AST_COPY))
|
||||
texel = ASTBlendPaletteIndexes(*(dest+1), texel, originPatch->style, originPatch->alpha);
|
||||
{
|
||||
if (originPatch->style == AST_TRANSLUCENT && originPatch->alpha < ASTTextureBlendingThreshold[0])
|
||||
continue;
|
||||
if (!(texelu16 & 0xFF00) && originPatch->alpha <= ASTTextureBlendingThreshold[1])
|
||||
continue;
|
||||
texel = ASTBlendPaletteIndexes(texelu16 & 0xFF, texel, originPatch->style, originPatch->alpha);
|
||||
}
|
||||
texelu16 = (UINT16)((alpha<<8) | texel);
|
||||
memcpy(dest, &texelu16, sizeof(UINT16));
|
||||
break;
|
||||
|
@ -253,9 +262,6 @@ static void HWR_DrawFlippedColumnInCache(const column_t *patchcol, UINT8 *block,
|
|||
*dest = texel;
|
||||
break;
|
||||
}
|
||||
|
||||
dest += blockmodulo;
|
||||
yfrac -= yfracstep;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -433,7 +439,7 @@ static UINT8 *MakeBlock(GLMipmap_t *grMipmap)
|
|||
// Create a composite texture from patches, adapt the texture size to a power of 2
|
||||
// height and width for the hardware texture cache.
|
||||
//
|
||||
static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex)
|
||||
static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex, GLMipmap_t *mipmap)
|
||||
{
|
||||
UINT8 *block;
|
||||
texture_t *texture;
|
||||
|
@ -441,57 +447,19 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex)
|
|||
INT32 blockwidth, blockheight, blocksize;
|
||||
|
||||
INT32 i;
|
||||
boolean skyspecial = false; //poor hack for Legacy large skies..
|
||||
|
||||
RGBA_t *palette;
|
||||
palette = HWR_GetTexturePalette();
|
||||
|
||||
texture = textures[texnum];
|
||||
|
||||
// hack the Legacy skies..
|
||||
if (texture->name[0] == 'S' &&
|
||||
texture->name[1] == 'K' &&
|
||||
texture->name[2] == 'Y' &&
|
||||
(texture->name[4] == 0 ||
|
||||
texture->name[5] == 0)
|
||||
)
|
||||
{
|
||||
skyspecial = true;
|
||||
grtex->mipmap.flags = TF_WRAPXY; // don't use the chromakey for sky
|
||||
}
|
||||
else
|
||||
grtex->mipmap.flags = TF_CHROMAKEYED | TF_WRAPXY;
|
||||
|
||||
grtex->mipmap.width = (UINT16)texture->width;
|
||||
grtex->mipmap.height = (UINT16)texture->height;
|
||||
if (skyspecial)
|
||||
grtex->mipmap.format = GL_TEXFMT_RGBA; // that skyspecial code below assumes this format ...
|
||||
else
|
||||
grtex->mipmap.format = textureformat;
|
||||
mipmap->flags = TF_WRAPXY;
|
||||
mipmap->width = (UINT16)texture->width;
|
||||
mipmap->height = (UINT16)texture->height;
|
||||
mipmap->format = textureformat;
|
||||
|
||||
blockwidth = texture->width;
|
||||
blockheight = texture->height;
|
||||
blocksize = (blockwidth * blockheight);
|
||||
block = MakeBlock(&grtex->mipmap);
|
||||
|
||||
if (skyspecial) //Hurdler: not efficient, but better than holes in the sky (and it's done only at level loading)
|
||||
{
|
||||
INT32 j;
|
||||
RGBA_t col;
|
||||
|
||||
col = palette[HWR_PATCHES_CHROMAKEY_COLORINDEX];
|
||||
for (j = 0; j < blockheight; j++)
|
||||
{
|
||||
for (i = 0; i < blockwidth; i++)
|
||||
{
|
||||
block[4*(j*blockwidth+i)+0] = col.s.red;
|
||||
block[4*(j*blockwidth+i)+1] = col.s.green;
|
||||
block[4*(j*blockwidth+i)+2] = col.s.blue;
|
||||
block[4*(j*blockwidth+i)+3] = 0xff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Composite the columns together.
|
||||
for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++)
|
||||
{
|
||||
|
@ -526,13 +494,13 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex)
|
|||
Patch_Free(realpatch);
|
||||
}
|
||||
//Hurdler: not efficient at all but I don't remember exactly how HWR_DrawPatchInCache works :(
|
||||
if (format2bpp(grtex->mipmap.format)==4)
|
||||
if (format2bpp(mipmap->format)==4)
|
||||
{
|
||||
for (i = 3; i < blocksize*4; i += 4) // blocksize*4 because blocksize doesn't include the bpp
|
||||
{
|
||||
if (block[i] == 0)
|
||||
{
|
||||
grtex->mipmap.flags |= TF_TRANSPARENT;
|
||||
mipmap->flags |= TF_TRANSPARENT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -661,8 +629,6 @@ void HWR_FreeTextureColormaps(patch_t *patch)
|
|||
Z_Free(next->data);
|
||||
if (next->colormap)
|
||||
Z_Free(next->colormap);
|
||||
next->data = NULL;
|
||||
next->colormap = NULL;
|
||||
HWD.pfnDeleteTexture(next);
|
||||
|
||||
// Free the old colormap mipmap from memory.
|
||||
|
@ -714,12 +680,25 @@ void HWR_InitMapTextures(void)
|
|||
gl_maptexturesloaded = false;
|
||||
}
|
||||
|
||||
static void DeleteTextureMipmap(GLMipmap_t *grMipmap)
|
||||
{
|
||||
HWD.pfnDeleteTexture(grMipmap);
|
||||
|
||||
// Chroma-keyed textures do not own their texture data, so do not free it
|
||||
if (!(grMipmap->flags & TF_CHROMAKEYED))
|
||||
Z_Free(grMipmap->data);
|
||||
}
|
||||
|
||||
static void FreeMapTexture(GLMapTexture_t *tex)
|
||||
{
|
||||
HWD.pfnDeleteTexture(&tex->mipmap);
|
||||
if (tex->mipmap.data)
|
||||
Z_Free(tex->mipmap.data);
|
||||
tex->mipmap.data = NULL;
|
||||
if (tex->mipmap.nextcolormap)
|
||||
{
|
||||
DeleteTextureMipmap(tex->mipmap.nextcolormap);
|
||||
free(tex->mipmap.nextcolormap);
|
||||
tex->mipmap.nextcolormap = NULL;
|
||||
}
|
||||
|
||||
DeleteTextureMipmap(&tex->mipmap);
|
||||
}
|
||||
|
||||
void HWR_FreeMapTextures(void)
|
||||
|
@ -762,41 +741,47 @@ void HWR_LoadMapTextures(size_t pnumtextures)
|
|||
// --------------------------------------------------------------------------
|
||||
// Make sure texture is downloaded and set it as the source
|
||||
// --------------------------------------------------------------------------
|
||||
GLMapTexture_t *HWR_GetTexture(INT32 tex)
|
||||
static void GetMapTexture(INT32 tex, GLMapTexture_t *grtex, GLMipmap_t *mipmap)
|
||||
{
|
||||
GLMapTexture_t *grtex;
|
||||
#ifdef PARANOIA
|
||||
if ((unsigned)tex >= gl_numtextures)
|
||||
I_Error("HWR_GetTexture: tex >= numtextures\n");
|
||||
#endif
|
||||
|
||||
// Every texture in memory, stored in the
|
||||
// hardware renderer's bit depth format. Wow!
|
||||
grtex = &gl_textures[tex];
|
||||
|
||||
// Generate texture if missing from the cache
|
||||
if (!grtex->mipmap.data && !grtex->mipmap.downloaded)
|
||||
HWR_GenerateTexture(tex, grtex);
|
||||
if (!mipmap->data && !mipmap->downloaded)
|
||||
HWR_GenerateTexture(tex, grtex, mipmap);
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!grtex->mipmap.downloaded)
|
||||
HWD.pfnSetTexture(&grtex->mipmap);
|
||||
HWR_SetCurrentTexture(&grtex->mipmap);
|
||||
if (!mipmap->downloaded)
|
||||
HWD.pfnSetTexture(mipmap);
|
||||
HWR_SetCurrentTexture(mipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(grtex->mipmap.data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(mipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
GLMapTexture_t *HWR_GetTexture(INT32 tex)
|
||||
{
|
||||
if (tex < 0 || tex >= (signed)gl_numtextures)
|
||||
{
|
||||
#ifdef PARANOIA
|
||||
I_Error("HWR_GetTexture: Invalid texture ID %d", tex);
|
||||
#else
|
||||
tex = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
GLMapTexture_t *grtex = &gl_textures[tex];
|
||||
|
||||
GetMapTexture(tex, grtex, &grtex->mipmap);
|
||||
|
||||
return grtex;
|
||||
}
|
||||
|
||||
static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
|
||||
static void HWR_CacheRawFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
|
||||
{
|
||||
size_t size = W_LumpLength(flatlumpnum);
|
||||
UINT16 pflatsize = R_GetFlatSize(size);
|
||||
|
||||
// setup the texture info
|
||||
grMipmap->format = GL_TEXFMT_P_8;
|
||||
grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
|
||||
grMipmap->flags = TF_WRAPXY;
|
||||
|
||||
grMipmap->width = pflatsize;
|
||||
grMipmap->height = pflatsize;
|
||||
|
@ -817,7 +802,7 @@ void HWR_GetRawFlat(lumpnum_t flatlumpnum)
|
|||
patch = HWR_GetCachedGLPatch(flatlumpnum);
|
||||
grmip = ((GLPatch_t *)Patch_AllocateHardwarePatch(patch))->mipmap;
|
||||
if (!grmip->downloaded && !grmip->data)
|
||||
HWR_CacheFlat(grmip, flatlumpnum);
|
||||
HWR_CacheRawFlat(grmip, flatlumpnum);
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!grmip->downloaded)
|
||||
|
@ -828,7 +813,16 @@ void HWR_GetRawFlat(lumpnum_t flatlumpnum)
|
|||
Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
void HWR_GetLevelFlat(levelflat_t *levelflat)
|
||||
static void MakeLevelFlatMipmap(GLMipmap_t *grMipmap, INT32 texturenum, UINT16 flags)
|
||||
{
|
||||
grMipmap->format = GL_TEXFMT_P_8;
|
||||
grMipmap->flags = flags;
|
||||
|
||||
grMipmap->width = (UINT16)textures[texturenum]->width;
|
||||
grMipmap->height = (UINT16)textures[texturenum]->height;
|
||||
}
|
||||
|
||||
void HWR_GetLevelFlat(levelflat_t *levelflat, boolean chromakeyed)
|
||||
{
|
||||
if (levelflat->type == LEVELFLAT_NONE || levelflat->texture_id < 0)
|
||||
{
|
||||
|
@ -839,24 +833,50 @@ void HWR_GetLevelFlat(levelflat_t *levelflat)
|
|||
INT32 texturenum = texturetranslation[levelflat->texture_id];
|
||||
|
||||
GLMapTexture_t *grtex = &gl_flats[texturenum];
|
||||
|
||||
GLMipmap_t *grMipmap = &grtex->mipmap;
|
||||
GLMipmap_t *originalMipmap = grMipmap;
|
||||
|
||||
if (!grMipmap->data && !grMipmap->downloaded)
|
||||
if (!originalMipmap->downloaded)
|
||||
MakeLevelFlatMipmap(originalMipmap, texturenum, TF_WRAPXY);
|
||||
|
||||
if (!originalMipmap->data)
|
||||
{
|
||||
grMipmap->format = GL_TEXFMT_P_8;
|
||||
grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
|
||||
size_t size = originalMipmap->width * originalMipmap->height;
|
||||
memcpy(Z_Malloc(size, PU_HWRCACHE, &originalMipmap->data), R_GetFlatForTexture(texturenum), size);
|
||||
}
|
||||
|
||||
grMipmap->width = (UINT16)textures[texturenum]->width;
|
||||
grMipmap->height = (UINT16)textures[texturenum]->height;
|
||||
// If chroma-keyed, create or use a different mipmap for the variant
|
||||
if (chromakeyed)
|
||||
{
|
||||
if (!originalMipmap->data)
|
||||
{
|
||||
HWR_SetCurrentTexture(NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
size_t size = grMipmap->width * grMipmap->height;
|
||||
memcpy(Z_Malloc(size, PU_HWRCACHE, &grMipmap->data), R_GetFlatForTexture(texturenum), size);
|
||||
// Allocate it if it wasn't already
|
||||
if (!originalMipmap->nextcolormap)
|
||||
{
|
||||
GLMipmap_t *newMipmap = calloc(1, sizeof (*grMipmap));
|
||||
if (newMipmap == NULL)
|
||||
I_Error("%s: Out of memory", "HWR_GetLevelFlat");
|
||||
MakeLevelFlatMipmap(newMipmap, texturenum, TF_WRAPXY | TF_CHROMAKEYED);
|
||||
originalMipmap->nextcolormap = newMipmap;
|
||||
}
|
||||
|
||||
// Upload and bind the variant texture instead of the original one
|
||||
grMipmap = originalMipmap->nextcolormap;
|
||||
|
||||
// Use the original texture's pixel data
|
||||
// It can just be a pointer to it, since the r_opengl backend deals with the pixels
|
||||
// that are supposed to be transparent.
|
||||
grMipmap->data = originalMipmap->data;
|
||||
}
|
||||
|
||||
if (!grMipmap->downloaded)
|
||||
HWD.pfnSetTexture(&grtex->mipmap);
|
||||
|
||||
HWR_SetCurrentTexture(&grtex->mipmap);
|
||||
HWD.pfnSetTexture(grMipmap);
|
||||
HWR_SetCurrentTexture(grMipmap);
|
||||
|
||||
Z_ChangeTag(grMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
|
|
@ -246,7 +246,7 @@ enum ETextureFlags
|
|||
TF_WRAPX = 0x00000001, // wrap around X
|
||||
TF_WRAPY = 0x00000002, // wrap around Y
|
||||
TF_WRAPXY = TF_WRAPY|TF_WRAPX, // very common so use alias is more easy
|
||||
TF_CHROMAKEYED = 0x00000010,
|
||||
TF_CHROMAKEYED = 0x00000010, // Used only for flats with pixels that have palette index 255
|
||||
TF_TRANSPARENT = 0x00000040, // texture with some alpha == 0
|
||||
};
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ void HWR_GetMappedPatch(patch_t *patch, const UINT8 *colormap);
|
|||
void HWR_GetFadeMask(lumpnum_t fademasklumpnum);
|
||||
|
||||
GLMapTexture_t *HWR_GetTexture(INT32 tex);
|
||||
void HWR_GetLevelFlat(levelflat_t *levelflat);
|
||||
void HWR_GetLevelFlat(levelflat_t *levelflat, boolean chromakeyed);
|
||||
void HWR_GetRawFlat(lumpnum_t flatlumpnum);
|
||||
|
||||
void HWR_FreeTexture(patch_t *patch);
|
||||
|
|
|
@ -59,7 +59,7 @@ static void HWR_ProjectSprite(mobj_t *thing);
|
|||
static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing);
|
||||
static void HWR_ProjectBoundingBox(mobj_t *thing);
|
||||
|
||||
void HWR_AddTransparentFloor(levelflat_t *levelflat, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap);
|
||||
void HWR_AddTransparentFloor(levelflat_t *levelflat, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, boolean chromakeyed, extracolormap_t *planecolormap);
|
||||
void HWR_AddTransparentPolyobjectFloor(levelflat_t *levelflat, polyobj_t *polysector, boolean isceiling, fixed_t fixedheight,
|
||||
INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, extracolormap_t *planecolormap);
|
||||
|
||||
|
@ -358,6 +358,9 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
|||
static FOutVector *planeVerts = NULL;
|
||||
static UINT16 numAllocedPlaneVerts = 0;
|
||||
|
||||
if (!r_renderfloors)
|
||||
return;
|
||||
|
||||
// no convex poly were generated for this subsector
|
||||
if (!xsub->planepoly)
|
||||
return;
|
||||
|
@ -502,9 +505,6 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
|||
PolyFlags |= PF_ColorMapped;
|
||||
}
|
||||
|
||||
if (!cv_renderfloors.value)
|
||||
return;
|
||||
|
||||
HWR_ProcessPolygon(&Surf, planeVerts, nrPlaneVerts, PolyFlags, shader, false);
|
||||
|
||||
if (subsector)
|
||||
|
@ -687,7 +687,7 @@ static void HWR_ProjectWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIEL
|
|||
{
|
||||
INT32 shader = SHADER_NONE;
|
||||
|
||||
if (!cv_renderwalls.value)
|
||||
if (!r_renderwalls)
|
||||
return;
|
||||
|
||||
HWR_Lighting(pSurf, lightlevel, wallcolormap);
|
||||
|
@ -728,7 +728,7 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
|
|||
FUINT lightnum = HWR_CalcWallLight(sector->lightlevel, v1x, v1y, v2x, v2y);
|
||||
extracolormap_t *colormap = NULL;
|
||||
|
||||
if (!cv_renderwalls.value)
|
||||
if (!r_renderwalls)
|
||||
return;
|
||||
|
||||
realtop = top = wallVerts[3].y;
|
||||
|
@ -933,6 +933,191 @@ static boolean HWR_BlendMidtextureSurface(FSurfaceInfo *pSurf)
|
|||
return true;
|
||||
}
|
||||
|
||||
static void HWR_RenderMidtexture(INT32 gl_midtexture, float cliplow, float cliphigh, fixed_t worldtop, fixed_t worldbottom, fixed_t worldhigh, fixed_t worldlow, fixed_t worldtopslope, fixed_t worldbottomslope, fixed_t worldhighslope, fixed_t worldlowslope, UINT32 lightnum, FOutVector *inWallVerts)
|
||||
{
|
||||
FOutVector wallVerts[4];
|
||||
|
||||
FSurfaceInfo Surf;
|
||||
Surf.PolyColor.s.alpha = 255;
|
||||
|
||||
// Determine if it's visible
|
||||
if (!HWR_BlendMidtextureSurface(&Surf))
|
||||
return;
|
||||
|
||||
fixed_t texheight = FixedDiv(textureheight[gl_midtexture], abs(gl_sidedef->scaley_mid));
|
||||
INT32 repeats;
|
||||
|
||||
if (gl_sidedef->repeatcnt)
|
||||
repeats = 1 + gl_sidedef->repeatcnt;
|
||||
else if (gl_linedef->flags & ML_WRAPMIDTEX)
|
||||
{
|
||||
fixed_t high, low;
|
||||
|
||||
if (gl_frontsector->ceilingheight > gl_backsector->ceilingheight)
|
||||
high = gl_backsector->ceilingheight;
|
||||
else
|
||||
high = gl_frontsector->ceilingheight;
|
||||
|
||||
if (gl_frontsector->floorheight > gl_backsector->floorheight)
|
||||
low = gl_frontsector->floorheight;
|
||||
else
|
||||
low = gl_backsector->floorheight;
|
||||
|
||||
repeats = (high - low) / texheight;
|
||||
if ((high - low) % texheight)
|
||||
repeats++; // tile an extra time to fill the gap -- Monster Iestyn
|
||||
}
|
||||
else
|
||||
repeats = 1;
|
||||
|
||||
GLMapTexture_t *grTex = HWR_GetTexture(gl_midtexture);
|
||||
float xscale = FixedToFloat(gl_sidedef->scalex_mid);
|
||||
float yscale = FixedToFloat(gl_sidedef->scaley_mid);
|
||||
|
||||
// SoM: a little note: popentop and popenbottom
|
||||
// record the limits the texture can be displayed in.
|
||||
// polytop and polybottom, are the ideal (i.e. unclipped)
|
||||
// heights of the polygon, and h & l, are the final (clipped)
|
||||
// poly coords.
|
||||
fixed_t popentop, popenbottom, polytop, polybottom, lowcut, highcut;
|
||||
fixed_t popentopslope, popenbottomslope, polytopslope, polybottomslope, lowcutslope, highcutslope;
|
||||
|
||||
// NOTE: With polyobjects, whenever you need to check the properties of the polyobject sector it belongs to,
|
||||
// you must use the linedef's backsector to be correct
|
||||
// From CB
|
||||
if (gl_curline->polyseg)
|
||||
{
|
||||
// Change this when polyobjects support slopes
|
||||
popentop = popentopslope = gl_curline->backsector->ceilingheight;
|
||||
popenbottom = popenbottomslope = gl_curline->backsector->floorheight;
|
||||
}
|
||||
else
|
||||
{
|
||||
popentop = min(worldtop, worldhigh);
|
||||
popenbottom = max(worldbottom, worldlow);
|
||||
popentopslope = min(worldtopslope, worldhighslope);
|
||||
popenbottomslope = max(worldbottomslope, worldlowslope);
|
||||
}
|
||||
|
||||
// Find the wall's coordinates
|
||||
fixed_t midtexheight = texheight * repeats;
|
||||
|
||||
fixed_t rowoffset = FixedDiv(gl_sidedef->rowoffset + gl_sidedef->offsety_mid, abs(gl_sidedef->scaley_mid));
|
||||
|
||||
// Texture is not skewed
|
||||
if (gl_linedef->flags & ML_NOSKEW)
|
||||
{
|
||||
// Peg it to the floor
|
||||
if (gl_linedef->flags & ML_MIDPEG)
|
||||
{
|
||||
polybottom = max(gl_frontsector->floorheight, gl_backsector->floorheight) + rowoffset;
|
||||
polytop = polybottom + midtexheight;
|
||||
}
|
||||
// Peg it to the ceiling
|
||||
else
|
||||
{
|
||||
polytop = min(gl_frontsector->ceilingheight, gl_backsector->ceilingheight) + rowoffset;
|
||||
polybottom = polytop - midtexheight;
|
||||
}
|
||||
|
||||
// The right side's coordinates are the the same as the left side
|
||||
polytopslope = polytop;
|
||||
polybottomslope = polybottom;
|
||||
}
|
||||
// Skew the texture, but peg it to the floor
|
||||
else if (gl_linedef->flags & ML_MIDPEG)
|
||||
{
|
||||
polybottom = popenbottom + rowoffset;
|
||||
polytop = polybottom + midtexheight;
|
||||
polybottomslope = popenbottomslope + rowoffset;
|
||||
polytopslope = polybottomslope + midtexheight;
|
||||
}
|
||||
// Skew it according to the ceiling's slope
|
||||
else
|
||||
{
|
||||
polytop = popentop + rowoffset;
|
||||
polybottom = polytop - midtexheight;
|
||||
polytopslope = popentopslope + rowoffset;
|
||||
polybottomslope = polytopslope - midtexheight;
|
||||
}
|
||||
|
||||
// The cut-off values of a linedef can always be constant, since every line has an absoulute front and or back sector
|
||||
if (gl_curline->polyseg)
|
||||
{
|
||||
lowcut = polybottom;
|
||||
highcut = polytop;
|
||||
lowcutslope = polybottomslope;
|
||||
highcutslope = polytopslope;
|
||||
}
|
||||
else
|
||||
{
|
||||
lowcut = popenbottom;
|
||||
highcut = popentop;
|
||||
lowcutslope = popenbottomslope;
|
||||
highcutslope = popentopslope;
|
||||
}
|
||||
|
||||
fixed_t h = min(highcut, polytop);
|
||||
fixed_t l = max(polybottom, lowcut);
|
||||
fixed_t hS = min(highcutslope, polytopslope);
|
||||
fixed_t lS = max(polybottomslope, lowcutslope);
|
||||
|
||||
// PEGGING
|
||||
fixed_t texturevpeg, texturevpegslope;
|
||||
|
||||
if (gl_linedef->flags & ML_MIDPEG)
|
||||
{
|
||||
texturevpeg = midtexheight - h + polybottom;
|
||||
texturevpegslope = midtexheight - hS + polybottomslope;
|
||||
}
|
||||
else
|
||||
{
|
||||
texturevpeg = polytop - h;
|
||||
texturevpegslope = polytopslope - hS;
|
||||
}
|
||||
|
||||
memcpy(wallVerts, inWallVerts, sizeof(wallVerts));
|
||||
|
||||
// Left side
|
||||
wallVerts[3].t = texturevpeg * yscale * grTex->scaleY;
|
||||
wallVerts[0].t = (h - l + texturevpeg) * yscale * grTex->scaleY;
|
||||
wallVerts[0].s = wallVerts[3].s = ((cliplow * xscale) + gl_sidedef->textureoffset + gl_sidedef->offsetx_mid) * grTex->scaleX;
|
||||
|
||||
// Right side
|
||||
wallVerts[2].t = texturevpegslope * yscale * grTex->scaleY;
|
||||
wallVerts[1].t = (hS - lS + texturevpegslope) * yscale * grTex->scaleY;
|
||||
wallVerts[2].s = wallVerts[1].s = ((cliphigh * xscale) + gl_sidedef->textureoffset + gl_sidedef->offsetx_mid) * grTex->scaleX;
|
||||
|
||||
// set top/bottom coords
|
||||
// Take the texture peg into account, rather than changing the offsets past
|
||||
// where the polygon might not be.
|
||||
wallVerts[3].y = FIXED_TO_FLOAT(h);
|
||||
wallVerts[0].y = FIXED_TO_FLOAT(l);
|
||||
wallVerts[2].y = FIXED_TO_FLOAT(hS);
|
||||
wallVerts[1].y = FIXED_TO_FLOAT(lS);
|
||||
|
||||
// TODO: Actually use the surface's flags so that I don't have to do this
|
||||
FUINT blendmode = Surf.PolyFlags;
|
||||
|
||||
// Render midtextures on two-sided lines with a z-buffer offset.
|
||||
// This will cause the midtexture appear on top, if a FOF overlaps with it.
|
||||
blendmode |= PF_Decal;
|
||||
|
||||
extracolormap_t *colormap = gl_frontsector->extra_colormap;
|
||||
|
||||
if (gl_frontsector->numlights)
|
||||
{
|
||||
if (!(blendmode & PF_Masked))
|
||||
HWR_SplitWall(gl_frontsector, wallVerts, gl_midtexture, &Surf, FOF_TRANSLUCENT, NULL, blendmode);
|
||||
else
|
||||
HWR_SplitWall(gl_frontsector, wallVerts, gl_midtexture, &Surf, FOF_CUTLEVEL, NULL, blendmode);
|
||||
}
|
||||
else if (!(blendmode & PF_Masked))
|
||||
HWR_AddTransparentWall(wallVerts, &Surf, gl_midtexture, blendmode, false, lightnum, colormap);
|
||||
else
|
||||
HWR_ProjectWall(wallVerts, &Surf, blendmode, lightnum, colormap);
|
||||
}
|
||||
|
||||
// Sort of like GLWall::Process in GZDoom
|
||||
static void HWR_ProcessSeg(void)
|
||||
{
|
||||
|
@ -998,9 +1183,8 @@ static void HWR_ProcessSeg(void)
|
|||
wallVerts[2].z = wallVerts[1].z = ve.y;
|
||||
|
||||
// x offset the texture
|
||||
fixed_t texturehpeg = gl_sidedef->textureoffset + gl_curline->offset;
|
||||
float cliplow = (float)texturehpeg;
|
||||
float cliphigh = (float)(texturehpeg + (gl_curline->flength*FRACUNIT));
|
||||
float cliplow = (float)gl_curline->offset;
|
||||
float cliphigh = cliplow + (gl_curline->flength * FRACUNIT);
|
||||
|
||||
FUINT lightnum = gl_frontsector->lightlevel;
|
||||
extracolormap_t *colormap = gl_frontsector->extra_colormap;
|
||||
|
@ -1016,6 +1200,7 @@ static void HWR_ProcessSeg(void)
|
|||
if (gl_backsector)
|
||||
{
|
||||
INT32 gl_toptexture = 0, gl_bottomtexture = 0;
|
||||
|
||||
fixed_t texturevpeg;
|
||||
|
||||
SLOPEPARAMS(gl_backsector->c_slope, worldhigh, worldhighslope, gl_backsector->ceilingheight)
|
||||
|
@ -1045,30 +1230,46 @@ static void HWR_ProcessSeg(void)
|
|||
if ((worldhighslope < worldtopslope || worldhigh < worldtop) && gl_toptexture)
|
||||
{
|
||||
grTex = HWR_GetTexture(gl_toptexture);
|
||||
xscale = FixedToFloat(gl_sidedef->scalex_top);
|
||||
yscale = FixedToFloat(gl_sidedef->scaley_top);
|
||||
xscale = FixedToFloat(abs(gl_sidedef->scalex_top));
|
||||
yscale = FixedToFloat(abs(gl_sidedef->scaley_top));
|
||||
|
||||
fixed_t texheight = FixedDiv(textureheight[gl_toptexture], gl_sidedef->scaley_top);
|
||||
fixed_t offsetx_top = gl_sidedef->textureoffset + gl_sidedef->offsetx_top;
|
||||
|
||||
float left = cliplow * xscale;
|
||||
float right = cliphigh * xscale;
|
||||
if (gl_sidedef->scalex_top < 0)
|
||||
{
|
||||
left = -left;
|
||||
right = -right;
|
||||
offsetx_top = -offsetx_top;
|
||||
}
|
||||
|
||||
fixed_t texheight = textureheight[gl_toptexture];
|
||||
fixed_t texheightscaled = FixedDiv(texheight, abs(gl_sidedef->scaley_top));
|
||||
|
||||
// PEGGING
|
||||
// FIXME: This is probably not correct?
|
||||
if (gl_linedef->flags & ML_DONTPEGTOP)
|
||||
texturevpeg = 0;
|
||||
else if (gl_linedef->flags & ML_SKEWTD)
|
||||
texturevpeg = worldhigh + texheight - worldtop;
|
||||
else
|
||||
texturevpeg = gl_backsector->ceilingheight + texheight - gl_frontsector->ceilingheight;
|
||||
texturevpeg = gl_backsector->ceilingheight + texheightscaled - gl_frontsector->ceilingheight;
|
||||
|
||||
texturevpeg *= yscale;
|
||||
|
||||
texturevpeg += gl_sidedef->rowoffset + gl_sidedef->offsety_top;
|
||||
if (gl_sidedef->scaley_top < 0)
|
||||
texturevpeg -= gl_sidedef->rowoffset + gl_sidedef->offsety_top;
|
||||
else
|
||||
texturevpeg += gl_sidedef->rowoffset + gl_sidedef->offsety_top;
|
||||
|
||||
// This is so that it doesn't overflow and screw up the wall, it doesn't need to go higher than the texture's height anyway
|
||||
texturevpeg %= texheight;
|
||||
texturevpeg %= texheightscaled;
|
||||
|
||||
wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY;
|
||||
wallVerts[0].t = wallVerts[1].t = (texturevpeg + (gl_frontsector->ceilingheight - gl_backsector->ceilingheight) * yscale) * grTex->scaleY;
|
||||
wallVerts[0].s = wallVerts[3].s = ((cliplow * xscale) + gl_sidedef->offsetx_top) * grTex->scaleX;
|
||||
wallVerts[2].s = wallVerts[1].s = ((cliphigh * xscale) + gl_sidedef->offsetx_top) * grTex->scaleX;
|
||||
wallVerts[0].s = wallVerts[3].s = (left + offsetx_top) * grTex->scaleX;
|
||||
wallVerts[2].s = wallVerts[1].s = (right + offsetx_top) * grTex->scaleX;
|
||||
|
||||
// Adjust t value for sloped walls
|
||||
if (!(gl_linedef->flags & ML_SKEWTD))
|
||||
|
@ -1093,6 +1294,14 @@ static void HWR_ProcessSeg(void)
|
|||
wallVerts[2].t = wallVerts[1].t - (worldtopslope - worldhighslope) * yscale * grTex->scaleY;
|
||||
}
|
||||
|
||||
if (gl_sidedef->scaley_top < 0)
|
||||
{
|
||||
wallVerts[0].t = -wallVerts[0].t;
|
||||
wallVerts[1].t = -wallVerts[1].t;
|
||||
wallVerts[2].t = -wallVerts[2].t;
|
||||
wallVerts[3].t = -wallVerts[3].t;
|
||||
}
|
||||
|
||||
// set top/bottom coords
|
||||
wallVerts[3].y = FIXED_TO_FLOAT(worldtop);
|
||||
wallVerts[0].y = FIXED_TO_FLOAT(worldhigh);
|
||||
|
@ -1111,8 +1320,19 @@ static void HWR_ProcessSeg(void)
|
|||
if ((worldlowslope > worldbottomslope || worldlow > worldbottom) && gl_bottomtexture)
|
||||
{
|
||||
grTex = HWR_GetTexture(gl_bottomtexture);
|
||||
xscale = FixedToFloat(gl_sidedef->scalex_bottom);
|
||||
yscale = FixedToFloat(gl_sidedef->scaley_bottom);
|
||||
xscale = FixedToFloat(abs(gl_sidedef->scalex_bottom));
|
||||
yscale = FixedToFloat(abs(gl_sidedef->scaley_bottom));
|
||||
|
||||
fixed_t offsetx_bottom = gl_sidedef->textureoffset + gl_sidedef->offsetx_bottom;
|
||||
|
||||
float left = cliplow * xscale;
|
||||
float right = cliphigh * xscale;
|
||||
if (gl_sidedef->scalex_bottom < 0)
|
||||
{
|
||||
left = -left;
|
||||
right = -right;
|
||||
offsetx_bottom = -offsetx_bottom;
|
||||
}
|
||||
|
||||
// PEGGING
|
||||
if (!(gl_linedef->flags & ML_DONTPEGBOTTOM))
|
||||
|
@ -1124,15 +1344,18 @@ static void HWR_ProcessSeg(void)
|
|||
|
||||
texturevpeg *= yscale;
|
||||
|
||||
texturevpeg += gl_sidedef->rowoffset + gl_sidedef->offsety_bottom;
|
||||
if (gl_sidedef->scaley_bottom < 0)
|
||||
texturevpeg -= gl_sidedef->rowoffset + gl_sidedef->offsety_bottom;
|
||||
else
|
||||
texturevpeg += gl_sidedef->rowoffset + gl_sidedef->offsety_bottom;
|
||||
|
||||
// This is so that it doesn't overflow and screw up the wall, it doesn't need to go higher than the texture's height anyway
|
||||
texturevpeg %= FixedDiv(textureheight[gl_bottomtexture], gl_sidedef->scaley_bottom);
|
||||
texturevpeg %= FixedDiv(textureheight[gl_bottomtexture], abs(gl_sidedef->scaley_bottom));
|
||||
|
||||
wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY;
|
||||
wallVerts[0].t = wallVerts[1].t = (texturevpeg + (gl_backsector->floorheight - gl_frontsector->floorheight) * yscale) * grTex->scaleY;
|
||||
wallVerts[0].s = wallVerts[3].s = ((cliplow * xscale) + gl_sidedef->offsetx_bottom) * grTex->scaleX;
|
||||
wallVerts[2].s = wallVerts[1].s = ((cliphigh * xscale) + gl_sidedef->offsetx_bottom) * grTex->scaleX;
|
||||
wallVerts[0].s = wallVerts[3].s = (left + offsetx_bottom) * grTex->scaleX;
|
||||
wallVerts[2].s = wallVerts[1].s = (right + offsetx_bottom) * grTex->scaleX;
|
||||
|
||||
// Adjust t value for sloped walls
|
||||
if (!(gl_linedef->flags & ML_SKEWTD))
|
||||
|
@ -1156,6 +1379,14 @@ static void HWR_ProcessSeg(void)
|
|||
wallVerts[1].t = (texturevpeg + (worldlowslope - worldbottomslope) * yscale) * grTex->scaleY;
|
||||
}
|
||||
|
||||
if (gl_sidedef->scaley_bottom < 0)
|
||||
{
|
||||
wallVerts[0].t = -wallVerts[0].t;
|
||||
wallVerts[1].t = -wallVerts[1].t;
|
||||
wallVerts[2].t = -wallVerts[2].t;
|
||||
wallVerts[3].t = -wallVerts[3].t;
|
||||
}
|
||||
|
||||
// set top/bottom coords
|
||||
wallVerts[3].y = FIXED_TO_FLOAT(worldlow);
|
||||
wallVerts[0].y = FIXED_TO_FLOAT(worldbottom);
|
||||
|
@ -1170,196 +1401,14 @@ static void HWR_ProcessSeg(void)
|
|||
HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap);
|
||||
}
|
||||
|
||||
// Render midtexture if there's one. Determine if it's visible first, though
|
||||
if (gl_midtexture && HWR_BlendMidtextureSurface(&Surf))
|
||||
{
|
||||
sector_t *front, *back;
|
||||
fixed_t texheight = FixedDiv(textureheight[gl_midtexture], gl_sidedef->scaley_mid);
|
||||
INT32 repeats;
|
||||
// Render midtexture if there's one
|
||||
if (gl_midtexture)
|
||||
HWR_RenderMidtexture(gl_midtexture, cliplow, cliphigh, worldtop, worldbottom, worldhigh, worldlow, worldtopslope, worldbottomslope, worldhighslope, worldlowslope, lightnum, wallVerts);
|
||||
|
||||
if (gl_linedef->frontsector->heightsec != -1)
|
||||
front = §ors[gl_linedef->frontsector->heightsec];
|
||||
else
|
||||
front = gl_linedef->frontsector;
|
||||
|
||||
if (gl_linedef->backsector->heightsec != -1)
|
||||
back = §ors[gl_linedef->backsector->heightsec];
|
||||
else
|
||||
back = gl_linedef->backsector;
|
||||
|
||||
if (gl_sidedef->repeatcnt)
|
||||
repeats = 1 + gl_sidedef->repeatcnt;
|
||||
else if (gl_linedef->flags & ML_WRAPMIDTEX)
|
||||
{
|
||||
fixed_t high, low;
|
||||
|
||||
if (front->ceilingheight > back->ceilingheight)
|
||||
high = back->ceilingheight;
|
||||
else
|
||||
high = front->ceilingheight;
|
||||
|
||||
if (front->floorheight > back->floorheight)
|
||||
low = front->floorheight;
|
||||
else
|
||||
low = back->floorheight;
|
||||
|
||||
repeats = (high - low) / texheight;
|
||||
if ((high - low) % texheight)
|
||||
repeats++; // tile an extra time to fill the gap -- Monster Iestyn
|
||||
}
|
||||
else
|
||||
repeats = 1;
|
||||
|
||||
grTex = HWR_GetTexture(gl_midtexture);
|
||||
xscale = FixedToFloat(gl_sidedef->scalex_mid);
|
||||
yscale = FixedToFloat(gl_sidedef->scaley_mid);
|
||||
|
||||
// SoM: a little note: popentop and popenbottom
|
||||
// record the limits the texture can be displayed in.
|
||||
// polytop and polybottom, are the ideal (i.e. unclipped)
|
||||
// heights of the polygon, and h & l, are the final (clipped)
|
||||
// poly coords.
|
||||
fixed_t popentop, popenbottom, polytop, polybottom, lowcut, highcut;
|
||||
fixed_t popentopslope, popenbottomslope, polytopslope, polybottomslope, lowcutslope, highcutslope;
|
||||
|
||||
// NOTE: With polyobjects, whenever you need to check the properties of the polyobject sector it belongs to,
|
||||
// you must use the linedef's backsector to be correct
|
||||
// From CB
|
||||
if (gl_curline->polyseg)
|
||||
{
|
||||
popentop = popentopslope = back->ceilingheight;
|
||||
popenbottom = popenbottomslope = back->floorheight;
|
||||
}
|
||||
else
|
||||
{
|
||||
popentop = min(worldtop, worldhigh);
|
||||
popenbottom = max(worldbottom, worldlow);
|
||||
popentopslope = min(worldtopslope, worldhighslope);
|
||||
popenbottomslope = max(worldbottomslope, worldlowslope);
|
||||
}
|
||||
|
||||
// Find the wall's coordinates
|
||||
fixed_t midtexheight = texheight * repeats;
|
||||
|
||||
fixed_t rowoffset = FixedDiv(gl_sidedef->rowoffset + gl_sidedef->offsety_mid, gl_sidedef->scaley_mid);
|
||||
|
||||
// Texture is not skewed
|
||||
if (gl_linedef->flags & ML_NOSKEW)
|
||||
{
|
||||
// Peg it to the floor
|
||||
if (gl_linedef->flags & ML_MIDPEG)
|
||||
{
|
||||
polybottom = max(front->floorheight, back->floorheight) + rowoffset;
|
||||
polytop = polybottom + midtexheight;
|
||||
}
|
||||
// Peg it to the ceiling
|
||||
else
|
||||
{
|
||||
polytop = min(front->ceilingheight, back->ceilingheight) + rowoffset;
|
||||
polybottom = polytop - midtexheight;
|
||||
}
|
||||
|
||||
// The right side's coordinates are the the same as the left side
|
||||
polytopslope = polytop;
|
||||
polybottomslope = polybottom;
|
||||
}
|
||||
// Skew the texture, but peg it to the floor
|
||||
else if (gl_linedef->flags & ML_MIDPEG)
|
||||
{
|
||||
polybottom = popenbottom + rowoffset;
|
||||
polytop = polybottom + midtexheight;
|
||||
polybottomslope = popenbottomslope + rowoffset;
|
||||
polytopslope = polybottomslope + midtexheight;
|
||||
}
|
||||
// Skew it according to the ceiling's slope
|
||||
else
|
||||
{
|
||||
polytop = popentop + rowoffset;
|
||||
polybottom = polytop - midtexheight;
|
||||
polytopslope = popentopslope + rowoffset;
|
||||
polybottomslope = polytopslope - midtexheight;
|
||||
}
|
||||
|
||||
// CB
|
||||
// NOTE: With polyobjects, whenever you need to check the properties of the polyobject sector it belongs to,
|
||||
// you must use the linedef's backsector to be correct
|
||||
if (gl_curline->polyseg)
|
||||
{
|
||||
lowcut = polybottom;
|
||||
highcut = polytop;
|
||||
lowcutslope = polybottomslope;
|
||||
highcutslope = polytopslope;
|
||||
}
|
||||
else
|
||||
{
|
||||
// The cut-off values of a linedef can always be constant, since every line has an absoulute front and or back sector
|
||||
lowcut = popenbottom;
|
||||
highcut = popentop;
|
||||
lowcutslope = popenbottomslope;
|
||||
highcutslope = popentopslope;
|
||||
}
|
||||
|
||||
h = min(highcut, polytop);
|
||||
l = max(polybottom, lowcut);
|
||||
hS = min(highcutslope, polytopslope);
|
||||
lS = max(polybottomslope, lowcutslope);
|
||||
|
||||
// PEGGING
|
||||
fixed_t texturevpegslope;
|
||||
|
||||
if (gl_linedef->flags & ML_MIDPEG)
|
||||
{
|
||||
texturevpeg = midtexheight - h + polybottom;
|
||||
texturevpegslope = midtexheight - hS + polybottomslope;
|
||||
}
|
||||
else
|
||||
{
|
||||
texturevpeg = polytop - h;
|
||||
texturevpegslope = polytopslope - hS;
|
||||
}
|
||||
|
||||
// Left side
|
||||
wallVerts[3].t = texturevpeg * yscale * grTex->scaleY;
|
||||
wallVerts[0].t = (h - l + texturevpeg) * yscale * grTex->scaleY;
|
||||
wallVerts[0].s = wallVerts[3].s = ((cliplow * xscale) + gl_sidedef->offsetx_mid) * grTex->scaleX;
|
||||
|
||||
// Right side
|
||||
wallVerts[2].t = texturevpegslope * yscale * grTex->scaleY;
|
||||
wallVerts[1].t = (hS - lS + texturevpegslope) * yscale * grTex->scaleY;
|
||||
wallVerts[2].s = wallVerts[1].s = ((cliphigh * xscale) + gl_sidedef->offsetx_mid) * grTex->scaleX;
|
||||
|
||||
// set top/bottom coords
|
||||
// Take the texture peg into account, rather than changing the offsets past
|
||||
// where the polygon might not be.
|
||||
wallVerts[3].y = FIXED_TO_FLOAT(h);
|
||||
wallVerts[0].y = FIXED_TO_FLOAT(l);
|
||||
wallVerts[2].y = FIXED_TO_FLOAT(hS);
|
||||
wallVerts[1].y = FIXED_TO_FLOAT(lS);
|
||||
|
||||
// TODO: Actually use the surface's flags so that I don't have to do this
|
||||
FUINT blendmode = Surf.PolyFlags;
|
||||
|
||||
// Render midtextures on two-sided lines with a z-buffer offset.
|
||||
// This will cause the midtexture appear on top, if a FOF overlaps with it.
|
||||
blendmode |= PF_Decal;
|
||||
|
||||
if (gl_frontsector->numlights)
|
||||
{
|
||||
if (!(blendmode & PF_Masked))
|
||||
HWR_SplitWall(gl_frontsector, wallVerts, gl_midtexture, &Surf, FOF_TRANSLUCENT, NULL, blendmode);
|
||||
else
|
||||
HWR_SplitWall(gl_frontsector, wallVerts, gl_midtexture, &Surf, FOF_CUTLEVEL, NULL, blendmode);
|
||||
}
|
||||
else if (!(blendmode & PF_Masked))
|
||||
HWR_AddTransparentWall(wallVerts, &Surf, gl_midtexture, blendmode, false, lightnum, colormap);
|
||||
else
|
||||
HWR_ProjectWall(wallVerts, &Surf, blendmode, lightnum, colormap);
|
||||
}
|
||||
|
||||
// Sky culling
|
||||
// No longer so much a mess as before!
|
||||
if (!gl_curline->polyseg) // Don't do it for polyobjects
|
||||
{
|
||||
// Sky culling
|
||||
// No longer so much a mess as before!
|
||||
if (gl_frontsector->ceilingpic == skyflatnum
|
||||
&& gl_backsector->ceilingpic != skyflatnum) // don't cull if back sector is also sky
|
||||
{
|
||||
|
@ -1403,8 +1452,8 @@ static void HWR_ProcessSeg(void)
|
|||
|
||||
wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY;
|
||||
wallVerts[0].t = wallVerts[1].t = (texturevpeg + gl_frontsector->ceilingheight - gl_frontsector->floorheight) * grTex->scaleY;
|
||||
wallVerts[0].s = wallVerts[3].s = ((cliplow * xscale) + gl_sidedef->offsetx_mid) * grTex->scaleX;
|
||||
wallVerts[2].s = wallVerts[1].s = ((cliphigh * xscale) + gl_sidedef->offsetx_mid) * grTex->scaleX;
|
||||
wallVerts[0].s = wallVerts[3].s = ((cliplow * xscale) + gl_sidedef->textureoffset + gl_sidedef->offsetx_mid) * grTex->scaleX;
|
||||
wallVerts[2].s = wallVerts[1].s = ((cliphigh * xscale) + gl_sidedef->textureoffset + gl_sidedef->offsetx_mid) * grTex->scaleX;
|
||||
|
||||
// Texture correction for slopes
|
||||
if (gl_linedef->flags & ML_NOSKEW) {
|
||||
|
@ -1467,8 +1516,9 @@ static void HWR_ProcessSeg(void)
|
|||
// Used for height comparisons and etc across FOFs and slopes
|
||||
fixed_t high1, highslope1, low1, lowslope1;
|
||||
|
||||
fixed_t texturehpeg = gl_sidedef->textureoffset + gl_sidedef->offsetx_mid;
|
||||
|
||||
INT32 texnum;
|
||||
line_t * newline = NULL; // Multi-Property FOF
|
||||
|
||||
lowcut = max(worldbottom, worldlow);
|
||||
highcut = min(worldtop, worldhigh);
|
||||
|
@ -1502,16 +1552,14 @@ static void HWR_ProcessSeg(void)
|
|||
if ((high1 < lowcut && highslope1 < lowcutslope) || (low1 > highcut && lowslope1 > highcutslope))
|
||||
continue;
|
||||
|
||||
side_t *side = &sides[rover->master->sidenum[0]];
|
||||
side_t *side = R_GetFFloorSide(gl_curline, rover);
|
||||
|
||||
boolean do_texture_skew;
|
||||
boolean dont_peg_bottom;
|
||||
|
||||
if (rover->master->flags & ML_TFERLINE)
|
||||
{
|
||||
size_t linenum = gl_curline->linedef-gl_backsector->lines[0];
|
||||
newline = rover->master->frontsector->lines[0] + linenum;
|
||||
side = &sides[newline->sidenum[0]];
|
||||
line_t *newline = R_GetFFloorLine(gl_curline, rover);
|
||||
do_texture_skew = newline->flags & ML_SKEWTD;
|
||||
dont_peg_bottom = newline->flags & ML_DONTPEGBOTTOM;
|
||||
}
|
||||
|
@ -1589,14 +1637,14 @@ static void HWR_ProcessSeg(void)
|
|||
}
|
||||
}
|
||||
|
||||
wallVerts[0].s = wallVerts[3].s = ((cliplow * xscale) + side->offsetx_mid) * grTex->scaleX;
|
||||
wallVerts[2].s = wallVerts[1].s = ((cliphigh * xscale) + side->offsetx_mid) * grTex->scaleX;
|
||||
wallVerts[0].s = wallVerts[3].s = ((cliplow * xscale) + texturehpeg + side->offsetx_mid) * grTex->scaleX;
|
||||
wallVerts[2].s = wallVerts[1].s = ((cliphigh * xscale) + texturehpeg + side->offsetx_mid) * grTex->scaleX;
|
||||
}
|
||||
|
||||
FBITFIELD blendmode;
|
||||
|
||||
if (rover->fofflags & FOF_FOG)
|
||||
{
|
||||
FBITFIELD blendmode;
|
||||
|
||||
blendmode = PF_Fog|PF_NoTexture;
|
||||
|
||||
lightnum = rover->master->frontsector->lightlevel;
|
||||
|
@ -1612,7 +1660,7 @@ static void HWR_ProcessSeg(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
FBITFIELD blendmode = PF_Masked;
|
||||
blendmode = PF_Masked;
|
||||
|
||||
if ((rover->fofflags & FOF_TRANSLUCENT && !(rover->fofflags & FOF_SPLAT)) || rover->blend)
|
||||
{
|
||||
|
@ -1660,13 +1708,21 @@ static void HWR_ProcessSeg(void)
|
|||
if ((high1 < lowcut && highslope1 < lowcutslope) || (low1 > highcut && lowslope1 > highcutslope))
|
||||
continue;
|
||||
|
||||
side_t *side = &sides[rover->master->sidenum[0]];
|
||||
side_t *side = R_GetFFloorSide(gl_curline, rover);
|
||||
|
||||
boolean do_texture_skew;
|
||||
boolean dont_peg_bottom;
|
||||
|
||||
if (rover->master->flags & ML_TFERLINE)
|
||||
{
|
||||
size_t linenum = gl_curline->linedef-gl_backsector->lines[0];
|
||||
newline = rover->master->frontsector->lines[0] + linenum;
|
||||
side = &sides[newline->sidenum[0]];
|
||||
line_t *newline = R_GetFFloorLine(gl_curline, rover);
|
||||
do_texture_skew = newline->flags & ML_SKEWTD;
|
||||
dont_peg_bottom = newline->flags & ML_DONTPEGBOTTOM;
|
||||
}
|
||||
else
|
||||
{
|
||||
do_texture_skew = rover->master->flags & ML_SKEWTD;
|
||||
dont_peg_bottom = gl_curline->linedef->flags & ML_DONTPEGBOTTOM;
|
||||
}
|
||||
|
||||
texnum = R_GetTextureNum(side->midtexture);
|
||||
|
@ -1703,23 +1759,49 @@ static void HWR_ProcessSeg(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
// Wow, how was this missing from OpenGL for so long?
|
||||
// ...Oh well, anyway, Lower Unpegged now changes pegging of FOFs like in software
|
||||
// -- Monster Iestyn 26/06/18
|
||||
fixed_t texturevpeg = side->rowoffset + side->offsety_mid;
|
||||
|
||||
grTex = HWR_GetTexture(texnum);
|
||||
xscale = FixedToFloat(side->scalex_mid);
|
||||
yscale = FixedToFloat(side->scaley_mid);
|
||||
|
||||
fixed_t diff = (*rover->topheight - h) * yscale;
|
||||
if (!do_texture_skew) // no skewing
|
||||
{
|
||||
if (dont_peg_bottom)
|
||||
texturevpeg -= (*rover->topheight - *rover->bottomheight) * yscale;
|
||||
|
||||
wallVerts[3].t = wallVerts[2].t = (diff + side->rowoffset + side->offsety_mid) * grTex->scaleY;
|
||||
wallVerts[0].t = wallVerts[1].t = (((h - l) * yscale) + (diff + side->rowoffset + side->offsety_mid)) * grTex->scaleY;
|
||||
wallVerts[3].t = (((*rover->topheight - h) * yscale) + texturevpeg) * grTex->scaleY;
|
||||
wallVerts[2].t = (((*rover->topheight - hS) * yscale) + texturevpeg) * grTex->scaleY;
|
||||
wallVerts[0].t = (((*rover->topheight - l) * yscale) + texturevpeg) * grTex->scaleY;
|
||||
wallVerts[1].t = (((*rover->topheight - lS) * yscale) + texturevpeg) * grTex->scaleY;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!dont_peg_bottom) // skew by top
|
||||
{
|
||||
wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY;
|
||||
wallVerts[0].t = (((h - l) * yscale) + texturevpeg) * grTex->scaleY;
|
||||
wallVerts[1].t = (((hS - lS) * yscale) + texturevpeg) * grTex->scaleY;
|
||||
}
|
||||
else // skew by bottom
|
||||
{
|
||||
wallVerts[0].t = wallVerts[1].t = texturevpeg * grTex->scaleY;
|
||||
wallVerts[3].t = wallVerts[0].t - ((h - l) * yscale) * grTex->scaleY;
|
||||
wallVerts[2].t = wallVerts[1].t - ((hS - lS) * yscale) * grTex->scaleY;
|
||||
}
|
||||
}
|
||||
|
||||
wallVerts[0].s = wallVerts[3].s = ((cliplow * xscale) + side->offsetx_mid) * grTex->scaleX;
|
||||
wallVerts[2].s = wallVerts[1].s = ((cliphigh * xscale) + side->offsetx_mid) * grTex->scaleX;
|
||||
wallVerts[0].s = wallVerts[3].s = ((cliplow * xscale) + texturehpeg + side->offsetx_mid) * grTex->scaleX;
|
||||
wallVerts[2].s = wallVerts[1].s = ((cliphigh * xscale) + texturehpeg + side->offsetx_mid) * grTex->scaleX;
|
||||
}
|
||||
|
||||
FBITFIELD blendmode;
|
||||
|
||||
if (rover->fofflags & FOF_FOG)
|
||||
{
|
||||
FBITFIELD blendmode;
|
||||
|
||||
blendmode = PF_Fog|PF_NoTexture;
|
||||
|
||||
lightnum = rover->master->frontsector->lightlevel;
|
||||
|
@ -1735,7 +1817,7 @@ static void HWR_ProcessSeg(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
FBITFIELD blendmode = PF_Masked;
|
||||
blendmode = PF_Masked;
|
||||
|
||||
if ((rover->fofflags & FOF_TRANSLUCENT && !(rover->fofflags & FOF_SPLAT)) || rover->blend)
|
||||
{
|
||||
|
@ -2013,36 +2095,14 @@ static boolean HWR_CheckBBox(fixed_t *bspcoord)
|
|||
static inline void HWR_AddPolyObjectSegs(void)
|
||||
{
|
||||
size_t i, j;
|
||||
seg_t *gl_fakeline = Z_Calloc(sizeof(seg_t), PU_STATIC, NULL);
|
||||
polyvertex_t *pv1 = Z_Calloc(sizeof(polyvertex_t), PU_STATIC, NULL);
|
||||
polyvertex_t *pv2 = Z_Calloc(sizeof(polyvertex_t), PU_STATIC, NULL);
|
||||
|
||||
// Sort through all the polyobjects
|
||||
for (i = 0; i < numpolys; ++i)
|
||||
{
|
||||
// Render the polyobject's lines
|
||||
for (j = 0; j < po_ptrs[i]->segCount; ++j)
|
||||
{
|
||||
// Copy the info of a polyobject's seg, then convert it to OpenGL floating point
|
||||
M_Memcpy(gl_fakeline, po_ptrs[i]->segs[j], sizeof(seg_t));
|
||||
|
||||
// Now convert the line to float and add it to be rendered
|
||||
pv1->x = FIXED_TO_FLOAT(gl_fakeline->v1->x);
|
||||
pv1->y = FIXED_TO_FLOAT(gl_fakeline->v1->y);
|
||||
pv2->x = FIXED_TO_FLOAT(gl_fakeline->v2->x);
|
||||
pv2->y = FIXED_TO_FLOAT(gl_fakeline->v2->y);
|
||||
|
||||
gl_fakeline->pv1 = pv1;
|
||||
gl_fakeline->pv2 = pv2;
|
||||
|
||||
HWR_AddLine(gl_fakeline);
|
||||
}
|
||||
HWR_AddLine(po_ptrs[i]->segs[j]);
|
||||
}
|
||||
|
||||
// Free temporary data no longer needed
|
||||
Z_Free(pv2);
|
||||
Z_Free(pv1);
|
||||
Z_Free(gl_fakeline);
|
||||
}
|
||||
|
||||
static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, fixed_t fixedheight,
|
||||
|
@ -2067,13 +2127,8 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
|
|||
static FOutVector *planeVerts = NULL;
|
||||
static UINT16 numAllocedPlaneVerts = 0;
|
||||
|
||||
if (nrPlaneVerts < 3) // Not even a triangle?
|
||||
if (!r_renderfloors || nrPlaneVerts < 3) // Not even a triangle?
|
||||
return;
|
||||
else if (nrPlaneVerts > (size_t)UINT16_MAX) // FIXME: exceeds plVerts size
|
||||
{
|
||||
CONS_Debug(DBG_RENDER, "polygon size of %s exceeds max value of %d vertices\n", sizeu1(nrPlaneVerts), UINT16_MAX);
|
||||
return;
|
||||
}
|
||||
|
||||
// Allocate plane-vertex buffer if we need to
|
||||
if (!planeVerts || nrPlaneVerts > numAllocedPlaneVerts)
|
||||
|
@ -2216,7 +2271,7 @@ static void HWR_AddPolyObjectPlanes(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
HWR_GetLevelFlat(&levelflats[polyobjsector->floorpic]);
|
||||
HWR_GetLevelFlat(&levelflats[polyobjsector->floorpic], false);
|
||||
HWR_RenderPolyObjectPlane(po_ptrs[i], false, polyobjsector->floorheight, PF_Occlude,
|
||||
(light == -1 ? gl_frontsector->lightlevel : *gl_frontsector->lightlist[light].lightlevel), &levelflats[polyobjsector->floorpic],
|
||||
polyobjsector, 255, (light == -1 ? gl_frontsector->extra_colormap : *gl_frontsector->lightlist[light].extra_colormap));
|
||||
|
@ -2239,7 +2294,7 @@ static void HWR_AddPolyObjectPlanes(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
HWR_GetLevelFlat(&levelflats[polyobjsector->ceilingpic]);
|
||||
HWR_GetLevelFlat(&levelflats[polyobjsector->ceilingpic], false);
|
||||
HWR_RenderPolyObjectPlane(po_ptrs[i], true, polyobjsector->ceilingheight, PF_Occlude,
|
||||
(light == -1 ? gl_frontsector->lightlevel : *gl_frontsector->lightlist[light].lightlevel), &levelflats[polyobjsector->ceilingpic],
|
||||
polyobjsector, 255, (light == -1 ? gl_frontsector->extra_colormap : *gl_frontsector->lightlist[light].extra_colormap));
|
||||
|
@ -2369,7 +2424,7 @@ static void HWR_Subsector(size_t num)
|
|||
{
|
||||
if (sub->validcount != validcount)
|
||||
{
|
||||
HWR_GetLevelFlat(&levelflats[gl_frontsector->floorpic]);
|
||||
HWR_GetLevelFlat(&levelflats[gl_frontsector->floorpic], false);
|
||||
HWR_RenderPlane(sub, &extrasubsectors[num], false,
|
||||
// Hack to make things continue to work around slopes.
|
||||
locFloorHeight == cullFloorHeight ? locFloorHeight : gl_frontsector->floorheight,
|
||||
|
@ -2385,7 +2440,7 @@ static void HWR_Subsector(size_t num)
|
|||
{
|
||||
if (sub->validcount != validcount)
|
||||
{
|
||||
HWR_GetLevelFlat(&levelflats[gl_frontsector->ceilingpic]);
|
||||
HWR_GetLevelFlat(&levelflats[gl_frontsector->ceilingpic], false);
|
||||
HWR_RenderPlane(sub, &extrasubsectors[num], true,
|
||||
// Hack to make things continue to work around slopes.
|
||||
locCeilingHeight == cullCeilingHeight ? locCeilingHeight : gl_frontsector->ceilingheight,
|
||||
|
@ -2443,7 +2498,7 @@ static void HWR_Subsector(size_t num)
|
|||
*rover->bottomheight,
|
||||
*gl_frontsector->lightlist[light].lightlevel,
|
||||
alpha, rover->master->frontsector, PF_Fog|PF_NoTexture,
|
||||
true, rover->master->frontsector->extra_colormap);
|
||||
true, false, rover->master->frontsector->extra_colormap);
|
||||
}
|
||||
else if ((rover->fofflags & FOF_TRANSLUCENT && !(rover->fofflags & FOF_SPLAT)) || rover->blend) // SoM: Flags are more efficient
|
||||
{
|
||||
|
@ -2456,11 +2511,11 @@ static void HWR_Subsector(size_t num)
|
|||
*gl_frontsector->lightlist[light].lightlevel,
|
||||
max(0, min(rover->alpha, 255)), rover->master->frontsector,
|
||||
HWR_RippleBlend(gl_frontsector, rover, false) | (rover->blend ? HWR_GetBlendModeFlag(rover->blend) : PF_Translucent),
|
||||
false, *gl_frontsector->lightlist[light].extra_colormap);
|
||||
false, rover->fofflags & FOF_SPLAT, *gl_frontsector->lightlist[light].extra_colormap);
|
||||
}
|
||||
else
|
||||
{
|
||||
HWR_GetLevelFlat(&levelflats[*rover->bottompic]);
|
||||
HWR_GetLevelFlat(&levelflats[*rover->bottompic], rover->fofflags & FOF_SPLAT);
|
||||
light = R_GetPlaneLight(gl_frontsector, centerHeight, viewz < bottomCullHeight ? true : false);
|
||||
HWR_RenderPlane(sub, &extrasubsectors[num], false, *rover->bottomheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, &levelflats[*rover->bottompic],
|
||||
rover->master->frontsector, 255, *gl_frontsector->lightlist[light].extra_colormap);
|
||||
|
@ -2488,7 +2543,7 @@ static void HWR_Subsector(size_t num)
|
|||
*rover->topheight,
|
||||
*gl_frontsector->lightlist[light].lightlevel,
|
||||
alpha, rover->master->frontsector, PF_Fog|PF_NoTexture,
|
||||
true, rover->master->frontsector->extra_colormap);
|
||||
true, false, rover->master->frontsector->extra_colormap);
|
||||
}
|
||||
else if ((rover->fofflags & FOF_TRANSLUCENT && !(rover->fofflags & FOF_SPLAT)) || rover->blend)
|
||||
{
|
||||
|
@ -2501,11 +2556,11 @@ static void HWR_Subsector(size_t num)
|
|||
*gl_frontsector->lightlist[light].lightlevel,
|
||||
max(0, min(rover->alpha, 255)), rover->master->frontsector,
|
||||
HWR_RippleBlend(gl_frontsector, rover, false) | (rover->blend ? HWR_GetBlendModeFlag(rover->blend) : PF_Translucent),
|
||||
false, *gl_frontsector->lightlist[light].extra_colormap);
|
||||
false, rover->fofflags & FOF_SPLAT, *gl_frontsector->lightlist[light].extra_colormap);
|
||||
}
|
||||
else
|
||||
{
|
||||
HWR_GetLevelFlat(&levelflats[*rover->toppic]);
|
||||
HWR_GetLevelFlat(&levelflats[*rover->toppic], rover->fofflags & FOF_SPLAT);
|
||||
light = R_GetPlaneLight(gl_frontsector, centerHeight, viewz < topCullHeight ? true : false);
|
||||
HWR_RenderPlane(sub, &extrasubsectors[num], true, *rover->topheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, &levelflats[*rover->toppic],
|
||||
rover->master->frontsector, 255, *gl_frontsector->lightlist[light].extra_colormap);
|
||||
|
@ -3799,6 +3854,7 @@ typedef struct
|
|||
sector_t *FOFSector;
|
||||
FBITFIELD blend;
|
||||
boolean fogplane;
|
||||
boolean chromakeyed;
|
||||
extracolormap_t *planecolormap;
|
||||
INT32 drawcount;
|
||||
} planeinfo_t;
|
||||
|
@ -3840,7 +3896,7 @@ static INT32 drawcount = 0;
|
|||
#define MAX_TRANSPARENTFLOOR 512
|
||||
|
||||
// This will likely turn into a copy of HWR_Add3DWater and replace it.
|
||||
void HWR_AddTransparentFloor(levelflat_t *levelflat, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap)
|
||||
void HWR_AddTransparentFloor(levelflat_t *levelflat, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, boolean chromakeyed, extracolormap_t *planecolormap)
|
||||
{
|
||||
static size_t allocedplanes = 0;
|
||||
|
||||
|
@ -3863,6 +3919,7 @@ void HWR_AddTransparentFloor(levelflat_t *levelflat, extrasubsector_t *xsub, boo
|
|||
planeinfo[numplanes].FOFSector = FOFSector;
|
||||
planeinfo[numplanes].blend = blend;
|
||||
planeinfo[numplanes].fogplane = fogplane;
|
||||
planeinfo[numplanes].chromakeyed = chromakeyed;
|
||||
planeinfo[numplanes].planecolormap = planecolormap;
|
||||
planeinfo[numplanes].drawcount = drawcount++;
|
||||
|
||||
|
@ -4029,7 +4086,7 @@ static void HWR_CreateDrawNodes(void)
|
|||
gl_frontsector = NULL;
|
||||
|
||||
if (!(sortnode[sortindex[i]].plane->blend & PF_NoTexture))
|
||||
HWR_GetLevelFlat(sortnode[sortindex[i]].plane->levelflat);
|
||||
HWR_GetLevelFlat(sortnode[sortindex[i]].plane->levelflat, sortnode[sortindex[i]].plane->chromakeyed);
|
||||
HWR_RenderPlane(NULL, sortnode[sortindex[i]].plane->xsub, sortnode[sortindex[i]].plane->isceiling, sortnode[sortindex[i]].plane->fixedheight, sortnode[sortindex[i]].plane->blend, sortnode[sortindex[i]].plane->lightlevel,
|
||||
sortnode[sortindex[i]].plane->levelflat, sortnode[sortindex[i]].plane->FOFSector, sortnode[sortindex[i]].plane->alpha, sortnode[sortindex[i]].plane->planecolormap);
|
||||
}
|
||||
|
@ -4038,9 +4095,11 @@ static void HWR_CreateDrawNodes(void)
|
|||
// We aren't traversing the BSP tree, so make gl_frontsector null to avoid crashes.
|
||||
gl_frontsector = NULL;
|
||||
|
||||
polyobj_t *po = sortnode[sortindex[i]].polyplane->polysector;
|
||||
|
||||
if (!(sortnode[sortindex[i]].polyplane->blend & PF_NoTexture))
|
||||
HWR_GetLevelFlat(sortnode[sortindex[i]].polyplane->levelflat);
|
||||
HWR_RenderPolyObjectPlane(sortnode[sortindex[i]].polyplane->polysector, sortnode[sortindex[i]].polyplane->isceiling, sortnode[sortindex[i]].polyplane->fixedheight, sortnode[sortindex[i]].polyplane->blend, sortnode[sortindex[i]].polyplane->lightlevel,
|
||||
HWR_GetLevelFlat(sortnode[sortindex[i]].polyplane->levelflat, po->flags & POF_SPLAT);
|
||||
HWR_RenderPolyObjectPlane(po, sortnode[sortindex[i]].polyplane->isceiling, sortnode[sortindex[i]].polyplane->fixedheight, sortnode[sortindex[i]].polyplane->blend, sortnode[sortindex[i]].polyplane->lightlevel,
|
||||
sortnode[sortindex[i]].polyplane->levelflat, sortnode[sortindex[i]].polyplane->FOFSector, sortnode[sortindex[i]].polyplane->alpha, sortnode[sortindex[i]].polyplane->planecolormap);
|
||||
}
|
||||
else if (sortnode[sortindex[i]].wall)
|
||||
|
@ -4245,7 +4304,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
|||
// uncapped/interpolation
|
||||
interpmobjstate_t interp = {0};
|
||||
|
||||
if (!cv_renderthings.value)
|
||||
if (!r_renderthings)
|
||||
return;
|
||||
|
||||
if (!thing)
|
||||
|
@ -4324,9 +4383,9 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
|||
//Fab : 02-08-98: 'skin' override spritedef currently used for skin
|
||||
if (thing->skin && thing->sprite == SPR_PLAY)
|
||||
{
|
||||
sprdef = &((skin_t *)thing->skin)->sprites[thing->sprite2];
|
||||
sprdef = P_GetSkinSpritedef(thing->skin, thing->sprite2);
|
||||
#ifdef ROTSPRITE
|
||||
sprinfo = &((skin_t *)thing->skin)->sprinfo[thing->sprite2];
|
||||
sprinfo = P_GetSkinSpriteInfo(thing->skin, thing->sprite2);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
@ -5519,7 +5578,7 @@ static void HWR_TogglePaletteRendering(void)
|
|||
// The textures will still be converted to RGBA by r_opengl.
|
||||
// This however makes hw_cache use paletted blending for composite textures!
|
||||
// (patchformat is not touched)
|
||||
textureformat = GL_TEXFMT_P_8;
|
||||
textureformat = GL_TEXFMT_AP_88;
|
||||
|
||||
HWR_SetMapPalette();
|
||||
HWR_SetPalette(pLocalPalette);
|
||||
|
@ -5790,7 +5849,7 @@ void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, INT32 te
|
|||
{
|
||||
static size_t allocedwalls = 0;
|
||||
|
||||
if (!cv_renderwalls.value)
|
||||
if (!r_renderwalls)
|
||||
return;
|
||||
|
||||
// Force realloc if buffer has been freed
|
||||
|
@ -5821,7 +5880,7 @@ void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend,
|
|||
|
||||
INT32 shader = SHADER_NONE;
|
||||
|
||||
if (!cv_renderwalls.value)
|
||||
if (!r_renderwalls)
|
||||
return;
|
||||
|
||||
// Lighting is done here instead so that fog isn't drawn incorrectly on transparent walls after sorting
|
||||
|
@ -5913,7 +5972,7 @@ void HWR_DoPostProcessor(player_t *player)
|
|||
if (*type == postimg_water)
|
||||
{
|
||||
WAVELENGTH = 5;
|
||||
AMPLITUDE = 20;
|
||||
AMPLITUDE = 40;
|
||||
FREQUENCY = 8;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1078,30 +1078,47 @@ static boolean HWR_CanInterpolateSprite2(modelspr2frames_t *spr2frame)
|
|||
return spr2frame->interpolate;
|
||||
}
|
||||
|
||||
//
|
||||
// HWR_GetModelSprite2 (see P_GetSkinSprite2)
|
||||
// For non-super players, tries each sprite2's immediate predecessor until it finds one with a number of frames or ends up at standing.
|
||||
// For super players, does the same as above - but tries the super equivalent for each sprite2 before the non-super version.
|
||||
//
|
||||
|
||||
static UINT8 HWR_GetModelSprite2(md2_t *md2, skin_t *skin, UINT8 spr2, player_t *player)
|
||||
static modelspr2frames_t *HWR_GetModelSprite2Frames(md2_t *md2, UINT16 spr2)
|
||||
{
|
||||
UINT8 super = 0, i = 0;
|
||||
if (!md2 || !md2->model)
|
||||
return NULL;
|
||||
|
||||
if (!md2 || !md2->model || !md2->model->spr2frames || !skin)
|
||||
return 0;
|
||||
boolean is_super = spr2 & SPR2F_SUPER;
|
||||
|
||||
if ((playersprite_t)(spr2 & ~FF_SPR2SUPER) >= free_spr2)
|
||||
return 0;
|
||||
spr2 &= SPR2F_MASK;
|
||||
|
||||
while (!md2->model->spr2frames[spr2].numframes
|
||||
&& spr2 != SPR2_STND
|
||||
&& ++i != 32) // recursion limiter
|
||||
if (spr2 >= free_spr2)
|
||||
return NULL;
|
||||
|
||||
if (is_super)
|
||||
{
|
||||
if (spr2 & FF_SPR2SUPER)
|
||||
modelspr2frames_t *frames = md2->model->superspr2frames;
|
||||
if (frames && md2->model->superspr2frames[spr2].numframes)
|
||||
return &md2->model->superspr2frames[spr2];
|
||||
}
|
||||
|
||||
if (md2->model->spr2frames)
|
||||
return &md2->model->spr2frames[spr2];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static modelspr2frames_t *HWR_GetModelSprite2(md2_t *md2, skin_t *skin, UINT16 spr2, player_t *player)
|
||||
{
|
||||
UINT16 super = 0;
|
||||
UINT8 i = 0;
|
||||
|
||||
if (!md2 || !md2->model || !skin)
|
||||
return HWR_GetModelSprite2Frames(md2, 0);
|
||||
|
||||
while (!HWR_GetModelSprite2Frames(md2, spr2)
|
||||
&& spr2 != SPR2_STND
|
||||
&& ++i < 32) // recursion limiter
|
||||
{
|
||||
if (spr2 & SPR2F_SUPER)
|
||||
{
|
||||
super = FF_SPR2SUPER;
|
||||
spr2 &= ~FF_SPR2SUPER;
|
||||
super = SPR2F_SUPER;
|
||||
spr2 &= ~SPR2F_SUPER;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1130,9 +1147,9 @@ static UINT8 HWR_GetModelSprite2(md2_t *md2, skin_t *skin, UINT8 spr2, player_t
|
|||
}
|
||||
|
||||
if (i >= 32) // probably an infinite loop...
|
||||
return 0;
|
||||
spr2 = 0;
|
||||
|
||||
return spr2;
|
||||
return HWR_GetModelSprite2Frames(md2, spr2);
|
||||
}
|
||||
|
||||
// Adjust texture coords of model to fit into a patch's max_s and max_t
|
||||
|
@ -1188,7 +1205,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
|||
char filename[64];
|
||||
INT32 frame = 0;
|
||||
INT32 nextFrame = -1;
|
||||
UINT8 spr2 = 0;
|
||||
modelspr2frames_t *spr2frames = NULL;
|
||||
FTransform p;
|
||||
FSurfaceInfo Surf;
|
||||
|
||||
|
@ -1418,18 +1435,24 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
|||
tics = (float)spr->mobj->anim_duration;
|
||||
}
|
||||
|
||||
if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
|
||||
sprdef = P_GetSkinSpritedef(spr->mobj->skin, spr->mobj->sprite2);
|
||||
else
|
||||
sprdef = &sprites[spr->mobj->sprite];
|
||||
|
||||
frame = (spr->mobj->frame & FF_FRAMEMASK);
|
||||
if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY && md2->model->spr2frames)
|
||||
if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
|
||||
spr2frames = HWR_GetModelSprite2(md2, spr->mobj->skin, spr->mobj->sprite2, spr->mobj->player);
|
||||
if (spr2frames)
|
||||
{
|
||||
spr2 = HWR_GetModelSprite2(md2, spr->mobj->skin, spr->mobj->sprite2, spr->mobj->player);
|
||||
mod = md2->model->spr2frames[spr2].numframes;
|
||||
mod = spr2frames->numframes;
|
||||
#ifndef DONTHIDEDIFFANIMLENGTH // by default, different anim length is masked by the mod
|
||||
if (mod > (INT32)((skin_t *)spr->mobj->skin)->sprites[spr2].numframes)
|
||||
mod = ((skin_t *)spr->mobj->skin)->sprites[spr2].numframes;
|
||||
if (mod > (INT32)sprdef->numframes)
|
||||
mod = sprdef->numframes;
|
||||
#endif
|
||||
if (!mod)
|
||||
mod = 1;
|
||||
frame = md2->model->spr2frames[spr2].frames[frame%mod];
|
||||
frame = spr2frames->frames[frame % mod];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1449,13 +1472,18 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
|||
if (durs > INTERPOLERATION_LIMIT)
|
||||
durs = INTERPOLERATION_LIMIT;
|
||||
|
||||
if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY && md2->model->spr2frames)
|
||||
if (spr2frames)
|
||||
{
|
||||
if (HWR_CanInterpolateSprite2(&md2->model->spr2frames[spr2])
|
||||
UINT16 next_spr2 = P_GetStateSprite2(&states[spr->mobj->state->nextstate]);
|
||||
|
||||
// Add or remove SPR2F_SUPER based on certain conditions
|
||||
next_spr2 = P_ApplySuperFlagToSprite2(next_spr2, spr->mobj);
|
||||
|
||||
if (HWR_CanInterpolateSprite2(spr2frames)
|
||||
&& (spr->mobj->frame & FF_ANIMATE
|
||||
|| (spr->mobj->state->nextstate != S_NULL
|
||||
&& states[spr->mobj->state->nextstate].sprite == SPR_PLAY
|
||||
&& ((P_GetSkinSprite2(spr->mobj->skin, (((spr->mobj->player && spr->mobj->player->powers[pw_super]) ? FF_SPR2SUPER : 0)|states[spr->mobj->state->nextstate].frame) & FF_FRAMEMASK, spr->mobj->player) == spr->mobj->sprite2)))))
|
||||
&& ((P_GetSkinSprite2(spr->mobj->skin, next_spr2, spr->mobj->player) == spr->mobj->sprite2)))))
|
||||
{
|
||||
nextFrame = (spr->mobj->frame & FF_FRAMEMASK) + 1;
|
||||
if (nextFrame >= mod)
|
||||
|
@ -1466,7 +1494,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
|||
nextFrame = 0;
|
||||
}
|
||||
if (frame || !(spr->mobj->state->frame & FF_SPR2ENDSTATE))
|
||||
nextFrame = md2->model->spr2frames[spr2].frames[nextFrame];
|
||||
nextFrame = spr2frames->frames[nextFrame];
|
||||
else
|
||||
nextFrame = -1;
|
||||
}
|
||||
|
@ -1502,11 +1530,6 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
|||
else
|
||||
p.z = FIXED_TO_FLOAT(interp.z);
|
||||
|
||||
if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
|
||||
sprdef = &((skin_t *)spr->mobj->skin)->sprites[spr->mobj->sprite2];
|
||||
else
|
||||
sprdef = &sprites[spr->mobj->sprite];
|
||||
|
||||
sprframe = &sprdef->spriteframes[spr->mobj->frame & FF_FRAMEMASK];
|
||||
|
||||
if (sprframe->rotate || papersprite)
|
||||
|
|
|
@ -292,6 +292,7 @@ void LoadModelSprite2(model_t *model)
|
|||
{
|
||||
INT32 i;
|
||||
modelspr2frames_t *spr2frames = NULL;
|
||||
modelspr2frames_t *superspr2frames = NULL;
|
||||
INT32 numframes = model->meshes[0].numFrames;
|
||||
char *framename = model->frameNames;
|
||||
|
||||
|
@ -335,25 +336,33 @@ void LoadModelSprite2(model_t *model)
|
|||
spr2idx = 0;
|
||||
while (spr2idx < free_spr2)
|
||||
{
|
||||
modelspr2frames_t *frames = NULL;
|
||||
if (!memcmp(spr2names[spr2idx], name, 4))
|
||||
{
|
||||
if (!spr2frames)
|
||||
spr2frames = (modelspr2frames_t*)Z_Calloc(sizeof(modelspr2frames_t)*NUMPLAYERSPRITES*2, PU_STATIC, NULL);
|
||||
spr2frames = (modelspr2frames_t*)Z_Calloc(sizeof(modelspr2frames_t)*NUMPLAYERSPRITES, PU_STATIC, NULL);
|
||||
frames = spr2frames;
|
||||
|
||||
if (super)
|
||||
spr2idx |= FF_SPR2SUPER;
|
||||
{
|
||||
if (!superspr2frames)
|
||||
superspr2frames = (modelspr2frames_t*)Z_Calloc(sizeof(modelspr2frames_t)*NUMPLAYERSPRITES, PU_STATIC, NULL);
|
||||
frames = superspr2frames;
|
||||
}
|
||||
|
||||
if (framechars[0])
|
||||
{
|
||||
frame = atoi(framechars);
|
||||
if (spr2frames[spr2idx].numframes < frame+1)
|
||||
spr2frames[spr2idx].numframes = frame+1;
|
||||
if (frames[spr2idx].numframes < frame+1)
|
||||
frames[spr2idx].numframes = frame+1;
|
||||
}
|
||||
else
|
||||
{
|
||||
frame = spr2frames[spr2idx].numframes;
|
||||
spr2frames[spr2idx].numframes++;
|
||||
frame = frames[spr2idx].numframes;
|
||||
frames[spr2idx].numframes++;
|
||||
}
|
||||
spr2frames[spr2idx].frames[frame] = i;
|
||||
spr2frames[spr2idx].interpolate = interpolate;
|
||||
frames[spr2idx].frames[frame] = i;
|
||||
frames[spr2idx].interpolate = interpolate;
|
||||
break;
|
||||
}
|
||||
spr2idx++;
|
||||
|
@ -366,7 +375,10 @@ void LoadModelSprite2(model_t *model)
|
|||
|
||||
if (model->spr2frames)
|
||||
Z_Free(model->spr2frames);
|
||||
if (model->superspr2frames)
|
||||
Z_Free(model->superspr2frames);
|
||||
model->spr2frames = spr2frames;
|
||||
model->superspr2frames = superspr2frames;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -101,6 +101,7 @@ typedef struct model_s
|
|||
char *frameNames;
|
||||
boolean interpolate[256];
|
||||
modelspr2frames_t *spr2frames;
|
||||
modelspr2frames_t *superspr2frames;
|
||||
|
||||
// the max_s and max_t values that the uvs are currently adjusted to
|
||||
// (if a sprite is used as a texture)
|
||||
|
|
518
src/hu_stuff.c
518
src/hu_stuff.c
|
@ -61,21 +61,22 @@
|
|||
#define HU_CSAY 2 // Server CECHOes to everyone.
|
||||
|
||||
//-------------------------------------------
|
||||
// heads up font
|
||||
// Fonts & stuff
|
||||
//-------------------------------------------
|
||||
patch_t *hu_font[HU_FONTSIZE];
|
||||
patch_t *tny_font[HU_FONTSIZE];
|
||||
// Font definitions
|
||||
fontdef_t hu_font;
|
||||
fontdef_t tny_font;
|
||||
fontdef_t cred_font;
|
||||
fontdef_t lt_font;
|
||||
fontdef_t ntb_font;
|
||||
fontdef_t nto_font;
|
||||
|
||||
// Numbers
|
||||
patch_t *tallnum[10]; // 0-9
|
||||
patch_t *nightsnum[10]; // 0-9
|
||||
|
||||
// Level title and credits fonts
|
||||
patch_t *lt_font[LT_FONTSIZE];
|
||||
patch_t *cred_font[CRED_FONTSIZE];
|
||||
patch_t *ttlnum[10]; // act numbers (0-9)
|
||||
|
||||
// Name tag fonts
|
||||
patch_t *ntb_font[NT_FONTSIZE];
|
||||
patch_t *nto_font[NT_FONTSIZE];
|
||||
patch_t *tallminus;
|
||||
patch_t *tallinfin;
|
||||
|
||||
static player_t *plr;
|
||||
boolean chat_on; // entering a chat message?
|
||||
|
@ -91,8 +92,6 @@ patch_t *bflagico;
|
|||
patch_t *rmatcico;
|
||||
patch_t *bmatcico;
|
||||
patch_t *tagico;
|
||||
patch_t *tallminus;
|
||||
patch_t *tallinfin;
|
||||
|
||||
//-------------------------------------------
|
||||
// coop hud
|
||||
|
@ -188,53 +187,26 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum);
|
|||
void HU_LoadGraphics(void)
|
||||
{
|
||||
char buffer[9];
|
||||
INT32 i, j;
|
||||
INT32 i;
|
||||
|
||||
if (dedicated)
|
||||
return;
|
||||
|
||||
j = HU_FONTSTART;
|
||||
for (i = 0; i < HU_FONTSIZE; i++, j++)
|
||||
{
|
||||
// cache the heads-up font for entire game execution
|
||||
sprintf(buffer, "STCFN%.3d", j);
|
||||
if (W_CheckNumForName(buffer) == LUMPERROR)
|
||||
hu_font[i] = NULL;
|
||||
else
|
||||
hu_font[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
|
||||
// Cache fonts
|
||||
HU_LoadFontCharacters(&hu_font, "STCFN");
|
||||
HU_LoadFontCharacters(&tny_font, "TNYFN");
|
||||
HU_LoadFontCharacters(&cred_font, "CRFNT");
|
||||
HU_LoadFontCharacters(<_font, "LTFNT");
|
||||
HU_LoadFontCharacters(&ntb_font, "NTFNT");
|
||||
HU_LoadFontCharacters(&nto_font, "NTFNO");
|
||||
|
||||
// tiny version of the heads-up font
|
||||
sprintf(buffer, "TNYFN%.3d", j);
|
||||
if (W_CheckNumForName(buffer) == LUMPERROR)
|
||||
tny_font[i] = NULL;
|
||||
else
|
||||
tny_font[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
|
||||
}
|
||||
|
||||
j = LT_FONTSTART;
|
||||
for (i = 0; i < LT_FONTSIZE; i++)
|
||||
{
|
||||
sprintf(buffer, "LTFNT%.3d", j);
|
||||
j++;
|
||||
|
||||
if (W_CheckNumForName(buffer) == LUMPERROR)
|
||||
lt_font[i] = NULL;
|
||||
else
|
||||
lt_font[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
|
||||
}
|
||||
|
||||
// cache the credits font for entire game execution (why not?)
|
||||
j = CRED_FONTSTART;
|
||||
for (i = 0; i < CRED_FONTSIZE; i++)
|
||||
{
|
||||
sprintf(buffer, "CRFNT%.3d", j);
|
||||
j++;
|
||||
|
||||
if (W_CheckNumForName(buffer) == LUMPERROR)
|
||||
cred_font[i] = NULL;
|
||||
else
|
||||
cred_font[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
|
||||
}
|
||||
// For each font, set kerning, space width, character width and line spacing
|
||||
HU_SetFontProperties(&hu_font, 0, 4, 8, 12);
|
||||
HU_SetFontProperties(&tny_font, 0, 2, 4, 12);
|
||||
HU_SetFontProperties(&cred_font, 0, 16, 16, 16);
|
||||
HU_SetFontProperties(<_font, 0, 16, 20, 20);
|
||||
HU_SetFontProperties(&ntb_font, 2, 4, 20, 21);
|
||||
HU_SetFontProperties(&nto_font, 0, 4, 20, 21);
|
||||
|
||||
//cache numbers too!
|
||||
for (i = 0; i < 10; i++)
|
||||
|
@ -243,45 +215,14 @@ void HU_LoadGraphics(void)
|
|||
tallnum[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
|
||||
sprintf(buffer, "NGTNUM%d", i);
|
||||
nightsnum[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX);
|
||||
sprintf(buffer, "TTL%.2d", i);
|
||||
ttlnum[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
|
||||
}
|
||||
|
||||
// minus for negative tallnums
|
||||
tallminus = (patch_t *)W_CachePatchName("STTMINUS", PU_HUDGFX);
|
||||
tallinfin = (patch_t *)W_CachePatchName("STTINFIN", PU_HUDGFX);
|
||||
|
||||
// cache act numbers for level titles
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
sprintf(buffer, "TTL%.2d", i);
|
||||
ttlnum[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
|
||||
}
|
||||
|
||||
// cache the base name tag font for entire game execution
|
||||
j = NT_FONTSTART;
|
||||
for (i = 0; i < NT_FONTSIZE; i++)
|
||||
{
|
||||
sprintf(buffer, "NTFNT%.3d", j);
|
||||
j++;
|
||||
|
||||
if (W_CheckNumForName(buffer) == LUMPERROR)
|
||||
ntb_font[i] = NULL;
|
||||
else
|
||||
ntb_font[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
|
||||
}
|
||||
|
||||
// cache the outline name tag font for entire game execution
|
||||
j = NT_FONTSTART;
|
||||
for (i = 0; i < NT_FONTSIZE; i++)
|
||||
{
|
||||
sprintf(buffer, "NTFNO%.3d", j);
|
||||
j++;
|
||||
|
||||
if (W_CheckNumForName(buffer) == LUMPERROR)
|
||||
nto_font[i] = NULL;
|
||||
else
|
||||
nto_font[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
|
||||
}
|
||||
|
||||
// cache the crosshairs, don't bother to know which one is being used,
|
||||
// just cache all 3, they're so small anyway.
|
||||
for (i = 0; i < HU_CROSSHAIRS; i++)
|
||||
|
@ -323,6 +264,29 @@ void HU_LoadGraphics(void)
|
|||
//emeraldpics[2][7] = W_CachePatchName("EMBOX8", PU_HUDGFX); -- unused
|
||||
}
|
||||
|
||||
void HU_LoadFontCharacters(fontdef_t *font, const char *prefix)
|
||||
{
|
||||
char buffer[9];
|
||||
INT32 i, j = FONTSTART;
|
||||
|
||||
for (i = 0; i < FONTSIZE; i++, j++)
|
||||
{
|
||||
sprintf(buffer, "%.5s%.3d", prefix, j);
|
||||
if (W_CheckNumForName(buffer) == LUMPERROR)
|
||||
font->chars[i] = NULL;
|
||||
else
|
||||
font->chars[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
|
||||
}
|
||||
}
|
||||
|
||||
void HU_SetFontProperties(fontdef_t *font, INT32 kerning, UINT32 spacewidth, UINT32 charwidth, UINT32 linespacing)
|
||||
{
|
||||
font->kerning = kerning;
|
||||
font->spacewidth = spacewidth;
|
||||
font->charwidth = charwidth;
|
||||
font->linespacing = linespacing;
|
||||
}
|
||||
|
||||
// Initialise Heads up
|
||||
// once at game startup.
|
||||
//
|
||||
|
@ -1117,7 +1081,7 @@ boolean HU_Responder(event_t *ev)
|
|||
|
||||
if (ev->type == ev_text)
|
||||
{
|
||||
if ((c < HU_FONTSTART || c > HU_FONTEND || !hu_font[c-HU_FONTSTART])
|
||||
if ((c < FONTSTART || c > FONTEND || !hu_font.chars[c-FONTSTART])
|
||||
&& c != ' ') // Allow spaces, of course
|
||||
{
|
||||
return false;
|
||||
|
@ -1236,199 +1200,81 @@ boolean HU_Responder(event_t *ev)
|
|||
// HEADS UP DRAWING
|
||||
//======================================================================
|
||||
|
||||
// Precompile a wordwrapped string to any given width.
|
||||
// This is a muuuch better method than V_WORDWRAP.
|
||||
// again stolen and modified a bit from video.c, don't mind me, will need to rearrange this one day.
|
||||
// this one is simplified for the chat drawer.
|
||||
static char *CHAT_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
|
||||
{
|
||||
INT32 c;
|
||||
size_t chw, i, lastusablespace = 0;
|
||||
size_t slen;
|
||||
char *newstring = Z_StrDup(string);
|
||||
INT32 spacewidth = (vid.width < 640) ? 8 : 4, charwidth = (vid.width < 640) ? 8 : 4;
|
||||
|
||||
slen = strlen(string);
|
||||
x = 0;
|
||||
|
||||
for (i = 0; i < slen; ++i)
|
||||
{
|
||||
c = newstring[i];
|
||||
if ((UINT8)c >= 0x80 && (UINT8)c <= 0x89) //color parsing! -Inuyasha 2.16.09
|
||||
continue;
|
||||
|
||||
if (c == '\n')
|
||||
{
|
||||
x = 0;
|
||||
lastusablespace = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(option & V_ALLOWLOWERCASE))
|
||||
c = toupper(c);
|
||||
c -= HU_FONTSTART;
|
||||
|
||||
if (c < 0 || c >= HU_FONTSIZE || !hu_font[c])
|
||||
{
|
||||
chw = spacewidth;
|
||||
lastusablespace = i;
|
||||
}
|
||||
else
|
||||
chw = charwidth;
|
||||
|
||||
x += chw;
|
||||
|
||||
if (lastusablespace != 0 && x > w)
|
||||
{
|
||||
//CONS_Printf("Wrap at index %d\n", i);
|
||||
newstring[lastusablespace] = '\n';
|
||||
i = lastusablespace+1;
|
||||
lastusablespace = 0;
|
||||
x = 0;
|
||||
}
|
||||
}
|
||||
return newstring;
|
||||
}
|
||||
|
||||
|
||||
// 30/7/18: chaty is now the distance at which the lowest point of the chat will be drawn if that makes any sense.
|
||||
|
||||
INT16 chatx = 13, chaty = 169; // let's use this as our coordinates
|
||||
|
||||
// chat stuff by VincyTM LOL XD!
|
||||
|
||||
// HU_DrawMiniChat
|
||||
|
||||
static void HU_drawMiniChat(void)
|
||||
{
|
||||
INT32 x = chatx+2;
|
||||
INT32 x = chatx+2, y;
|
||||
INT32 chatheight = 0;
|
||||
INT32 charwidth = 4, charheight = 6;
|
||||
INT32 boxw = cv_chatwidth.value;
|
||||
INT32 dx = 0, dy = 0;
|
||||
size_t i = chat_nummsg_min;
|
||||
boolean prev_linereturn = false; // a hack to prevent double \n while I have no idea why they happen in the first place.
|
||||
|
||||
INT32 msglines = 0;
|
||||
// process all messages once without rendering anything or doing anything fancy so that we know how many lines each message has...
|
||||
INT32 y;
|
||||
|
||||
if (!chat_nummsg_min)
|
||||
return; // needless to say it's useless to do anything if we don't have anything to draw.
|
||||
|
||||
/*if (splitscreen > 1)
|
||||
boxw = max(64, boxw/2);*/
|
||||
|
||||
for (; i>0; i--)
|
||||
for (size_t i = chat_nummsg_min; i > 0; i--)
|
||||
{
|
||||
char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i-1]);
|
||||
size_t j = 0;
|
||||
INT32 linescount = 0;
|
||||
|
||||
while(msg[j]) // iterate through msg
|
||||
char *msg = V_ChatWordWrap(chatx, boxw-charwidth, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i-1]);
|
||||
for(size_t j = 0; msg[j]; j++) // iterate through msg
|
||||
{
|
||||
if (msg[j] < HU_FONTSTART) // don't draw
|
||||
{
|
||||
if (msg[j] == '\n') // get back down.
|
||||
{
|
||||
++j;
|
||||
if (!prev_linereturn)
|
||||
{
|
||||
linescount += 1;
|
||||
dx = 0;
|
||||
}
|
||||
prev_linereturn = true;
|
||||
continue;
|
||||
}
|
||||
else if (msg[j] & 0x80) // stolen from video.c, nice.
|
||||
{
|
||||
++j;
|
||||
continue;
|
||||
}
|
||||
|
||||
++j;
|
||||
}
|
||||
else
|
||||
{
|
||||
j++;
|
||||
}
|
||||
prev_linereturn = false;
|
||||
dx += charwidth;
|
||||
if (dx >= boxw)
|
||||
if (msg[j] == '\n') // get back down.
|
||||
{
|
||||
chatheight += charheight;
|
||||
dx = 0;
|
||||
linescount += 1;
|
||||
}
|
||||
else if (msg[j] >= FONTSTART)
|
||||
{
|
||||
dx += charwidth;
|
||||
if (dx >= boxw)
|
||||
{
|
||||
dx = 0;
|
||||
chatheight += charheight;
|
||||
}
|
||||
}
|
||||
}
|
||||
dy = 0;
|
||||
dx = 0;
|
||||
msglines += linescount+1;
|
||||
chatheight += charheight;
|
||||
|
||||
if (msg)
|
||||
Z_Free(msg);
|
||||
}
|
||||
|
||||
y = chaty - charheight*(msglines+1);
|
||||
y = chaty - (chatheight + charheight);
|
||||
|
||||
/*if (splitscreen)
|
||||
for (size_t i = 0; i < chat_nummsg_min; i++) // iterate through our hot messages
|
||||
{
|
||||
y -= BASEVIDHEIGHT/2;
|
||||
if (splitscreen > 1)
|
||||
y += 16;
|
||||
}*/
|
||||
|
||||
dx = 0;
|
||||
dy = 0;
|
||||
i = 0;
|
||||
prev_linereturn = false;
|
||||
|
||||
for (; i<=(chat_nummsg_min-1); i++) // iterate through our hot messages
|
||||
{
|
||||
INT32 clrflag = 0;
|
||||
INT32 timer = ((cv_chattime.value*TICRATE)-chat_timers[i]) - cv_chattime.value*TICRATE+9; // see below...
|
||||
INT32 transflag = (timer >= 0 && timer <= 9) ? (timer*V_10TRANS) : 0; // you can make bad jokes out of this one.
|
||||
size_t j = 0;
|
||||
char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i]); // get the current message, and word wrap it.
|
||||
char *msg = V_ChatWordWrap(chatx, boxw-charwidth, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i]); // get the current message, and word wrap it.
|
||||
UINT8 *colormap = NULL;
|
||||
|
||||
while(msg[j]) // iterate through msg
|
||||
for(size_t j = 0; msg[j]; j++) // iterate through msg
|
||||
{
|
||||
if (msg[j] < HU_FONTSTART) // don't draw
|
||||
if (msg[j] == '\n') // get back down.
|
||||
{
|
||||
if (msg[j] == '\n') // get back down.
|
||||
{
|
||||
++j;
|
||||
if (!prev_linereturn)
|
||||
{
|
||||
dy += charheight;
|
||||
dx = 0;
|
||||
}
|
||||
prev_linereturn = true;
|
||||
continue;
|
||||
}
|
||||
else if (msg[j] & 0x80) // stolen from video.c, nice.
|
||||
{
|
||||
clrflag = ((msg[j] & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK;
|
||||
colormap = V_GetStringColormap(clrflag);
|
||||
++j;
|
||||
continue;
|
||||
}
|
||||
|
||||
++j;
|
||||
dy += charheight;
|
||||
dx = 0;
|
||||
}
|
||||
else
|
||||
else if (msg[j] & 0x80) // get colormap
|
||||
colormap = V_GetStringColormap(((msg[j] & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK);
|
||||
else if (msg[j] >= FONTSTART)
|
||||
{
|
||||
if (cv_chatbacktint.value) // on request of wolfy
|
||||
V_DrawFillConsoleMap(x + dx + 2, y+dy, charwidth, charheight, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT);
|
||||
|
||||
V_DrawChatCharacter(x + dx + 2, y+dy, msg[j++] |V_SNAPTOBOTTOM|V_SNAPTOLEFT|transflag, true, colormap);
|
||||
}
|
||||
V_DrawChatCharacter(x + dx + 2, y+dy, msg[j] |V_SNAPTOBOTTOM|V_SNAPTOLEFT|transflag, true, colormap);
|
||||
|
||||
dx += charwidth;
|
||||
prev_linereturn = false;
|
||||
if (dx >= boxw)
|
||||
{
|
||||
dx = 0;
|
||||
dy += charheight;
|
||||
dx += charwidth;
|
||||
if (dx >= boxw)
|
||||
{
|
||||
dx = 0;
|
||||
dy += charheight;
|
||||
}
|
||||
}
|
||||
}
|
||||
dy += charheight;
|
||||
|
@ -1440,7 +1286,6 @@ static void HU_drawMiniChat(void)
|
|||
|
||||
// decrement addy and make that shit smooth:
|
||||
addy /= 2;
|
||||
|
||||
}
|
||||
|
||||
// HU_DrawChatLog
|
||||
|
@ -1485,44 +1330,28 @@ static void HU_drawChatLog(INT32 offset)
|
|||
|
||||
for (i=0; i<chat_nummsg_log; i++) // iterate through our chatlog
|
||||
{
|
||||
INT32 clrflag = 0;
|
||||
INT32 j = 0;
|
||||
char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_log[i]); // get the current message, and word wrap it.
|
||||
char *msg = V_ChatWordWrap(chatx, boxw-charwidth, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_log[i]); // get the current message, and word wrap it.
|
||||
UINT8 *colormap = NULL;
|
||||
while(msg[j]) // iterate through msg
|
||||
for(size_t j = 0; msg[j]; j++) // iterate through msg
|
||||
{
|
||||
if (msg[j] < HU_FONTSTART) // don't draw
|
||||
if (msg[j] == '\n') // get back down.
|
||||
{
|
||||
if (msg[j] == '\n') // get back down.
|
||||
{
|
||||
++j;
|
||||
dy += charheight;
|
||||
dx = 0;
|
||||
continue;
|
||||
}
|
||||
else if (msg[j] & 0x80) // stolen from video.c, nice.
|
||||
{
|
||||
clrflag = ((msg[j] & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK;
|
||||
colormap = V_GetStringColormap(clrflag);
|
||||
++j;
|
||||
continue;
|
||||
}
|
||||
|
||||
++j;
|
||||
dy += charheight;
|
||||
dx = 0;
|
||||
}
|
||||
else
|
||||
else if (msg[j] & 0x80) // get colormap
|
||||
colormap = V_GetStringColormap(((msg[j] & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK);
|
||||
else if (msg[j] >= FONTSTART)
|
||||
{
|
||||
if ((y+dy+2 >= chat_topy) && (y+dy < (chat_bottomy)))
|
||||
V_DrawChatCharacter(x + dx + 2, y+dy+2, msg[j++] |V_SNAPTOBOTTOM|V_SNAPTOLEFT, true, colormap);
|
||||
else
|
||||
j++; // don't forget to increment this or we'll get stuck in the limbo.
|
||||
}
|
||||
V_DrawChatCharacter(x + dx + 2, y+dy+2, msg[j] |V_SNAPTOBOTTOM|V_SNAPTOLEFT, true, colormap);
|
||||
|
||||
dx += charwidth;
|
||||
if (dx >= boxw-charwidth-2 && i<chat_nummsg_log && msg[j] >= HU_FONTSTART) // end of message shouldn't count, nor should invisible characters!!!!
|
||||
{
|
||||
dx = 0;
|
||||
dy += charheight;
|
||||
dx += charwidth;
|
||||
if (dx >= boxw-charwidth-2 && i<chat_nummsg_log) // end of message shouldn't count, nor should invisible characters!!!!
|
||||
{
|
||||
dx = 0;
|
||||
dy += charheight;
|
||||
}
|
||||
}
|
||||
}
|
||||
dy += charheight;
|
||||
|
@ -1532,30 +1361,25 @@ static void HU_drawChatLog(INT32 offset)
|
|||
Z_Free(msg);
|
||||
}
|
||||
|
||||
|
||||
if (((chat_scroll >= chat_maxscroll) || (chat_scrollmedown)) && !(justscrolleddown || justscrolledup || chat_scrolltime)) // was already at the bottom of the page before new maxscroll calculation and was NOT scrolling.
|
||||
{
|
||||
atbottom = true; // we should scroll
|
||||
}
|
||||
|
||||
chat_scrollmedown = false;
|
||||
|
||||
// getmaxscroll through a lazy hack. We do all these loops,
|
||||
// so let's not do more loops that are gonna lag the game more. :P
|
||||
// getmaxscroll through a lazy hack. We do all these loops, so let's not do more loops that are gonna lag the game more. :P
|
||||
chat_maxscroll = max(dy / charheight - cv_chatheight.value, 0);
|
||||
|
||||
// if we're not bound by the time, autoscroll for next frame:
|
||||
if (atbottom)
|
||||
chat_scroll = chat_maxscroll;
|
||||
|
||||
// draw arrows to indicate that we can (or not) scroll.
|
||||
// account for Y = -1 offset in tinyfont
|
||||
// draw arrows to indicate that we can (or not) scroll, accounting for Y = -1 offset in tinyfont
|
||||
if (chat_scroll > 0)
|
||||
V_DrawThinString(chatx-8, ((justscrolledup) ? (chat_topy-1) : (chat_topy)) - 1, V_SNAPTOBOTTOM | V_SNAPTOLEFT | V_YELLOWMAP, "\x1A"); // up arrow
|
||||
if (chat_scroll < chat_maxscroll)
|
||||
V_DrawThinString(chatx-8, chat_bottomy-((justscrolleddown) ? 5 : 6) - 1, V_SNAPTOBOTTOM | V_SNAPTOLEFT | V_YELLOWMAP, "\x1B"); // down arrow
|
||||
|
||||
justscrolleddown = false;
|
||||
justscrolledup = false;
|
||||
justscrolleddown = justscrolledup = false;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1587,15 +1411,7 @@ static void HU_DrawChat(void)
|
|||
#endif
|
||||
|
||||
if (teamtalk)
|
||||
{
|
||||
talk = ttalk;
|
||||
#if 0
|
||||
if (players[consoleplayer].ctfteam == 1)
|
||||
t = 0x500; // Red
|
||||
else if (players[consoleplayer].ctfteam == 2)
|
||||
t = 0x400; // Blue
|
||||
#endif
|
||||
}
|
||||
|
||||
if (CHAT_MUTE)
|
||||
{
|
||||
|
@ -1609,16 +1425,10 @@ static void HU_DrawChat(void)
|
|||
|
||||
V_DrawFillConsoleMap(chatx, y-1, boxw, (typelines*charheight), 239 | V_SNAPTOBOTTOM | V_SNAPTOLEFT);
|
||||
|
||||
while (talk[i])
|
||||
for (i = 0; talk[i]; i++)
|
||||
{
|
||||
if (talk[i] < HU_FONTSTART)
|
||||
++i;
|
||||
else
|
||||
{
|
||||
if (talk[i] >= FONTSTART)
|
||||
V_DrawChatCharacter(chatx + c + 2, y, talk[i] |V_SNAPTOBOTTOM|V_SNAPTOLEFT|cflag, true, V_GetStringColormap(talk[i]|cflag));
|
||||
i++;
|
||||
}
|
||||
|
||||
c += charwidth;
|
||||
}
|
||||
|
||||
|
@ -1629,13 +1439,12 @@ static void HU_DrawChat(void)
|
|||
return;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
typelines = 1;
|
||||
|
||||
if ((strlen(w_chat) == 0 || c_input == 0) && hu_tick < 4)
|
||||
V_DrawChatCharacter(chatx + 2 + c, y+1, '_' |V_SNAPTOBOTTOM|V_SNAPTOLEFT|t, true, NULL);
|
||||
|
||||
while (w_chat[i])
|
||||
for (i = 0; w_chat[i]; i++)
|
||||
{
|
||||
boolean skippedline = false;
|
||||
if (c_input == (i+1))
|
||||
|
@ -1652,14 +1461,11 @@ static void HU_DrawChat(void)
|
|||
}
|
||||
}
|
||||
|
||||
//Hurdler: isn't it better like that?
|
||||
if (w_chat[i] < HU_FONTSTART)
|
||||
++i;
|
||||
else
|
||||
V_DrawChatCharacter(chatx + c + 2, y, w_chat[i++] | V_SNAPTOBOTTOM|V_SNAPTOLEFT | t, true, NULL);
|
||||
if (w_chat[i] >= FONTSTART)
|
||||
V_DrawChatCharacter(chatx + c + 2, y, w_chat[i] | V_SNAPTOBOTTOM|V_SNAPTOLEFT | t, true, NULL);
|
||||
|
||||
c += charwidth;
|
||||
if (c > boxw-(charwidth*2) && !skippedline)
|
||||
if (c > boxw-charwidth && !skippedline)
|
||||
{
|
||||
c = 0;
|
||||
y += charheight;
|
||||
|
@ -1681,8 +1487,7 @@ static void HU_DrawChat(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
i = 0;
|
||||
for(i=0; (i<MAXPLAYERS); i++)
|
||||
for(i=0; i<MAXPLAYERS; i++)
|
||||
{
|
||||
// filter: (code needs optimization pls help I'm bad with C)
|
||||
if (w_chat[3])
|
||||
|
@ -1697,32 +1502,16 @@ static void HU_DrawChat(void)
|
|||
playernum[3] = 0;
|
||||
n = atoi(playernum); // turn that into a number
|
||||
// special cases:
|
||||
|
||||
if ((n == 0) && !(w_chat[4] == '0'))
|
||||
{
|
||||
if (!(i<10))
|
||||
continue;
|
||||
}
|
||||
else if ((n == 1) && !(w_chat[3] == '0'))
|
||||
{
|
||||
if (!((i == 1) || ((i >= 10) && (i <= 19))))
|
||||
continue;
|
||||
}
|
||||
else if ((n == 2) && !(w_chat[3] == '0'))
|
||||
{
|
||||
if (!((i == 2) || ((i >= 20) && (i <= 29))))
|
||||
continue;
|
||||
}
|
||||
else if ((n == 3) && !(w_chat[3] == '0'))
|
||||
{
|
||||
if (!((i == 3) || ((i >= 30) && (i <= 31))))
|
||||
continue;
|
||||
}
|
||||
if ((n == 0) && !(w_chat[4] == '0') && (!(i<10)))
|
||||
continue;
|
||||
else if ((n == 1) && !(w_chat[3] == '0') && (!((i == 1) || ((i >= 10) && (i <= 19)))))
|
||||
continue;
|
||||
else if ((n == 2) && !(w_chat[3] == '0') && (!((i == 2) || ((i >= 20) && (i <= 29)))))
|
||||
continue;
|
||||
else if ((n == 3) && !(w_chat[3] == '0') && (!((i == 3) || ((i >= 30) && (i <= 31)))))
|
||||
continue;
|
||||
else // general case.
|
||||
{
|
||||
if (i != n)
|
||||
continue;
|
||||
}
|
||||
if (i != n) continue;
|
||||
}
|
||||
|
||||
if (playeringame[i])
|
||||
|
@ -1753,41 +1542,22 @@ static void HU_DrawChat_Old(void)
|
|||
size_t i = 0;
|
||||
const char *ntalk = "Say: ", *ttalk = "Say-Team: ";
|
||||
const char *talk = ntalk;
|
||||
INT32 charwidth = 8 * con_scalefactor; //(hu_font['A'-HU_FONTSTART]->width) * con_scalefactor;
|
||||
INT32 charheight = 8 * con_scalefactor; //(hu_font['A'-HU_FONTSTART]->height) * con_scalefactor;
|
||||
INT32 charwidth = 8 * con_scalefactor, charheight = 8 * con_scalefactor;
|
||||
if (teamtalk)
|
||||
{
|
||||
talk = ttalk;
|
||||
#if 0
|
||||
if (players[consoleplayer].ctfteam == 1)
|
||||
t = 0x500; // Red
|
||||
else if (players[consoleplayer].ctfteam == 2)
|
||||
t = 0x400; // Blue
|
||||
#endif
|
||||
}
|
||||
|
||||
while (talk[i])
|
||||
for (i = 0; talk[i]; i++)
|
||||
{
|
||||
if (talk[i] < HU_FONTSTART)
|
||||
{
|
||||
++i;
|
||||
//charwidth = 4 * con_scalefactor;
|
||||
}
|
||||
else
|
||||
{
|
||||
//charwidth = (hu_font[talk[i]-HU_FONTSTART]->width) * con_scalefactor;
|
||||
V_DrawCharacter(HU_INPUTX + c, y, talk[i++] | cv_constextsize.value | V_NOSCALESTART, true);
|
||||
}
|
||||
if (talk[i] >= FONTSTART)
|
||||
V_DrawCharacter(HU_INPUTX + c, y, talk[i] | cv_constextsize.value | V_NOSCALESTART, true);
|
||||
c += charwidth;
|
||||
}
|
||||
|
||||
if ((strlen(w_chat) == 0 || c_input == 0) && hu_tick < 4)
|
||||
V_DrawCharacter(HU_INPUTX+c, y+2*con_scalefactor, '_' |cv_constextsize.value | V_NOSCALESTART|t, true);
|
||||
|
||||
i = 0;
|
||||
while (w_chat[i])
|
||||
for (i = 0; w_chat[i]; i++)
|
||||
{
|
||||
|
||||
if (c_input == (i+1) && hu_tick < 4)
|
||||
{
|
||||
INT32 cursorx = (HU_INPUTX+c+charwidth < vid.width) ? (HU_INPUTX + c + charwidth) : (HU_INPUTX); // we may have to go down.
|
||||
|
@ -1795,17 +1565,8 @@ static void HU_DrawChat_Old(void)
|
|||
V_DrawCharacter(cursorx, cursory+2*con_scalefactor, '_' |cv_constextsize.value | V_NOSCALESTART|t, true);
|
||||
}
|
||||
|
||||
//Hurdler: isn't it better like that?
|
||||
if (w_chat[i] < HU_FONTSTART)
|
||||
{
|
||||
++i;
|
||||
//charwidth = 4 * con_scalefactor;
|
||||
}
|
||||
else
|
||||
{
|
||||
//charwidth = (hu_font[w_chat[i]-HU_FONTSTART]->width) * con_scalefactor;
|
||||
V_DrawCharacter(HU_INPUTX + c, y, w_chat[i++] | cv_constextsize.value | V_NOSCALESTART | t, true);
|
||||
}
|
||||
if (w_chat[i] >= FONTSTART)
|
||||
V_DrawCharacter(HU_INPUTX + c, y, w_chat[i] | cv_constextsize.value | V_NOSCALESTART | t, true);
|
||||
|
||||
c += charwidth;
|
||||
if (c >= vid.width)
|
||||
|
@ -1814,9 +1575,6 @@ static void HU_DrawChat_Old(void)
|
|||
y += charheight;
|
||||
}
|
||||
}
|
||||
|
||||
if (hu_tick < 4)
|
||||
V_DrawCharacter(HU_INPUTX + c, y, '_' | cv_constextsize.value |V_NOSCALESTART|t, true);
|
||||
}
|
||||
|
||||
// Draw crosshairs at the exact center of the view.
|
||||
|
@ -1902,21 +1660,6 @@ static void HU_DrawCEcho(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void HU_drawGametype(void)
|
||||
{
|
||||
const char *strvalue = NULL;
|
||||
|
||||
if (gametype < 0 || gametype >= gametypecount)
|
||||
return; // not a valid gametype???
|
||||
|
||||
strvalue = Gametype_Names[gametype];
|
||||
|
||||
if (splitscreen)
|
||||
V_DrawString(4, 184, 0, strvalue);
|
||||
else
|
||||
V_DrawString(4, 192, 0, strvalue);
|
||||
}
|
||||
|
||||
//
|
||||
// demo info stuff
|
||||
//
|
||||
|
@ -2778,7 +2521,8 @@ static void HU_DrawRankings(void)
|
|||
UINT32 whiteplayer;
|
||||
|
||||
// draw the current gametype in the lower right
|
||||
HU_drawGametype();
|
||||
if (gametype >= 0 && gametype < gametypecount)
|
||||
V_DrawString(4, splitscreen ? 184 : 192, 0, Gametype_Names[gametype]);
|
||||
|
||||
if (gametyperules & (GTR_TIMELIMIT|GTR_POINTLIMIT))
|
||||
{
|
||||
|
|
|
@ -19,33 +19,34 @@
|
|||
#include "r_defs.h"
|
||||
|
||||
//------------------------------------
|
||||
// heads up font
|
||||
// Fonts & stuff
|
||||
//------------------------------------
|
||||
#define HU_FONTSTART '\x16' // the first font character
|
||||
#define HU_FONTEND '~'
|
||||
|
||||
#define HU_FONTSIZE (HU_FONTEND - HU_FONTSTART + 1)
|
||||
|
||||
// Level title font
|
||||
#define LT_FONTSTART '!' // the first font characters
|
||||
#define LT_FONTEND 'z' // the last font characters
|
||||
#define LT_FONTSIZE (LT_FONTEND - LT_FONTSTART + 1)
|
||||
|
||||
#define CRED_FONTSTART '!' // the first font character
|
||||
#define CRED_FONTEND 'Z' // the last font character
|
||||
#define CRED_FONTSIZE (CRED_FONTEND - CRED_FONTSTART + 1)
|
||||
|
||||
// Name tag font
|
||||
// Used by base and outline font set
|
||||
#define NT_FONTSTART '!' // the first font character
|
||||
#define NT_FONTEND 'Z' // the last font character
|
||||
#define NT_FONTSIZE (NT_FONTEND - NT_FONTSTART + 1)
|
||||
#define FONTSTART '\x16' // the first font character
|
||||
#define FONTEND '~'
|
||||
#define FONTSIZE (FONTEND - FONTSTART + 1)
|
||||
|
||||
#define HU_CROSSHAIRS 3 // maximum of 9 - see HU_Init();
|
||||
|
||||
extern char *shiftxform; // english translation shift table
|
||||
extern char english_shiftxform[];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
patch_t *chars[FONTSIZE];
|
||||
INT32 kerning;
|
||||
UINT32 spacewidth;
|
||||
UINT32 charwidth;
|
||||
UINT32 linespacing;
|
||||
} fontdef_t;
|
||||
|
||||
extern fontdef_t hu_font, tny_font, cred_font, lt_font;
|
||||
extern fontdef_t ntb_font, nto_font;
|
||||
extern patch_t *tallnum[10];
|
||||
extern patch_t *nightsnum[10];
|
||||
extern patch_t *ttlnum[10];
|
||||
extern patch_t *tallminus;
|
||||
extern patch_t *tallinfin;
|
||||
|
||||
//------------------------------------
|
||||
// sorted player lines
|
||||
//------------------------------------
|
||||
|
@ -78,22 +79,12 @@ void HU_AddChatText(const char *text, boolean playsound);
|
|||
// set true when entering a chat message
|
||||
extern boolean chat_on;
|
||||
|
||||
extern patch_t *hu_font[HU_FONTSIZE], *tny_font[HU_FONTSIZE];
|
||||
extern patch_t *tallnum[10];
|
||||
extern patch_t *nightsnum[10];
|
||||
extern patch_t *lt_font[LT_FONTSIZE];
|
||||
extern patch_t *cred_font[CRED_FONTSIZE];
|
||||
extern patch_t *ntb_font[NT_FONTSIZE];
|
||||
extern patch_t *nto_font[NT_FONTSIZE];
|
||||
extern patch_t *ttlnum[10];
|
||||
extern patch_t *emeraldpics[3][8];
|
||||
extern patch_t *rflagico;
|
||||
extern patch_t *bflagico;
|
||||
extern patch_t *rmatcico;
|
||||
extern patch_t *bmatcico;
|
||||
extern patch_t *tagico;
|
||||
extern patch_t *tallminus;
|
||||
extern patch_t *tallinfin;
|
||||
extern patch_t *tokenicon;
|
||||
|
||||
// set true whenever the tab rankings are being shown for any reason
|
||||
|
@ -103,6 +94,8 @@ extern boolean hu_showscores;
|
|||
void HU_Init(void);
|
||||
|
||||
void HU_LoadGraphics(void);
|
||||
void HU_LoadFontCharacters(fontdef_t *font, const char *prefix);
|
||||
void HU_SetFontProperties(fontdef_t *font, INT32 kerning, UINT32 spacewidth, UINT32 charwidth, UINT32 linespacing);
|
||||
|
||||
// reset heads up when consoleplayer respawns.
|
||||
void HU_Start(void);
|
||||
|
|
5290
src/info.c
5290
src/info.c
File diff suppressed because it is too large
Load diff
18
src/info.h
18
src/info.h
|
@ -1078,9 +1078,6 @@ typedef enum sprite
|
|||
NUMSPRITES
|
||||
} spritenum_t;
|
||||
|
||||
// Make sure to be conscious of FF_FRAMEMASK and the fact sprite2 is stored as a UINT8 whenever you change this table.
|
||||
// Currently, FF_FRAMEMASK is 0xff, or 255 - but the second half is used by FF_SPR2SUPER, so the limitation is 0x7f.
|
||||
// Since this is zero-based, there can be at most 128 different SPR2_'s without changing that.
|
||||
typedef enum playersprite
|
||||
{
|
||||
SPR2_STND = 0,
|
||||
|
@ -1160,15 +1157,17 @@ typedef enum playersprite
|
|||
SPR2_XTRA, // stuff that isn't in-map - "would this ever need an md2 or variable length animation?"
|
||||
|
||||
SPR2_FIRSTFREESLOT,
|
||||
SPR2_LASTFREESLOT = 0x7f,
|
||||
SPR2_LASTFREESLOT = 1024, // Do not make higher than SPR2F_MASK (currently 0x3FF) plus one
|
||||
NUMPLAYERSPRITES
|
||||
} playersprite_t;
|
||||
|
||||
// SPR2_XTRA
|
||||
#define XTRA_LIFEPIC 0 // Life icon patch
|
||||
#define XTRA_CHARSEL 1 // Character select picture
|
||||
#define XTRA_CONTINUE 2 // Continue icon
|
||||
#define XTRA_ENDING 3 // Ending finale patches
|
||||
enum
|
||||
{
|
||||
XTRA_LIFEPIC,
|
||||
XTRA_CHARSEL,
|
||||
XTRA_CONTINUE,
|
||||
XTRA_ENDING
|
||||
};
|
||||
|
||||
typedef enum state
|
||||
{
|
||||
|
@ -4380,6 +4379,7 @@ typedef struct
|
|||
INT32 var1;
|
||||
INT32 var2;
|
||||
statenum_t nextstate;
|
||||
UINT16 sprite2;
|
||||
} state_t;
|
||||
|
||||
extern state_t states[NUMSTATES];
|
||||
|
|
|
@ -44,6 +44,21 @@ return luaL_error(L, "HUD rendering code should not call this function!");\
|
|||
else if (hook_cmd_running)\
|
||||
return luaL_error(L, "CMD building code should not call this function!");
|
||||
|
||||
#define NOSPAWNNULL if (type >= NUMMOBJTYPES)\
|
||||
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);\
|
||||
else if (type == MT_NULL)\
|
||||
{\
|
||||
if (!nospawnnull_seen) {\
|
||||
nospawnnull_seen = true;\
|
||||
CONS_Alert(CONS_WARNING,"Spawning an \"MT_NULL\" mobj is deprecated and will be removed.\nUse \"MT_RAY\" instead.\n");\
|
||||
}\
|
||||
type = MT_RAY;\
|
||||
}
|
||||
static boolean nospawnnull_seen = false; // TODO: 2.3: Delete
|
||||
// TODO: 2.3: Use the below NOSPAWNNULL define instead. P_SpawnMobj used to say "if MT_NULL, use MT_RAY instead", so the above define maintains Lua script compatibility until v2.3
|
||||
/*#define NOSPAWNNULL if (type <= MT_NULL || type >= NUMMOBJTYPES)\
|
||||
return luaL_error(L, "mobj type %d out of range (1 - %d)", type, NUMMOBJTYPES-1);*/
|
||||
|
||||
boolean luaL_checkboolean(lua_State *L, int narg) {
|
||||
luaL_checktype(L, narg, LUA_TBOOLEAN);
|
||||
return lua_toboolean(L, narg);
|
||||
|
@ -625,8 +640,7 @@ static int lib_pSpawnMobj(lua_State *L)
|
|||
mobjtype_t type = luaL_checkinteger(L, 4);
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (type >= NUMMOBJTYPES)
|
||||
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||
NOSPAWNNULL
|
||||
LUA_PushUserdata(L, P_SpawnMobj(x, y, z, type), META_MOBJ);
|
||||
return 1;
|
||||
}
|
||||
|
@ -640,10 +654,9 @@ static int lib_pSpawnMobjFromMobj(lua_State *L)
|
|||
mobjtype_t type = luaL_checkinteger(L, 5);
|
||||
NOHUD
|
||||
INLEVEL
|
||||
NOSPAWNNULL
|
||||
if (!actor)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (type >= NUMMOBJTYPES)
|
||||
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||
LUA_PushUserdata(L, P_SpawnMobjFromMobj(actor, x, y, z, type), META_MOBJ);
|
||||
return 1;
|
||||
}
|
||||
|
@ -661,17 +674,15 @@ static int lib_pRemoveMobj(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
// P_IsValidSprite2 technically doesn't exist, and probably never should... but too much would need to be exposed to allow this to be checked by other methods.
|
||||
|
||||
static int lib_pIsValidSprite2(lua_State *L)
|
||||
{
|
||||
mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
UINT8 spr2 = (UINT8)luaL_checkinteger(L, 2);
|
||||
UINT16 spr2 = (UINT16)luaL_checkinteger(L, 2);
|
||||
//HUDSAFE
|
||||
INLEVEL
|
||||
if (!mobj)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
lua_pushboolean(L, (mobj->skin && (((skin_t *)mobj->skin)->sprites[spr2].numframes)));
|
||||
lua_pushboolean(L, mobj->skin && P_IsValidSprite2(mobj->skin, spr2));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -708,10 +719,9 @@ static int lib_pSpawnMissile(lua_State *L)
|
|||
mobjtype_t type = luaL_checkinteger(L, 3);
|
||||
NOHUD
|
||||
INLEVEL
|
||||
NOSPAWNNULL
|
||||
if (!source || !dest)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (type >= NUMMOBJTYPES)
|
||||
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||
LUA_PushUserdata(L, P_SpawnMissile(source, dest, type), META_MOBJ);
|
||||
return 1;
|
||||
}
|
||||
|
@ -726,10 +736,9 @@ static int lib_pSpawnXYZMissile(lua_State *L)
|
|||
fixed_t z = luaL_checkfixed(L, 6);
|
||||
NOHUD
|
||||
INLEVEL
|
||||
NOSPAWNNULL
|
||||
if (!source || !dest)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (type >= NUMMOBJTYPES)
|
||||
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||
LUA_PushUserdata(L, P_SpawnXYZMissile(source, dest, type, x, y, z), META_MOBJ);
|
||||
return 1;
|
||||
}
|
||||
|
@ -746,10 +755,9 @@ static int lib_pSpawnPointMissile(lua_State *L)
|
|||
fixed_t z = luaL_checkfixed(L, 8);
|
||||
NOHUD
|
||||
INLEVEL
|
||||
NOSPAWNNULL
|
||||
if (!source)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (type >= NUMMOBJTYPES)
|
||||
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||
LUA_PushUserdata(L, P_SpawnPointMissile(source, xa, ya, za, type, x, y, z), META_MOBJ);
|
||||
return 1;
|
||||
}
|
||||
|
@ -764,10 +772,9 @@ static int lib_pSpawnAlteredDirectionMissile(lua_State *L)
|
|||
INT32 shiftingAngle = (INT32)luaL_checkinteger(L, 5);
|
||||
NOHUD
|
||||
INLEVEL
|
||||
NOSPAWNNULL
|
||||
if (!source)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (type >= NUMMOBJTYPES)
|
||||
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||
LUA_PushUserdata(L, P_SpawnAlteredDirectionMissile(source, type, x, y, z, shiftingAngle), META_MOBJ);
|
||||
return 1;
|
||||
}
|
||||
|
@ -795,10 +802,9 @@ static int lib_pSPMAngle(lua_State *L)
|
|||
UINT32 flags2 = (UINT32)luaL_optinteger(L, 5, 0);
|
||||
NOHUD
|
||||
INLEVEL
|
||||
NOSPAWNNULL
|
||||
if (!source)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (type >= NUMMOBJTYPES)
|
||||
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||
LUA_PushUserdata(L, P_SPMAngle(source, type, angle, allowaim, flags2), META_MOBJ);
|
||||
return 1;
|
||||
}
|
||||
|
@ -810,10 +816,9 @@ static int lib_pSpawnPlayerMissile(lua_State *L)
|
|||
UINT32 flags2 = (UINT32)luaL_optinteger(L, 3, 0);
|
||||
NOHUD
|
||||
INLEVEL
|
||||
NOSPAWNNULL
|
||||
if (!source)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (type >= NUMMOBJTYPES)
|
||||
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||
LUA_PushUserdata(L, P_SpawnPlayerMissile(source, type, flags2), META_MOBJ);
|
||||
return 1;
|
||||
}
|
||||
|
@ -844,8 +849,7 @@ static int lib_pWeaponOrPanel(lua_State *L)
|
|||
{
|
||||
mobjtype_t type = luaL_checkinteger(L, 1);
|
||||
//HUDSAFE
|
||||
if (type >= NUMMOBJTYPES)
|
||||
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||
NOSPAWNNULL
|
||||
lua_pushboolean(L, P_WeaponOrPanel(type));
|
||||
return 1;
|
||||
}
|
||||
|
@ -888,8 +892,7 @@ static int lib_pSpawnParaloop(lua_State *L)
|
|||
boolean spawncenter = lua_optboolean(L, 9);
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (type >= NUMMOBJTYPES)
|
||||
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||
NOSPAWNNULL
|
||||
if (nstate >= NUMSTATES)
|
||||
return luaL_error(L, "state %d out of range (0 - %d)", nstate, NUMSTATES-1);
|
||||
P_SpawnParaloop(x, y, z, radius, number, type, nstate, rotangle, spawncenter);
|
||||
|
@ -924,13 +927,14 @@ static int lib_pSetScale(lua_State *L)
|
|||
{
|
||||
mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
fixed_t newscale = luaL_checkfixed(L, 2);
|
||||
boolean instant = lua_optboolean(L, 3);
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!mobj)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (newscale < FRACUNIT/100)
|
||||
newscale = FRACUNIT/100;
|
||||
P_SetScale(mobj, newscale);
|
||||
P_SetScale(mobj, newscale, instant);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1762,10 +1766,9 @@ static int lib_pSpawnSpinMobj(lua_State *L)
|
|||
mobjtype_t type = luaL_checkinteger(L, 2);
|
||||
NOHUD
|
||||
INLEVEL
|
||||
NOSPAWNNULL
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
if (type >= NUMMOBJTYPES)
|
||||
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||
P_SpawnSpinMobj(player, type);
|
||||
return 0;
|
||||
}
|
||||
|
@ -2497,6 +2500,17 @@ static int lib_pDoSuperTransformation(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lib_pDoSuperDetransformation(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
P_DoSuperDetransformation(player);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_pExplodeMissile(lua_State *L)
|
||||
{
|
||||
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
|
@ -2711,12 +2725,11 @@ static int lib_pFadeLight(lua_State *L)
|
|||
|
||||
static int lib_pIsFlagAtBase(lua_State *L)
|
||||
{
|
||||
mobjtype_t flag = luaL_checkinteger(L, 1);
|
||||
mobjtype_t type = luaL_checkinteger(L, 1);
|
||||
//HUDSAFE
|
||||
INLEVEL
|
||||
if (flag >= NUMMOBJTYPES)
|
||||
return luaL_error(L, "mobj type %d out of range (0 - %d)", flag, NUMMOBJTYPES-1);
|
||||
lua_pushboolean(L, P_IsFlagAtBase(flag));
|
||||
NOSPAWNNULL
|
||||
lua_pushboolean(L, P_IsFlagAtBase(type));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -3024,6 +3037,9 @@ static int lib_rFrame2Char(lua_State *L)
|
|||
return 2;
|
||||
}
|
||||
|
||||
// R_SKINS
|
||||
////////////
|
||||
|
||||
// R_SetPlayerSkin technically doesn't exist either, although it's basically just SetPlayerSkin and SetPlayerSkinByNum handled in one place for convenience
|
||||
static int lib_rSetPlayerSkin(lua_State *L)
|
||||
{
|
||||
|
@ -3086,6 +3102,47 @@ static int lib_rSkinUsable(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int lib_pGetStateSprite2(lua_State *L)
|
||||
{
|
||||
int statenum = luaL_checkinteger(L, 1);
|
||||
if (statenum < 0 || statenum >= NUMSTATES)
|
||||
return luaL_error(L, "state %d out of range (0 - %d)", statenum, NUMSTATES-1);
|
||||
|
||||
lua_pushinteger(L, P_GetStateSprite2(&states[statenum]));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_pGetSprite2StateFrame(lua_State *L)
|
||||
{
|
||||
int statenum = luaL_checkinteger(L, 1);
|
||||
if (statenum < 0 || statenum >= NUMSTATES)
|
||||
return luaL_error(L, "state %d out of range (0 - %d)", statenum, NUMSTATES-1);
|
||||
|
||||
lua_pushinteger(L, P_GetSprite2StateFrame(&states[statenum]));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_pIsStateSprite2Super(lua_State *L)
|
||||
{
|
||||
int statenum = luaL_checkinteger(L, 1);
|
||||
if (statenum < 0 || statenum >= NUMSTATES)
|
||||
return luaL_error(L, "state %d out of range (0 - %d)", statenum, NUMSTATES-1);
|
||||
|
||||
lua_pushboolean(L, P_IsStateSprite2Super(&states[statenum]));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Not a real function. Who cares? I know I don't.
|
||||
static int lib_pGetSuperSprite2(lua_State *L)
|
||||
{
|
||||
int animID = luaL_checkinteger(L, 1) & SPR2F_MASK;
|
||||
if (animID < 0 || animID >= NUMPLAYERSPRITES)
|
||||
return luaL_error(L, "sprite2 %d out of range (0 - %d)", animID, NUMPLAYERSPRITES-1);
|
||||
|
||||
lua_pushinteger(L, animID | SPR2F_SUPER);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// R_DATA
|
||||
////////////
|
||||
|
||||
|
@ -4450,6 +4507,7 @@ static luaL_Reg lib[] = {
|
|||
{"P_VectorInstaThrust",lib_pVectorInstaThrust},
|
||||
{"P_SetMobjStateNF",lib_pSetMobjStateNF},
|
||||
{"P_DoSuperTransformation",lib_pDoSuperTransformation},
|
||||
{"P_DoSuperDetransformation",lib_pDoSuperDetransformation},
|
||||
{"P_ExplodeMissile",lib_pExplodeMissile},
|
||||
{"P_MobjTouchingSectorSpecial",lib_pMobjTouchingSectorSpecial},
|
||||
{"P_ThingOnSpecial3DFloor",lib_pThingOnSpecial3DFloor},
|
||||
|
@ -4490,7 +4548,13 @@ static luaL_Reg lib[] = {
|
|||
{"R_Char2Frame",lib_rChar2Frame},
|
||||
{"R_Frame2Char",lib_rFrame2Char},
|
||||
{"R_SetPlayerSkin",lib_rSetPlayerSkin},
|
||||
|
||||
// r_skins
|
||||
{"R_SkinUsable",lib_rSkinUsable},
|
||||
{"P_GetStateSprite2",lib_pGetStateSprite2},
|
||||
{"P_GetSprite2StateFrame",lib_pGetSprite2StateFrame},
|
||||
{"P_IsStateSprite2Super",lib_pIsStateSprite2Super},
|
||||
{"P_GetSuperSprite2",lib_pGetSuperSprite2},
|
||||
|
||||
// r_data
|
||||
{"R_CheckTextureNumForName",lib_rCheckTextureNumForName},
|
||||
|
|
|
@ -47,6 +47,7 @@ static const char *const hud_disable_options[] = {
|
|||
"time",
|
||||
"rings",
|
||||
"lives",
|
||||
"input",
|
||||
|
||||
"weaponrings",
|
||||
"powerstones",
|
||||
|
@ -70,6 +71,10 @@ static const char *const hud_disable_options[] = {
|
|||
"intermissionemeralds",
|
||||
NULL};
|
||||
|
||||
// you know, let's actually make sure that the table is synced.
|
||||
// because fuck knows how many times this has happened at this point. :v
|
||||
I_StaticAssert(sizeof(hud_disable_options) / sizeof(*hud_disable_options) == hud_MAX+1);
|
||||
|
||||
enum hudinfo {
|
||||
hudinfo_x = 0,
|
||||
hudinfo_y,
|
||||
|
@ -551,7 +556,7 @@ static int libd_getSprite2Patch(lua_State *L)
|
|||
UINT8 angle = 0;
|
||||
spritedef_t *sprdef;
|
||||
spriteframe_t *sprframe;
|
||||
boolean super = false; // add FF_SPR2SUPER to sprite2 if true
|
||||
boolean super = false; // add SPR2F_SUPER to sprite2 if true
|
||||
HUDONLY
|
||||
|
||||
// get skin first!
|
||||
|
@ -578,11 +583,12 @@ static int libd_getSprite2Patch(lua_State *L)
|
|||
if (lua_isnumber(L, 1)) // sprite number given, e.g. SPR2_STND
|
||||
{
|
||||
j = lua_tonumber(L, 1);
|
||||
if (j & FF_SPR2SUPER) // e.g. SPR2_STND|FF_SPR2SUPER
|
||||
if (j & SPR2F_SUPER) // e.g. SPR2_STND|SPR2F_SUPER
|
||||
{
|
||||
super = true;
|
||||
j &= ~FF_SPR2SUPER; // remove flag so the next check doesn't fail
|
||||
j &= ~SPR2F_SUPER; // remove flag so the next check doesn't fail
|
||||
}
|
||||
|
||||
if (j >= free_spr2)
|
||||
return 0;
|
||||
}
|
||||
|
@ -601,17 +607,15 @@ static int libd_getSprite2Patch(lua_State *L)
|
|||
|
||||
if (lua_isboolean(L, 2)) // optional boolean for superness
|
||||
{
|
||||
super = lua_toboolean(L, 2); // note: this can override FF_SPR2SUPER from sprite number
|
||||
super = lua_toboolean(L, 2); // note: this can override SPR2F_SUPER from sprite number
|
||||
lua_remove(L, 2); // remove
|
||||
}
|
||||
// if it's not boolean then just assume it's the frame number
|
||||
|
||||
if (super)
|
||||
j |= FF_SPR2SUPER;
|
||||
j |= SPR2F_SUPER;
|
||||
|
||||
j = P_GetSkinSprite2(skins[i], j, NULL); // feed skin and current sprite2 through to change sprite2 used if necessary
|
||||
|
||||
sprdef = &skins[i]->sprites[j];
|
||||
sprdef = P_GetSkinSpritedef(skins[i], j);
|
||||
|
||||
// set frame number
|
||||
frame = luaL_optinteger(L, 2, 0);
|
||||
|
@ -639,7 +643,7 @@ static int libd_getSprite2Patch(lua_State *L)
|
|||
INT32 rot = R_GetRollAngle(rollangle);
|
||||
|
||||
if (rot) {
|
||||
patch_t *rotsprite = Patch_GetRotatedSprite(sprframe, frame, angle, sprframe->flip & (1<<angle), &skins[i]->sprinfo[j], rot);
|
||||
patch_t *rotsprite = Patch_GetRotatedSprite(sprframe, frame, angle, sprframe->flip & (1<<angle), P_GetSkinSpriteInfo(skins[i], j), rot);
|
||||
LUA_PushUserdata(L, rotsprite, META_PATCH);
|
||||
lua_pushboolean(L, false);
|
||||
lua_pushboolean(L, true);
|
||||
|
|
|
@ -165,7 +165,7 @@ static int lib_getSpr2default(lua_State *L)
|
|||
static int lib_setSpr2default(lua_State *L)
|
||||
{
|
||||
playersprite_t i;
|
||||
UINT8 j = 0;
|
||||
UINT16 j = 0;
|
||||
|
||||
if (hud_running)
|
||||
return luaL_error(L, "Do not alter spr2defaults[] in HUD rendering code!");
|
||||
|
|
|
@ -564,7 +564,7 @@ static int mobj_set(lua_State *L)
|
|||
mo->frame = (UINT32)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case mobj_sprite2:
|
||||
mo->sprite2 = P_GetSkinSprite2(((skin_t *)mo->skin), (UINT8)luaL_checkinteger(L, 3), mo->player);
|
||||
mo->sprite2 = P_GetSkinSprite2(((skin_t *)mo->skin), (UINT16)luaL_checkinteger(L, 3), mo->player);
|
||||
break;
|
||||
case mobj_anim_duration:
|
||||
mo->anim_duration = (UINT16)luaL_checkinteger(L, 3);
|
||||
|
@ -762,7 +762,7 @@ static int mobj_set(lua_State *L)
|
|||
return luaL_error(L, "mobj.type %d out of range (0 - %d).", newtype, NUMMOBJTYPES-1);
|
||||
mo->type = newtype;
|
||||
mo->info = &mobjinfo[newtype];
|
||||
P_SetScale(mo, mo->scale);
|
||||
P_SetScale(mo, mo->scale, false);
|
||||
break;
|
||||
}
|
||||
case mobj_info:
|
||||
|
@ -836,9 +836,7 @@ static int mobj_set(lua_State *L)
|
|||
fixed_t scale = luaL_checkfixed(L, 3);
|
||||
if (scale < FRACUNIT/100)
|
||||
scale = FRACUNIT/100;
|
||||
mo->destscale = scale;
|
||||
P_SetScale(mo, scale);
|
||||
mo->old_scale = scale;
|
||||
P_SetScale(mo, scale, true);
|
||||
break;
|
||||
}
|
||||
case mobj_destscale:
|
||||
|
|
|
@ -55,6 +55,7 @@ enum skin {
|
|||
skin_contangle,
|
||||
skin_soundsid,
|
||||
skin_sprites,
|
||||
skin_supersprites,
|
||||
skin_natkcolor
|
||||
};
|
||||
|
||||
|
@ -95,6 +96,7 @@ static const char *const skin_opt[] = {
|
|||
"contangle",
|
||||
"soundsid",
|
||||
"sprites",
|
||||
"supersprites",
|
||||
"natkcolor",
|
||||
NULL};
|
||||
|
||||
|
@ -220,6 +222,9 @@ static int skin_get(lua_State *L)
|
|||
case skin_sprites:
|
||||
LUA_PushUserdata(L, skin->sprites, META_SKINSPRITES);
|
||||
break;
|
||||
case skin_supersprites:
|
||||
LUA_PushUserdata(L, skin->super.sprites, META_SKINSPRITES);
|
||||
break;
|
||||
case skin_natkcolor:
|
||||
lua_pushinteger(L, skin->natkcolor);
|
||||
break;
|
||||
|
@ -347,17 +352,17 @@ static int lib_getSkinSprite(lua_State *L)
|
|||
spritedef_t *sksprites = *(spritedef_t **)luaL_checkudata(L, 1, META_SKINSPRITES);
|
||||
playersprite_t i = luaL_checkinteger(L, 2);
|
||||
|
||||
if (i < 0 || i >= NUMPLAYERSPRITES*2)
|
||||
return luaL_error(L, LUA_QL("skin_t") " field 'sprites' index %d out of range (0 - %d)", i, (NUMPLAYERSPRITES*2)-1);
|
||||
if (i < 0 || i >= NUMPLAYERSPRITES)
|
||||
return luaL_error(L, "skin sprites index %d out of range (0 - %d)", i, NUMPLAYERSPRITES-1);
|
||||
|
||||
LUA_PushUserdata(L, &sksprites[i], META_SKINSPRITESLIST);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// #skin.sprites -> NUMPLAYERSPRITES*2
|
||||
// #skin.sprites -> NUMPLAYERSPRITES
|
||||
static int lib_numSkinsSprites(lua_State *L)
|
||||
{
|
||||
lua_pushinteger(L, NUMPLAYERSPRITES*2);
|
||||
lua_pushinteger(L, NUMPLAYERSPRITES);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
193
src/m_menu.c
193
src/m_menu.c
|
@ -1069,9 +1069,9 @@ static menuitem_t OP_ChangeControlsMenu[] =
|
|||
{IT_CALL | IT_STRING2, NULL, "Move Backward", M_ChangeControl, GC_BACKWARD },
|
||||
{IT_CALL | IT_STRING2, NULL, "Move Left", M_ChangeControl, GC_STRAFELEFT },
|
||||
{IT_CALL | IT_STRING2, NULL, "Move Right", M_ChangeControl, GC_STRAFERIGHT },
|
||||
{IT_CALL | IT_STRING2, NULL, "Jump", M_ChangeControl, GC_JUMP },
|
||||
{IT_CALL | IT_STRING2, NULL, "Spin", M_ChangeControl, GC_SPIN },
|
||||
{IT_CALL | IT_STRING2, NULL, "Shield", M_ChangeControl, GC_SHIELD },
|
||||
{IT_CALL | IT_STRING2, NULL, "Jump", M_ChangeControl, GC_JUMP },
|
||||
{IT_CALL | IT_STRING2, NULL, "Spin", M_ChangeControl, GC_SPIN },
|
||||
{IT_CALL | IT_STRING2, NULL, "Shield Ability", M_ChangeControl, GC_SHIELD },
|
||||
{IT_HEADER, NULL, "Camera", NULL, 0},
|
||||
{IT_SPACE, NULL, NULL, NULL, 0}, // padding
|
||||
{IT_CALL | IT_STRING2, NULL, "Look Up", M_ChangeControl, GC_LOOKUP },
|
||||
|
@ -1120,13 +1120,15 @@ static menuitem_t OP_ChangeControlsMenu[] =
|
|||
|
||||
static menuitem_t OP_Joystick1Menu[] =
|
||||
{
|
||||
{IT_STRING | IT_CALL, NULL, "Select Gamepad...", M_Setup1PJoystickMenu, 10},
|
||||
{IT_STRING | IT_CVAR, NULL, "Move \x17 Axis" , &cv_moveaxis , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Move \x18 Axis" , &cv_sideaxis , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera \x17 Axis" , &cv_lookaxis , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera \x18 Axis" , &cv_turnaxis , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Jump Axis" , &cv_jumpaxis , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spin Axis" , &cv_spinaxis , 80},
|
||||
{IT_STRING | IT_CALL, NULL, "Select Gamepad...", M_Setup1PJoystickMenu, 0},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Move \x17 Axis" , &cv_moveaxis , 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Move \x18 Axis" , &cv_sideaxis , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera \x17 Axis" , &cv_lookaxis , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera \x18 Axis" , &cv_turnaxis , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Jump Axis" , &cv_jumpaxis , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spin Axis" , &cv_spinaxis , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Shield Axis" , &cv_shieldaxis , 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Fire Axis" , &cv_fireaxis , 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "Fire Normal Axis" , &cv_firenaxis ,100},
|
||||
|
||||
|
@ -1138,13 +1140,15 @@ static menuitem_t OP_Joystick1Menu[] =
|
|||
|
||||
static menuitem_t OP_Joystick2Menu[] =
|
||||
{
|
||||
{IT_STRING | IT_CALL, NULL, "Select Gamepad...", M_Setup2PJoystickMenu, 10},
|
||||
{IT_STRING | IT_CVAR, NULL, "Move \x17 Axis" , &cv_moveaxis2 , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Move \x18 Axis" , &cv_sideaxis2 , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera \x17 Axis" , &cv_lookaxis2 , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera \x18 Axis" , &cv_turnaxis2 , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Jump Axis" , &cv_jumpaxis2 , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spin Axis" , &cv_spinaxis2 , 80},
|
||||
{IT_STRING | IT_CALL, NULL, "Select Gamepad...", M_Setup2PJoystickMenu, 0},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Move \x17 Axis" , &cv_moveaxis2 , 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Move \x18 Axis" , &cv_sideaxis2 , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera \x17 Axis" , &cv_lookaxis2 , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera \x18 Axis" , &cv_turnaxis2 , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Jump Axis" , &cv_jumpaxis2 , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spin Axis" , &cv_spinaxis2 , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Shield Axis" , &cv_shieldaxis2 , 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Fire Axis" , &cv_fireaxis2 , 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "Fire Normal Axis" , &cv_firenaxis2 ,100},
|
||||
|
||||
|
@ -3424,7 +3428,7 @@ boolean M_Responder(event_t *ev)
|
|||
// ignore ev_keydown events if the key maps to a character, since
|
||||
// the ev_text event will follow immediately after in that case.
|
||||
if (ev->type == ev_keydown && ch >= 32 && ch <= 127)
|
||||
return false;
|
||||
return true;
|
||||
|
||||
if (M_ChangeStringCvar(ch))
|
||||
return true;
|
||||
|
@ -4950,22 +4954,6 @@ static void M_DrawCenteredMenu(void)
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// M_StringHeight
|
||||
//
|
||||
// Find string height from hu_font chars
|
||||
//
|
||||
static inline size_t M_StringHeight(const char *string)
|
||||
{
|
||||
size_t h = 8, i;
|
||||
|
||||
for (i = 0; i < strlen(string); i++)
|
||||
if (string[i] == '\n')
|
||||
h += 8;
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
// Extraneous menu patching functions
|
||||
// ==========================================================================
|
||||
|
@ -6083,56 +6071,16 @@ menu_t MessageDef =
|
|||
NULL
|
||||
};
|
||||
|
||||
|
||||
void M_StartMessage(const char *string, void *routine,
|
||||
menumessagetype_t itemtype)
|
||||
void M_StartMessage(const char *string, void *routine, menumessagetype_t itemtype)
|
||||
{
|
||||
size_t max = 0, start = 0, i, strlines;
|
||||
static char *message = NULL;
|
||||
static char *message;
|
||||
Z_Free(message);
|
||||
message = Z_StrDup(string);
|
||||
message = V_WordWrap(0,0,V_ALLOWLOWERCASE,string);
|
||||
DEBFILE(message);
|
||||
|
||||
// Rudementary word wrapping.
|
||||
// Simple and effective. Does not handle nonuniform letter sizes, colors, etc. but who cares.
|
||||
strlines = 0;
|
||||
for (i = 0; message[i]; i++)
|
||||
{
|
||||
if (message[i] == ' ')
|
||||
{
|
||||
start = i;
|
||||
max += 4;
|
||||
}
|
||||
else if (message[i] == '\n')
|
||||
{
|
||||
strlines = i;
|
||||
start = 0;
|
||||
max = 0;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
max += 8;
|
||||
|
||||
// Start trying to wrap if presumed length exceeds the screen width.
|
||||
if (max >= BASEVIDWIDTH && start > 0)
|
||||
{
|
||||
message[start] = '\n';
|
||||
max -= (start-strlines)*8;
|
||||
strlines = start;
|
||||
start = 0;
|
||||
}
|
||||
}
|
||||
|
||||
start = 0;
|
||||
max = 0;
|
||||
|
||||
M_StartControlPanel(); // can't put menuactive to true
|
||||
|
||||
if (currentMenu == &MessageDef) // Prevent recursion
|
||||
MessageDef.prevMenu = &MainDef;
|
||||
else
|
||||
MessageDef.prevMenu = currentMenu;
|
||||
|
||||
MessageDef.prevMenu = (currentMenu == &MessageDef) ? &MainDef : currentMenu; // Prevent recursion
|
||||
MessageDef.menuitems[0].text = message;
|
||||
MessageDef.menuitems[0].alphaKey = (UINT8)itemtype;
|
||||
if (!routine && itemtype != MM_NOTHING) itemtype = MM_NOTHING;
|
||||
|
@ -6151,51 +6099,17 @@ void M_StartMessage(const char *string, void *routine,
|
|||
MessageDef.menuitems[0].itemaction = routine;
|
||||
break;
|
||||
}
|
||||
//added : 06-02-98: now draw a textbox around the message
|
||||
// compute lenght max and the numbers of lines
|
||||
for (strlines = 0; *(message+start); strlines++)
|
||||
{
|
||||
for (i = 0;i < strlen(message+start);i++)
|
||||
{
|
||||
if (*(message+start+i) == '\n')
|
||||
{
|
||||
if (i > max)
|
||||
max = i;
|
||||
start += i;
|
||||
i = (size_t)-1; //added : 07-02-98 : damned!
|
||||
start++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
MessageDef.x = (INT16)((BASEVIDWIDTH - V_StringWidth(message, 0)-32)/2);
|
||||
MessageDef.y = (INT16)((BASEVIDHEIGHT - V_StringHeight(message, V_RETURN8))/2);
|
||||
|
||||
if (i == strlen(message+start))
|
||||
start += i;
|
||||
}
|
||||
|
||||
MessageDef.x = (INT16)((BASEVIDWIDTH - 8*max-16)/2);
|
||||
MessageDef.y = (INT16)((BASEVIDHEIGHT - M_StringHeight(message))/2);
|
||||
|
||||
MessageDef.lastOn = (INT16)((strlines<<8)+max);
|
||||
|
||||
//M_SetupNextMenu();
|
||||
currentMenu = &MessageDef;
|
||||
itemOn = 0;
|
||||
}
|
||||
|
||||
#define MAXMSGLINELEN 256
|
||||
|
||||
static void M_DrawMessageMenu(void)
|
||||
{
|
||||
INT32 y = currentMenu->y;
|
||||
size_t i, start = 0;
|
||||
INT16 max;
|
||||
char string[MAXMSGLINELEN];
|
||||
INT32 mlines;
|
||||
const char *msg = currentMenu->menuitems[0].text;
|
||||
|
||||
mlines = currentMenu->lastOn>>8;
|
||||
max = (INT16)((UINT8)(currentMenu->lastOn & 0xFF)*8);
|
||||
|
||||
// hack: draw RA background in RA menus
|
||||
if (gamestate == GS_TIMEATTACK)
|
||||
{
|
||||
|
@ -6219,51 +6133,8 @@ static void M_DrawMessageMenu(void)
|
|||
V_DrawFadeScreen(0xFF00, curfadevalue);
|
||||
}
|
||||
|
||||
M_DrawTextBox(currentMenu->x, y - 8, (max+7)>>3, mlines);
|
||||
|
||||
while (*(msg+start))
|
||||
{
|
||||
size_t len = strlen(msg+start);
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (*(msg+start+i) == '\n')
|
||||
{
|
||||
memset(string, 0, MAXMSGLINELEN);
|
||||
if (i >= MAXMSGLINELEN)
|
||||
{
|
||||
CONS_Printf("M_DrawMessageMenu: too long segment in %s\n", msg);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
strncpy(string,msg+start, i);
|
||||
string[i] = '\0';
|
||||
start += i;
|
||||
i = (size_t)-1; //added : 07-02-98 : damned!
|
||||
start++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == strlen(msg+start))
|
||||
{
|
||||
if (i >= MAXMSGLINELEN)
|
||||
{
|
||||
CONS_Printf("M_DrawMessageMenu: too long segment in %s\n", msg);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(string, msg + start);
|
||||
start += i;
|
||||
}
|
||||
}
|
||||
|
||||
V_DrawString((BASEVIDWIDTH - V_StringWidth(string, 0))/2,y,V_ALLOWLOWERCASE,string);
|
||||
y += 8; //hu_font[0]->height;
|
||||
}
|
||||
M_DrawTextBox(currentMenu->x, currentMenu->y - 8, 2+V_StringWidth(msg, 0)/8, V_StringHeight(msg, V_RETURN8)/8);
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, currentMenu->y, V_ALLOWLOWERCASE|V_RETURN8, msg);
|
||||
}
|
||||
|
||||
// default message handler
|
||||
|
@ -7950,7 +7821,7 @@ static void M_DrawSoundTest(void)
|
|||
{
|
||||
V_DrawFill(165+140-9, y-4, 8, 16, 150);
|
||||
//V_DrawCharacter(165+140-8, y, '\x19' | V_YELLOWMAP, false);
|
||||
V_DrawFixedPatch((165+140-9)<<FRACBITS, (y<<FRACBITS)-(bounce*4), FRACUNIT, 0, hu_font['\x19'-HU_FONTSTART], V_GetStringColormap(V_YELLOWMAP));
|
||||
V_DrawFixedPatch((165+140-9)<<FRACBITS, (y<<FRACBITS)-(bounce*4), FRACUNIT, 0, hu_font.chars['\x19'-FONTSTART], V_GetStringColormap(V_YELLOWMAP));
|
||||
}
|
||||
}
|
||||
t++;
|
||||
|
@ -12050,7 +11921,7 @@ static void M_HandleConnectIP(INT32 choice)
|
|||
|
||||
static fixed_t multi_tics;
|
||||
static UINT8 multi_frame;
|
||||
static UINT8 multi_spr2;
|
||||
static UINT16 multi_spr2;
|
||||
static boolean multi_paused;
|
||||
static boolean multi_invcolor;
|
||||
|
||||
|
|
|
@ -1362,7 +1362,7 @@ static void IdleUpdate(void)
|
|||
|
||||
for (i = 1; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (cv_idletime.value && playeringame[i] && playernode[i] != UINT8_MAX && !players[i].quittime && !players[i].spectator && !players[i].bot && !IsPlayerAdmin(i) && i != serverplayer)
|
||||
if (cv_idletime.value && playeringame[i] && playernode[i] != UINT8_MAX && !players[i].quittime && !players[i].spectator && !players[i].bot && !IsPlayerAdmin(i) && i != serverplayer && gamestate == GS_LEVEL)
|
||||
{
|
||||
if (players[i].cmd.forwardmove || players[i].cmd.sidemove || players[i].cmd.buttons)
|
||||
players[i].lastinputtime = 0;
|
||||
|
|
|
@ -671,6 +671,13 @@ void D_RegisterClientCommands(void)
|
|||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
sprintf(player_names[i], "Player %d", 1 + i);
|
||||
|
||||
CV_RegisterVar(&cv_gravity);
|
||||
CV_RegisterVar(&cv_tailspickup);
|
||||
CV_RegisterVar(&cv_allowmlook);
|
||||
CV_RegisterVar(&cv_flipcam);
|
||||
CV_RegisterVar(&cv_flipcam2);
|
||||
CV_RegisterVar(&cv_movebob);
|
||||
|
||||
if (dedicated)
|
||||
return;
|
||||
|
||||
|
@ -815,6 +822,8 @@ void D_RegisterClientCommands(void)
|
|||
CV_RegisterVar(&cv_jumpaxis2);
|
||||
CV_RegisterVar(&cv_spinaxis);
|
||||
CV_RegisterVar(&cv_spinaxis2);
|
||||
CV_RegisterVar(&cv_shieldaxis);
|
||||
CV_RegisterVar(&cv_shieldaxis2);
|
||||
CV_RegisterVar(&cv_fireaxis);
|
||||
CV_RegisterVar(&cv_fireaxis2);
|
||||
CV_RegisterVar(&cv_firenaxis);
|
||||
|
@ -899,13 +908,6 @@ void D_RegisterClientCommands(void)
|
|||
|
||||
// screen.c
|
||||
CV_RegisterVar(&cv_fullscreen);
|
||||
CV_RegisterVar(&cv_renderview);
|
||||
CV_RegisterVar(&cv_renderhitboxinterpolation);
|
||||
CV_RegisterVar(&cv_renderhitboxgldepth);
|
||||
CV_RegisterVar(&cv_renderhitbox);
|
||||
CV_RegisterVar(&cv_renderwalls);
|
||||
CV_RegisterVar(&cv_renderfloors);
|
||||
CV_RegisterVar(&cv_renderthings);
|
||||
CV_RegisterVar(&cv_renderer);
|
||||
CV_RegisterVar(&cv_scr_depth);
|
||||
CV_RegisterVar(&cv_scr_width);
|
||||
|
@ -926,8 +928,6 @@ void D_RegisterClientCommands(void)
|
|||
CV_RegisterVar(&cv_opflags);
|
||||
CV_RegisterVar(&cv_ophoopflags);
|
||||
CV_RegisterVar(&cv_mapthingnum);
|
||||
// CV_RegisterVar(&cv_grid);
|
||||
// CV_RegisterVar(&cv_snapto);
|
||||
|
||||
CV_RegisterVar(&cv_freedemocamera);
|
||||
|
||||
|
|
|
@ -94,7 +94,10 @@ extern consvar_t cv_inttime, cv_coopstarposts, cv_cooplives, cv_advancemap, cv_p
|
|||
extern consvar_t cv_overtime;
|
||||
extern consvar_t cv_startinglives;
|
||||
|
||||
// for F_finale.c
|
||||
extern consvar_t cv_gravity, cv_movebob;
|
||||
extern consvar_t cv_tailspickup;
|
||||
|
||||
// for f_finale.c
|
||||
extern consvar_t cv_rollingdemos;
|
||||
|
||||
extern consvar_t cv_ringslinger, cv_soundtest;
|
||||
|
@ -105,7 +108,6 @@ extern consvar_t cv_maxping;
|
|||
extern consvar_t cv_pingtimeout;
|
||||
extern consvar_t cv_showping;
|
||||
|
||||
|
||||
extern consvar_t cv_skipmapcheck;
|
||||
|
||||
extern consvar_t cv_sleep;
|
||||
|
|
150
src/p_enemy.c
150
src/p_enemy.c
|
@ -1222,8 +1222,7 @@ static void P_FaceStabFlume(mobj_t *actor)
|
|||
if (P_MobjWasRemoved(flume))
|
||||
return;
|
||||
|
||||
flume->destscale = actor->scale*3;
|
||||
P_SetScale(flume, flume->destscale);
|
||||
P_SetScale(flume, 3*actor->scale, true);
|
||||
P_SetTarget(&flume->target, actor);
|
||||
flume->sprite = SPR_JETF;
|
||||
flume->frame = FF_FULLBRIGHT;
|
||||
|
@ -1342,8 +1341,7 @@ void A_FaceStabHurl(mobj_t *actor)
|
|||
{
|
||||
hwork = hwork->hnext;
|
||||
hwork->angle = actor->angle + ANGLE_90;
|
||||
hwork->destscale = FixedSqrt(step*basesize);
|
||||
P_SetScale(hwork, hwork->destscale);
|
||||
P_SetScale(hwork, FixedSqrt(step*basesize), true);
|
||||
hwork->fuse = 2;
|
||||
P_MoveOrigin(hwork, actor->x + xo*(15-step), actor->y + yo*(15-step), actor->z + (actor->height - hwork->height)/2 + (P_MobjFlip(actor)*(8<<FRACBITS)));
|
||||
if (P_MobjWasRemoved(hwork))
|
||||
|
@ -2486,7 +2484,7 @@ void A_VultureBlast(mobj_t *actor)
|
|||
if (P_MobjWasRemoved(dust))
|
||||
continue;
|
||||
|
||||
P_SetScale(dust, 4*FRACUNIT);
|
||||
P_SetScale(dust, 4*FRACUNIT, true);
|
||||
dust->destscale = FRACUNIT;
|
||||
dust->scalespeed = 4*FRACUNIT/TICRATE;
|
||||
dust->fuse = TICRATE;
|
||||
|
@ -2556,7 +2554,7 @@ void A_VultureFly(mobj_t *actor)
|
|||
dust = P_SpawnMobj(actor->x + P_RandomFixed() - FRACUNIT/2, actor->y + P_RandomFixed() - FRACUNIT/2, actor->z + actor->height/2 + P_RandomFixed() - FRACUNIT/2, MT_PARTICLE);
|
||||
if (!P_MobjWasRemoved(dust))
|
||||
{
|
||||
P_SetScale(dust, 2*FRACUNIT);
|
||||
P_SetScale(dust, 2*FRACUNIT, true);
|
||||
dust->destscale = FRACUNIT/3;
|
||||
dust->scalespeed = FRACUNIT/40;
|
||||
dust->fuse = TICRATE*2;
|
||||
|
@ -2765,15 +2763,9 @@ void A_LobShot(mobj_t *actor)
|
|||
return;
|
||||
|
||||
if (actor->type == MT_BLACKEGGMAN)
|
||||
{
|
||||
shot->destscale = actor->scale/2;
|
||||
P_SetScale(shot, actor->scale/2);
|
||||
}
|
||||
P_SetScale(shot, actor->scale/2, true);
|
||||
else
|
||||
{
|
||||
shot->destscale = actor->scale;
|
||||
P_SetScale(shot, actor->scale);
|
||||
}
|
||||
P_SetScale(shot, actor->scale, true);
|
||||
|
||||
P_SetTarget(&shot->target, actor); // where it came from
|
||||
|
||||
|
@ -3218,8 +3210,7 @@ void A_Boss1Laser(mobj_t *actor)
|
|||
if (!P_MobjWasRemoved(point))
|
||||
{
|
||||
point->angle = actor->angle;
|
||||
point->destscale = actor->scale;
|
||||
P_SetScale(point, point->destscale);
|
||||
P_SetScale(point, actor->scale, true);
|
||||
P_SetTarget(&point->target, actor);
|
||||
P_MobjCheckWater(point);
|
||||
if (point->eflags & (MFE_UNDERWATER|MFE_TOUCHWATER))
|
||||
|
@ -3230,7 +3221,8 @@ void A_Boss1Laser(mobj_t *actor)
|
|||
mobj_t *steam = P_SpawnMobj(x, y, point->watertop - size*mobjinfo[MT_DUST].height, MT_DUST);
|
||||
if (P_MobjWasRemoved(steam))
|
||||
continue;
|
||||
P_SetScale(steam, size*actor->scale);
|
||||
P_SetScale(steam, size*actor->scale, false);
|
||||
steam->old_scale = steam->scale;
|
||||
P_SetObjectMomZ(steam, FRACUNIT + 2*P_RandomFixed(), true);
|
||||
P_InstaThrust(steam, FixedAngle(P_RandomKey(360)*FRACUNIT), 2*P_RandomFixed());
|
||||
if (point->info->painsound)
|
||||
|
@ -3603,8 +3595,7 @@ void A_BossScream(mobj_t *actor)
|
|||
return;
|
||||
if (actor->eflags & MFE_VERTICALFLIP)
|
||||
mo->flags2 |= MF2_OBJECTFLIP;
|
||||
mo->destscale = actor->scale;
|
||||
P_SetScale(mo, mo->destscale);
|
||||
P_SetScale(mo, actor->scale, true);
|
||||
if (actor->info->deathsound)
|
||||
S_StartSound(mo, actor->info->deathsound);
|
||||
}
|
||||
|
@ -4197,7 +4188,7 @@ static void P_DoBoss5Death(mobj_t *mo)
|
|||
MT_FSGNB);
|
||||
if (!P_MobjWasRemoved(pole))
|
||||
{
|
||||
P_SetScale(pole, (pole->destscale = 2*FRACUNIT));
|
||||
P_SetScale(pole, 2*FRACUNIT, true);
|
||||
pole->momx = P_ReturnThrustX(pole, pole->angle, speed);
|
||||
pole->momy = P_ReturnThrustY(pole, pole->angle, speed);
|
||||
P_SetTarget(&pole->tracer, P_SpawnMobj(
|
||||
|
@ -4207,7 +4198,7 @@ static void P_DoBoss5Death(mobj_t *mo)
|
|||
if (!P_MobjWasRemoved(pole->tracer))
|
||||
{
|
||||
pole->tracer->flags |= MF_NOCLIPTHING;
|
||||
P_SetScale(pole->tracer, (pole->tracer->destscale = 2*FRACUNIT));
|
||||
P_SetScale(pole->tracer, 2*FRACUNIT, true);
|
||||
pole->angle = pole->tracer->angle = mo->tracer->angle;
|
||||
pole->tracer->momx = pole->momx;
|
||||
pole->tracer->momy = pole->momy;
|
||||
|
@ -4746,10 +4737,7 @@ void A_BubbleSpawn(mobj_t *actor)
|
|||
bubble = P_SpawnMobj(actor->x, actor->y, actor->z + (actor->height / 2), MT_MEDIUMBUBBLE);
|
||||
|
||||
if (bubble)
|
||||
{
|
||||
bubble->destscale = actor->scale;
|
||||
P_SetScale(bubble, actor->scale);
|
||||
}
|
||||
P_SetScale(bubble, actor->scale, true);
|
||||
}
|
||||
|
||||
// Function: A_FanBubbleSpawn
|
||||
|
@ -4792,10 +4780,7 @@ void A_FanBubbleSpawn(mobj_t *actor)
|
|||
bubble = P_SpawnMobj(actor->x, actor->y, hz, MT_MEDIUMBUBBLE);
|
||||
|
||||
if (bubble)
|
||||
{
|
||||
bubble->destscale = actor->scale;
|
||||
P_SetScale(bubble, actor->scale);
|
||||
}
|
||||
P_SetScale(bubble, actor->scale, true);
|
||||
}
|
||||
|
||||
// Function: A_BubbleRise
|
||||
|
@ -5072,8 +5057,7 @@ void A_ThrownRing(mobj_t *actor)
|
|||
P_SetTarget(&ring->target, actor);
|
||||
ring->color = actor->color; //copy color
|
||||
*/
|
||||
ring->destscale = actor->scale;
|
||||
P_SetScale(ring, actor->scale);
|
||||
P_SetScale(ring, actor->scale, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5652,8 +5636,7 @@ void A_JetbThink(mobj_t *actor)
|
|||
if (!P_MobjWasRemoved(bomb))
|
||||
{
|
||||
P_SetTarget(&bomb->target, actor);
|
||||
bomb->destscale = actor->scale;
|
||||
P_SetScale(bomb, actor->scale);
|
||||
P_SetScale(bomb, actor->scale, true);
|
||||
actor->reactiontime = TICRATE; // one second
|
||||
S_StartSound(actor, actor->info->attacksound);
|
||||
}
|
||||
|
@ -5833,7 +5816,8 @@ void A_MinusDigging(mobj_t *actor)
|
|||
P_SetMobjState(par, actor->info->raisestate);
|
||||
if (P_MobjWasRemoved(par))
|
||||
return;
|
||||
P_SetScale(par, actor->scale*2);
|
||||
P_SetScale(par, actor->scale*2, false);
|
||||
par->old_scale = par->scale;
|
||||
if (actor->eflags & MFE_VERTICALFLIP)
|
||||
par->eflags |= MFE_VERTICALFLIP;
|
||||
return;
|
||||
|
@ -5905,7 +5889,8 @@ void A_MinusPopup(mobj_t *actor)
|
|||
continue;
|
||||
P_Thrust(rock, ani*i, FRACUNIT);
|
||||
P_SetObjectMomZ(rock, 3*FRACUNIT, false);
|
||||
P_SetScale(rock, rock->scale/3);
|
||||
P_SetScale(rock, rock->scale/3, false);
|
||||
rock->old_scale = rock->scale;
|
||||
}
|
||||
P_RadiusAttack(actor, actor, 2*actor->radius, 0, true);
|
||||
if (actor->tracer)
|
||||
|
@ -5944,7 +5929,8 @@ void A_MinusCheck(mobj_t *actor)
|
|||
continue;
|
||||
P_Thrust(rock, ani*i, FRACUNIT);
|
||||
P_SetObjectMomZ(rock, 3*FRACUNIT, false);
|
||||
P_SetScale(rock, rock->scale/3);
|
||||
P_SetScale(rock, rock->scale/3, false);
|
||||
rock->old_scale = rock->scale;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8273,8 +8259,9 @@ void A_EggShield(mobj_t *actor)
|
|||
else
|
||||
actor->z = actor->target->z;
|
||||
|
||||
P_SetScale(actor, actor->target->scale, false);
|
||||
actor->destscale = actor->target->destscale;
|
||||
P_SetScale(actor, actor->target->scale);
|
||||
actor->old_scale = actor->target->old_scale;
|
||||
|
||||
actor->floorz = actor->target->floorz;
|
||||
actor->ceilingz = actor->target->ceilingz;
|
||||
|
@ -8555,7 +8542,7 @@ void A_Boss3ShockThink(mobj_t *actor)
|
|||
P_SetTarget(&snew->target, actor->target);
|
||||
snew->fuse = actor->fuse;
|
||||
|
||||
P_SetScale(snew, actor->scale);
|
||||
P_SetScale(snew, actor->scale, true);
|
||||
snew->destscale = actor->destscale;
|
||||
snew->scalespeed = actor->scalespeed;
|
||||
|
||||
|
@ -8757,8 +8744,7 @@ void A_SmokeTrailer(mobj_t *actor)
|
|||
if (P_MobjWasRemoved(th))
|
||||
return;
|
||||
P_SetObjectMomZ(th, FRACUNIT, false);
|
||||
th->destscale = actor->scale;
|
||||
P_SetScale(th, actor->scale);
|
||||
P_SetScale(th, actor->scale, true);
|
||||
th->tics -= P_RandomByte() & 3;
|
||||
if (th->tics < 1)
|
||||
th->tics = 1;
|
||||
|
@ -9522,8 +9508,7 @@ void A_BossJetFume(mobj_t *actor)
|
|||
if (!P_MobjWasRemoved(filler))
|
||||
{
|
||||
P_SetTarget(&filler->target, actor);
|
||||
filler->destscale = actor->scale;
|
||||
P_SetScale(filler, filler->destscale);
|
||||
P_SetScale(filler, actor->scale, true);
|
||||
if (actor->eflags & MFE_VERTICALFLIP)
|
||||
filler->flags2 |= MF2_OBJECTFLIP;
|
||||
filler->fuse = 56;
|
||||
|
@ -9540,8 +9525,7 @@ void A_BossJetFume(mobj_t *actor)
|
|||
if (!P_MobjWasRemoved(filler))
|
||||
{
|
||||
P_SetTarget(&filler->target, actor);
|
||||
filler->destscale = actor->scale;
|
||||
P_SetScale(filler, filler->destscale);
|
||||
P_SetScale(filler, actor->scale, true);
|
||||
if (actor->eflags & MFE_VERTICALFLIP)
|
||||
filler->flags2 |= MF2_OBJECTFLIP;
|
||||
filler->fuse = 57;
|
||||
|
@ -9554,7 +9538,7 @@ void A_BossJetFume(mobj_t *actor)
|
|||
{
|
||||
P_SetTarget(&filler->target, actor);
|
||||
filler->destscale = actor->scale;
|
||||
P_SetScale(filler, filler->destscale);
|
||||
P_SetScale(filler, actor->scale, true);
|
||||
if (actor->eflags & MFE_VERTICALFLIP)
|
||||
filler->flags2 |= MF2_OBJECTFLIP;
|
||||
filler->fuse = 58;
|
||||
|
@ -9575,8 +9559,7 @@ void A_BossJetFume(mobj_t *actor)
|
|||
|
||||
filler = P_SpawnMobj(jetx, jety, jetz, MT_PROPELLER);
|
||||
P_SetTarget(&filler->target, actor);
|
||||
filler->destscale = actor->scale;
|
||||
P_SetScale(filler, filler->destscale);
|
||||
P_SetScale(filler, actor->scale, true);
|
||||
if (actor->eflags & MFE_VERTICALFLIP)
|
||||
filler->flags2 |= MF2_OBJECTFLIP;
|
||||
filler->angle = actor->angle - ANGLE_180;
|
||||
|
@ -9591,7 +9574,7 @@ void A_BossJetFume(mobj_t *actor)
|
|||
P_SetTarget(&filler->target, actor);
|
||||
filler->fuse = 59;
|
||||
P_SetTarget(&actor->tracer, filler);
|
||||
P_SetScale(filler, (filler->destscale = actor->scale/3));
|
||||
P_SetScale(filler, actor->scale/3, true);
|
||||
if (actor->eflags & MFE_VERTICALFLIP)
|
||||
filler->flags2 |= MF2_OBJECTFLIP;
|
||||
filler->color = SKINCOLOR_ICY;
|
||||
|
@ -9610,8 +9593,7 @@ void A_BossJetFume(mobj_t *actor)
|
|||
{
|
||||
P_SetTarget(&filler->target, actor);
|
||||
// Boss 4 already uses its tracer for other things
|
||||
filler->destscale = actor->scale;
|
||||
P_SetScale(filler, filler->destscale);
|
||||
P_SetScale(filler, actor->scale, true);
|
||||
if (actor->eflags & MFE_VERTICALFLIP)
|
||||
filler->flags2 |= MF2_OBJECTFLIP;
|
||||
}
|
||||
|
@ -9633,8 +9615,7 @@ void A_BossJetFume(mobj_t *actor)
|
|||
{
|
||||
filler->movefactor = movefactor;
|
||||
P_SetTarget(&filler->target, actor);
|
||||
filler->destscale = actor->scale;
|
||||
P_SetScale(filler, filler->destscale);
|
||||
P_SetScale(filler, actor->scale, true);
|
||||
if (actor->eflags & MFE_VERTICALFLIP)
|
||||
filler->flags2 |= MF2_OBJECTFLIP;
|
||||
}
|
||||
|
@ -9880,12 +9861,13 @@ void A_ToggleFlameJet(mobj_t* actor)
|
|||
// var1 = Angle adjustment (aka orbit speed)
|
||||
// var2:
|
||||
// Bits 1-10: height offset, max 1023
|
||||
// Bits 11-16: X radius factor (max 63, default 20)
|
||||
// Bits 11-16: X radius factor (max 63, default 32)
|
||||
// Bit 17: set if object is Nightopian Helper
|
||||
// Bit 18: set to define X/Y/Z rotation factor
|
||||
// Bits 19-20: Unused
|
||||
// Bit 19: set to not sync scale to player
|
||||
// Bit 20: Unused
|
||||
// Bits 21-26: Y radius factor (max 63, default 32)
|
||||
// Bits 27-32: Z radius factor (max 63, default 32)
|
||||
// Bits 27-32: Z radius factor (max 63, default 20)
|
||||
//
|
||||
// If MF_GRENADEBOUNCE is flagged on mobj, use actor->threshold to define X/Y/Z radius factor, max 1023 each:
|
||||
// Bits 1-10: X factor
|
||||
|
@ -9926,6 +9908,12 @@ void A_OrbitNights(mobj_t* actor)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!donotrescale)
|
||||
{
|
||||
P_SetScale(actor, actor->target->scale, true);
|
||||
actor->old_scale = actor->target->old_scale;
|
||||
}
|
||||
|
||||
actor->extravalue1 += var1;
|
||||
P_UnsetThingPosition(actor);
|
||||
{
|
||||
|
@ -9953,9 +9941,6 @@ void A_OrbitNights(mobj_t* actor)
|
|||
else
|
||||
actor->flags2 &= ~MF2_DONTDRAW;
|
||||
}
|
||||
|
||||
if (!donotrescale && actor->destscale != actor->target->destscale)
|
||||
actor->destscale = actor->target->destscale;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11204,9 +11189,10 @@ void A_SetScale(mobj_t *actor)
|
|||
return;
|
||||
}
|
||||
|
||||
target->destscale = locvar1; // destination scale
|
||||
if (!(locvar2 & 65535))
|
||||
P_SetScale(target, locvar1); // this instantly changes current scale to var1 if used, if not destscale will alter scale to var1 anyway
|
||||
if ((locvar2 & 65535) == 0)
|
||||
P_SetScale(target, locvar1, true); // this instantly changes current scale to var1 if used, if not destscale will alter scale to var1 over time
|
||||
else
|
||||
target->destscale = locvar1; // destination scale
|
||||
}
|
||||
|
||||
// Function: A_RemoteDamage
|
||||
|
@ -11350,8 +11336,7 @@ void A_TrapShot(mobj_t *actor)
|
|||
if (actor->eflags & MFE_VERTICALFLIP)
|
||||
missile->flags2 |= MF2_OBJECTFLIP;
|
||||
|
||||
missile->destscale = actor->scale;
|
||||
P_SetScale(missile, actor->scale);
|
||||
P_SetScale(missile, actor->scale, true);
|
||||
|
||||
if (missile->info->seesound)
|
||||
S_StartSound(missile, missile->info->seesound);
|
||||
|
@ -11425,8 +11410,7 @@ void A_VileTarget(mobj_t *actor)
|
|||
fog->eflags |= MFE_VERTICALFLIP;
|
||||
fog->flags2 |= MF2_OBJECTFLIP;
|
||||
}
|
||||
fog->destscale = actor->target->scale;
|
||||
P_SetScale(fog, fog->destscale);
|
||||
P_SetScale(fog, actor->target->scale, true);
|
||||
|
||||
P_SetTarget(&actor->tracer, fog);
|
||||
P_SetTarget(&fog->target, actor);
|
||||
|
@ -11459,8 +11443,7 @@ void A_VileTarget(mobj_t *actor)
|
|||
fog->eflags |= MFE_VERTICALFLIP;
|
||||
fog->flags2 |= MF2_OBJECTFLIP;
|
||||
}
|
||||
fog->destscale = players[i].mo->scale;
|
||||
P_SetScale(fog, fog->destscale);
|
||||
P_SetScale(fog, players[i].mo->scale, true);
|
||||
|
||||
if (players[i].mo == actor->target) // We only care to track the fog targeting who we REALLY hate right now
|
||||
P_SetTarget(&actor->tracer, fog);
|
||||
|
@ -11617,8 +11600,8 @@ void A_VileFire(mobj_t *actor)
|
|||
return;
|
||||
|
||||
// keep to same scale and gravity as tracer ALWAYS
|
||||
actor->destscale = dest->scale;
|
||||
P_SetScale(actor, actor->destscale);
|
||||
P_SetScale(actor, dest->scale, true);
|
||||
actor->old_scale = dest->old_scale;
|
||||
if (dest->eflags & MFE_VERTICALFLIP)
|
||||
{
|
||||
actor->eflags |= MFE_VERTICALFLIP;
|
||||
|
@ -12804,8 +12787,7 @@ void A_LightBeamReset(mobj_t *actor)
|
|||
if (LUA_CallAction(A_LIGHTBEAMRESET, actor))
|
||||
return;
|
||||
|
||||
actor->destscale = FRACUNIT + P_SignedRandom()*FRACUNIT/256;
|
||||
P_SetScale(actor, actor->destscale);
|
||||
P_SetScale(actor, FRACUNIT + P_SignedRandom()*FRACUNIT/256, true);
|
||||
|
||||
if (!actor->spawnpoint)
|
||||
return; // this can't work properly welp
|
||||
|
@ -13392,7 +13374,7 @@ void A_DoNPCSkid(mobj_t *actor)
|
|||
{
|
||||
particle->tics = 10;
|
||||
|
||||
P_SetScale(particle, 2*actor->scale/3);
|
||||
P_SetScale(particle, 2*actor->scale/3, true);
|
||||
particle->destscale = actor->scale;
|
||||
P_SetObjectMomZ(particle, FRACUNIT, false);
|
||||
}
|
||||
|
@ -13815,7 +13797,7 @@ static void P_DustRing(mobjtype_t mobjtype, UINT32 div, fixed_t x, fixed_t y, fi
|
|||
continue;
|
||||
|
||||
dust->angle = ang*i + ANGLE_90;
|
||||
P_SetScale(dust, FixedMul(initscale, scale));
|
||||
P_SetScale(dust, FixedMul(initscale, scale), true);
|
||||
dust->destscale = FixedMul(4*FRACUNIT + P_RandomFixed(), scale);
|
||||
dust->scalespeed = scale/24;
|
||||
P_Thrust(dust, ang*i, speed + FixedMul(P_RandomFixed(), scale));
|
||||
|
@ -13956,7 +13938,8 @@ void A_DustDevilThink(mobj_t *actor)
|
|||
while (layer && !P_MobjWasRemoved(layer)) {
|
||||
angle_t fa = layer->angle >> ANGLETOFINESHIFT;
|
||||
P_MoveOrigin(layer, layer->x + 5 * FixedMul(scale, FINECOSINE(fa)), layer->y + 5 * FixedMul(scale, FINESINE(fa)), layer->z);
|
||||
layer->scale = scale;
|
||||
P_SetScale(layer, scale, true);
|
||||
layer->old_scale = actor->old_scale;
|
||||
layer->angle += ANG10 / 2;
|
||||
layer->momx = actor->momx;
|
||||
layer->momy = actor->momy;
|
||||
|
@ -13970,8 +13953,7 @@ void A_DustDevilThink(mobj_t *actor)
|
|||
if (!P_MobjWasRemoved(dust))
|
||||
{
|
||||
P_SetMobjState(dust, dust->info->spawnstate + P_RandomRange(0, 2));
|
||||
dust->destscale = scale * 3;
|
||||
P_SetScale(dust, dust->destscale);
|
||||
P_SetScale(dust, 3 * scale, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13990,6 +13972,7 @@ void A_DustDevilThink(mobj_t *actor)
|
|||
layer = P_SpawnMobj(px, py, pz, MT_DUSTLAYER);
|
||||
if (P_MobjWasRemoved(layer))
|
||||
continue;
|
||||
P_SetScale(layer, scale, true);
|
||||
layer->momz = 5 * scale;
|
||||
layer->angle = ANGLE_90 + ANGLE_90*i;
|
||||
layer->extravalue1 = TICRATE * 3;
|
||||
|
@ -14610,8 +14593,7 @@ void A_MinecartSparkThink(mobj_t *actor)
|
|||
continue;
|
||||
trail->tics = 2;
|
||||
trail->sprite = actor->sprite;
|
||||
P_SetScale(trail, trail->scale/4);
|
||||
trail->destscale = trail->scale;
|
||||
P_SetScale(trail, trail->scale/4, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14734,8 +14716,16 @@ void A_FireShrink(mobj_t *actor)
|
|||
if (LUA_CallAction(A_FIRESHRINK, actor))
|
||||
return;
|
||||
|
||||
actor->destscale = locvar1;
|
||||
actor->scalespeed = FRACUNIT/locvar2;
|
||||
if (locvar2 == 0)
|
||||
{
|
||||
P_SetScale(actor, locvar1, true);
|
||||
actor->scalespeed = FRACUNIT/12; // Reset scalespeed to the default
|
||||
}
|
||||
else
|
||||
{
|
||||
actor->destscale = locvar1;
|
||||
actor->scalespeed = FRACUNIT/locvar2;
|
||||
}
|
||||
}
|
||||
|
||||
// Function: A_SpawnPterabytes
|
||||
|
|
|
@ -2774,8 +2774,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
|
|||
mo = P_SpawnMobj(target->x, target->y, target->z, MT_EXTRALARGEBUBBLE);
|
||||
if (P_MobjWasRemoved(mo))
|
||||
break;
|
||||
mo->destscale = target->scale;
|
||||
P_SetScale(mo, mo->destscale);
|
||||
P_SetScale(mo, target->scale, true);
|
||||
P_SetMobjState(mo, mo->info->raisestate);
|
||||
break;
|
||||
|
||||
|
@ -3966,8 +3965,7 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings)
|
|||
mo->fuse = 8*TICRATE;
|
||||
P_SetTarget(&mo->target, player->mo);
|
||||
|
||||
mo->destscale = player->mo->scale;
|
||||
P_SetScale(mo, player->mo->scale);
|
||||
P_SetScale(mo, player->mo->scale, true);
|
||||
|
||||
// Angle offset by player angle, then slightly offset by amount of rings
|
||||
fa = ((i*FINEANGLES/16) + va - ((num_rings-1)*FINEANGLES/32)) & FINEMASK;
|
||||
|
@ -4103,8 +4101,7 @@ void P_PlayerWeaponPanelBurst(player_t *player)
|
|||
mo->flags &= ~(MF_NOGRAVITY|MF_NOCLIPHEIGHT);
|
||||
P_SetTarget(&mo->target, player->mo);
|
||||
mo->fuse = 12*TICRATE;
|
||||
mo->destscale = player->mo->scale;
|
||||
P_SetScale(mo, player->mo->scale);
|
||||
P_SetScale(mo, player->mo->scale, true);
|
||||
|
||||
// Angle offset by player angle
|
||||
fa = ((i*FINEANGLES/16) + (player->mo->angle>>ANGLETOFINESHIFT)) & FINEMASK;
|
||||
|
@ -4192,8 +4189,7 @@ void P_PlayerWeaponAmmoBurst(player_t *player)
|
|||
player->powers[power] = 0;
|
||||
mo->fuse = 12*TICRATE;
|
||||
|
||||
mo->destscale = player->mo->scale;
|
||||
P_SetScale(mo, player->mo->scale);
|
||||
P_SetScale(mo, player->mo->scale, true);
|
||||
|
||||
// Angle offset by player angle
|
||||
fa = ((i*FINEANGLES/16) + (player->mo->angle>>ANGLETOFINESHIFT)) & FINEMASK;
|
||||
|
@ -4240,8 +4236,7 @@ void P_PlayerWeaponPanelOrAmmoBurst(player_t *player)
|
|||
mo->flags &= ~(MF_NOGRAVITY|MF_NOCLIPHEIGHT); \
|
||||
P_SetTarget(&mo->target, player->mo); \
|
||||
mo->fuse = 12*TICRATE; \
|
||||
mo->destscale = player->mo->scale; \
|
||||
P_SetScale(mo, player->mo->scale); \
|
||||
P_SetScale(mo, player->mo->scale, true); \
|
||||
mo->momx = FixedMul(FINECOSINE(fa),ns); \
|
||||
if (!(twodlevel || (player->mo->flags2 & MF2_TWOD))) \
|
||||
mo->momy = FixedMul(FINESINE(fa),ns); \
|
||||
|
@ -4263,8 +4258,7 @@ void P_PlayerWeaponPanelOrAmmoBurst(player_t *player)
|
|||
mo->flags &= ~(MF_NOGRAVITY|MF_NOCLIPHEIGHT); \
|
||||
P_SetTarget(&mo->target, player->mo); \
|
||||
mo->fuse = 12*TICRATE; \
|
||||
mo->destscale = player->mo->scale; \
|
||||
P_SetScale(mo, player->mo->scale); \
|
||||
P_SetScale(mo, player->mo->scale, true); \
|
||||
mo->momx = FixedMul(FINECOSINE(fa),ns); \
|
||||
if (!(twodlevel || (player->mo->flags2 & MF2_TWOD))) \
|
||||
mo->momy = FixedMul(FINESINE(fa),ns); \
|
||||
|
|
|
@ -283,7 +283,6 @@ void P_PlayJingleMusic(player_t *player, const char *musname, UINT16 musflags, b
|
|||
extern mapthing_t *itemrespawnque[ITEMQUESIZE];
|
||||
extern tic_t itemrespawntime[ITEMQUESIZE];
|
||||
extern size_t iquehead, iquetail;
|
||||
extern consvar_t cv_gravity, cv_movebob;
|
||||
|
||||
mobjtype_t P_GetMobjtype(UINT16 mthingtype);
|
||||
|
||||
|
@ -552,6 +551,7 @@ void P_ThrustEvenIn2D(mobj_t *mo, angle_t angle, fixed_t move);
|
|||
void P_VectorInstaThrust(fixed_t xa, fixed_t xb, fixed_t xc, fixed_t ya, fixed_t yb, fixed_t yc,
|
||||
fixed_t za, fixed_t zb, fixed_t zc, fixed_t momentum, mobj_t *mo);
|
||||
void P_DoSuperTransformation(player_t *player, boolean giverings);
|
||||
void P_DoSuperDetransformation(player_t *player);
|
||||
void P_ExplodeMissile(mobj_t *mo);
|
||||
void P_CheckGravity(mobj_t *mo, boolean affect);
|
||||
void P_SetPitchRollFromSlope(mobj_t *mo, pslope_t *slope);
|
||||
|
|
286
src/p_mobj.c
286
src/p_mobj.c
|
@ -85,9 +85,15 @@ void P_AddCachedAction(mobj_t *mobj, INT32 statenum)
|
|||
//
|
||||
static void P_SetupStateAnimation(mobj_t *mobj, state_t *st)
|
||||
{
|
||||
INT32 animlength = (mobj->sprite == SPR_PLAY && mobj->skin)
|
||||
? (INT32)(((skin_t *)mobj->skin)->sprites[mobj->sprite2].numframes) - 1
|
||||
: st->var1;
|
||||
INT32 animlength;
|
||||
|
||||
if (mobj->sprite == SPR_PLAY && mobj->skin)
|
||||
{
|
||||
spritedef_t *spritedef = P_GetSkinSpritedef(mobj->skin, mobj->sprite2);
|
||||
animlength = (INT32)(spritedef->numframes);
|
||||
}
|
||||
else
|
||||
animlength = st->var1;
|
||||
|
||||
if (!(st->frame & FF_ANIMATE))
|
||||
return;
|
||||
|
@ -138,8 +144,13 @@ FUNCINLINE static ATTRINLINE void P_CycleStateAnimation(mobj_t *mobj)
|
|||
}
|
||||
|
||||
// sprite2 version of above
|
||||
if (mobj->skin && (((++mobj->frame) & FF_FRAMEMASK) >= (UINT32)(((skin_t *)mobj->skin)->sprites[mobj->sprite2].numframes)))
|
||||
mobj->frame &= ~FF_FRAMEMASK;
|
||||
if (mobj->skin)
|
||||
{
|
||||
spritedef_t *spritedef = P_GetSkinSpritedef(mobj->skin, mobj->sprite2);
|
||||
UINT32 anim_length = (UINT32)(spritedef->numframes);
|
||||
if (((++mobj->frame) & FF_FRAMEMASK) >= anim_length)
|
||||
mobj->frame &= ~FF_FRAMEMASK;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -395,31 +406,23 @@ static boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
|
|||
{
|
||||
skin_t *skin = ((skin_t *)mobj->skin);
|
||||
UINT16 frame = (mobj->frame & FF_FRAMEMASK)+1;
|
||||
UINT8 numframes, spr2;
|
||||
UINT8 numframes;
|
||||
UINT16 spr2;
|
||||
|
||||
if (skin)
|
||||
{
|
||||
UINT16 stateframe = st->frame;
|
||||
spr2 = P_GetStateSprite2(st);
|
||||
|
||||
// Add/Remove FF_SPR2SUPER based on certain conditions
|
||||
if (player->charflags & SF_NOSUPERSPRITES || (player->powers[pw_carry] == CR_NIGHTSMODE && (player->charflags & SF_NONIGHTSSUPER)))
|
||||
stateframe = stateframe & ~FF_SPR2SUPER;
|
||||
else if (player->powers[pw_super] || (player->powers[pw_carry] == CR_NIGHTSMODE && (player->charflags & SF_SUPER)))
|
||||
stateframe = stateframe | FF_SPR2SUPER;
|
||||
// Add or remove SPR2F_SUPER based on certain conditions
|
||||
spr2 = P_ApplySuperFlagToSprite2(spr2, mobj);
|
||||
|
||||
if (stateframe & FF_SPR2SUPER)
|
||||
{
|
||||
if (mobj->eflags & MFE_FORCENOSUPER)
|
||||
stateframe = stateframe & ~FF_SPR2SUPER;
|
||||
}
|
||||
else if (mobj->eflags & MFE_FORCESUPER)
|
||||
stateframe = stateframe | FF_SPR2SUPER;
|
||||
// Get the needed sprite2 and frame number
|
||||
spr2 = P_GetSkinSprite2(skin, spr2, mobj->player);
|
||||
|
||||
// Get the sprite2 and frame number
|
||||
spr2 = P_GetSkinSprite2(skin, (stateframe & FF_FRAMEMASK), mobj->player);
|
||||
numframes = skin->sprites[spr2].numframes;
|
||||
spritedef_t *sprdef = P_GetSkinSpritedef(skin, spr2);
|
||||
numframes = sprdef->numframes;
|
||||
|
||||
if (state == S_PLAY_STND && (spr2 & FF_SPR2SUPER) && skin->sprites[SPR2_WAIT|FF_SPR2SUPER].numframes == 0)
|
||||
if (state == S_PLAY_STND && (spr2 & SPR2F_SUPER) && sprdef[SPR2_WAIT].numframes == 0)
|
||||
mobj->tics = -1; // If no super wait, don't wait at all
|
||||
}
|
||||
else
|
||||
|
@ -432,12 +435,19 @@ static boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
|
|||
if (mobj->sprite != SPR_PLAY)
|
||||
{
|
||||
mobj->sprite = SPR_PLAY;
|
||||
frame = 0;
|
||||
frame = P_GetSprite2StateFrame(st);
|
||||
}
|
||||
else if (mobj->sprite2 != spr2)
|
||||
{
|
||||
if ((st->frame & FF_SPR2MIDSTART) && numframes && P_RandomChance(FRACUNIT/2))
|
||||
frame = numframes/2;
|
||||
if (st->frame & FF_SPR2MIDSTART)
|
||||
{
|
||||
if (numframes && P_RandomChance(FRACUNIT/2))
|
||||
frame = numframes/2;
|
||||
else
|
||||
frame = 0;
|
||||
}
|
||||
else if (numframes)
|
||||
frame = P_GetSprite2StateFrame(st) % numframes;
|
||||
else
|
||||
frame = 0;
|
||||
}
|
||||
|
@ -452,6 +462,7 @@ static boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
|
|||
{
|
||||
if (mobj->frame & FF_FRAMEMASK)
|
||||
mobj->frame--;
|
||||
|
||||
return P_SetPlayerMobjState(mobj, st->var1);
|
||||
}
|
||||
}
|
||||
|
@ -539,26 +550,23 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state)
|
|||
{
|
||||
skin_t *skin = ((skin_t *)mobj->skin);
|
||||
UINT16 frame = (mobj->frame & FF_FRAMEMASK)+1;
|
||||
UINT8 numframes, spr2;
|
||||
UINT8 numframes;
|
||||
UINT16 spr2;
|
||||
|
||||
if (skin)
|
||||
{
|
||||
UINT16 stateframe = st->frame;
|
||||
spr2 = P_GetStateSprite2(st);
|
||||
|
||||
// Add/Remove FF_SPR2SUPER based on certain conditions
|
||||
if (stateframe & FF_SPR2SUPER)
|
||||
{
|
||||
if (mobj->eflags & MFE_FORCENOSUPER)
|
||||
stateframe = stateframe & ~FF_SPR2SUPER;
|
||||
}
|
||||
else if (mobj->eflags & MFE_FORCESUPER)
|
||||
stateframe = stateframe | FF_SPR2SUPER;
|
||||
// Add or remove SPR2F_SUPER based on certain conditions
|
||||
spr2 = P_ApplySuperFlagToSprite2(spr2, mobj);
|
||||
|
||||
// Get the sprite2 and frame number
|
||||
spr2 = P_GetSkinSprite2(skin, (stateframe & FF_FRAMEMASK), NULL);
|
||||
numframes = skin->sprites[spr2].numframes;
|
||||
// Get the needed sprite2 and frame number
|
||||
spr2 = P_GetSkinSprite2(skin, spr2, NULL);
|
||||
|
||||
if (state == S_PLAY_STND && (spr2 & FF_SPR2SUPER) && skin->sprites[SPR2_WAIT|FF_SPR2SUPER].numframes == 0)
|
||||
spritedef_t *sprdef = P_GetSkinSpritedef(skin, spr2);
|
||||
numframes = sprdef->numframes;
|
||||
|
||||
if (state == S_PLAY_STND && (spr2 & SPR2F_SUPER) && sprdef[SPR2_WAIT].numframes == 0)
|
||||
mobj->tics = -1; // If no super wait, don't wait at all
|
||||
}
|
||||
else
|
||||
|
@ -571,12 +579,19 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state)
|
|||
if (mobj->sprite != SPR_PLAY)
|
||||
{
|
||||
mobj->sprite = SPR_PLAY;
|
||||
frame = 0;
|
||||
frame = P_GetSprite2StateFrame(st);
|
||||
}
|
||||
else if (mobj->sprite2 != spr2)
|
||||
{
|
||||
if ((st->frame & FF_SPR2MIDSTART) && numframes && P_RandomChance(FRACUNIT/2))
|
||||
frame = numframes/2;
|
||||
if (st->frame & FF_SPR2MIDSTART)
|
||||
{
|
||||
if (numframes && P_RandomChance(FRACUNIT/2))
|
||||
frame = numframes/2;
|
||||
else
|
||||
frame = 0;
|
||||
}
|
||||
else if (numframes)
|
||||
frame = P_GetSprite2StateFrame(st) % numframes;
|
||||
else
|
||||
frame = 0;
|
||||
}
|
||||
|
@ -591,6 +606,7 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state)
|
|||
{
|
||||
if (mobj->frame & FF_FRAMEMASK)
|
||||
mobj->frame--;
|
||||
|
||||
return P_SetMobjState(mobj, st->var1);
|
||||
}
|
||||
}
|
||||
|
@ -917,7 +933,7 @@ void P_ExplodeMissile(mobj_t *mo)
|
|||
explodemo = P_SpawnMobj(mo->x, mo->y, mo->z, MT_EXPLODE);
|
||||
if (!P_MobjWasRemoved(explodemo))
|
||||
{
|
||||
P_SetScale(explodemo, mo->scale);
|
||||
P_SetScale(explodemo, mo->scale, true);
|
||||
explodemo->destscale = mo->destscale;
|
||||
explodemo->momx += (P_RandomByte() % 32) * FixedMul(FRACUNIT/8, explodemo->scale);
|
||||
explodemo->momy += (P_RandomByte() % 32) * FixedMul(FRACUNIT/8, explodemo->scale);
|
||||
|
@ -926,7 +942,7 @@ void P_ExplodeMissile(mobj_t *mo)
|
|||
explodemo = P_SpawnMobj(mo->x, mo->y, mo->z, MT_EXPLODE);
|
||||
if (!P_MobjWasRemoved(explodemo))
|
||||
{
|
||||
P_SetScale(explodemo, mo->scale);
|
||||
P_SetScale(explodemo, mo->scale, true);
|
||||
explodemo->destscale = mo->destscale;
|
||||
explodemo->momx += (P_RandomByte() % 64) * FixedMul(FRACUNIT/8, explodemo->scale);
|
||||
explodemo->momy -= (P_RandomByte() % 64) * FixedMul(FRACUNIT/8, explodemo->scale);
|
||||
|
@ -935,7 +951,7 @@ void P_ExplodeMissile(mobj_t *mo)
|
|||
explodemo = P_SpawnMobj(mo->x, mo->y, mo->z, MT_EXPLODE);
|
||||
if (!P_MobjWasRemoved(explodemo))
|
||||
{
|
||||
P_SetScale(explodemo, mo->scale);
|
||||
P_SetScale(explodemo, mo->scale, true);
|
||||
explodemo->destscale = mo->destscale;
|
||||
explodemo->momx -= (P_RandomByte() % 128) * FixedMul(FRACUNIT/8, explodemo->scale);
|
||||
explodemo->momy += (P_RandomByte() % 128) * FixedMul(FRACUNIT/8, explodemo->scale);
|
||||
|
@ -944,7 +960,7 @@ void P_ExplodeMissile(mobj_t *mo)
|
|||
explodemo = P_SpawnMobj(mo->x, mo->y, mo->z, MT_EXPLODE);
|
||||
if (!P_MobjWasRemoved(explodemo))
|
||||
{
|
||||
P_SetScale(explodemo, mo->scale);
|
||||
P_SetScale(explodemo, mo->scale, true);
|
||||
explodemo->destscale = mo->destscale;
|
||||
explodemo->momx -= (P_RandomByte() % 96) * FixedMul(FRACUNIT/8, explodemo->scale);
|
||||
explodemo->momy -= (P_RandomByte() % 96) * FixedMul(FRACUNIT/8, explodemo->scale);
|
||||
|
@ -3113,8 +3129,7 @@ boolean P_SceneryZMovement(mobj_t *mo)
|
|||
continue;
|
||||
explodemo->momx += ((prandom & 0x0F) << (FRACBITS-2)) * (i & 2 ? -1 : 1);
|
||||
explodemo->momy += ((prandom & 0xF0) << (FRACBITS-6)) * (i & 1 ? -1 : 1);
|
||||
explodemo->destscale = mo->scale;
|
||||
P_SetScale(explodemo, mo->scale);
|
||||
P_SetScale(explodemo, mo->scale, true);
|
||||
}
|
||||
|
||||
if (mo->threshold != 42) // Don't make pop sound if threshold is 42.
|
||||
|
@ -3140,7 +3155,7 @@ boolean P_SceneryZMovement(mobj_t *mo)
|
|||
mobj_t *flower = P_SpawnMobjFromMobj(mo, 0, 0, 0, flowertype);
|
||||
if (flower)
|
||||
{
|
||||
P_SetScale(flower, mo->scale/16);
|
||||
P_SetScale(flower, mo->scale/16, true);
|
||||
flower->destscale = mo->scale;
|
||||
flower->scalespeed = mo->scale/8;
|
||||
}
|
||||
|
@ -3380,10 +3395,7 @@ void P_MobjCheckWater(mobj_t *mobj)
|
|||
else
|
||||
splish = P_SpawnMobj(mobj->x, mobj->y, mobj->watertop, splishtype);
|
||||
if (!P_MobjWasRemoved(splish))
|
||||
{
|
||||
splish->destscale = mobj->scale;
|
||||
P_SetScale(splish, mobj->scale);
|
||||
}
|
||||
P_SetScale(splish, mobj->scale, true);
|
||||
}
|
||||
|
||||
// skipping stone!
|
||||
|
@ -3422,10 +3434,7 @@ void P_MobjCheckWater(mobj_t *mobj)
|
|||
else
|
||||
splish = P_SpawnMobj(mobj->x, mobj->y, mobj->watertop, splishtype);
|
||||
if (!P_MobjWasRemoved(splish))
|
||||
{
|
||||
splish->destscale = mobj->scale;
|
||||
P_SetScale(splish, mobj->scale);
|
||||
}
|
||||
P_SetScale(splish, mobj->scale, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3476,8 +3485,7 @@ void P_MobjCheckWater(mobj_t *mobj)
|
|||
else
|
||||
bubble->momz = 0;
|
||||
|
||||
bubble->destscale = mobj->scale;
|
||||
P_SetScale(bubble, mobj->scale);
|
||||
P_SetScale(bubble, mobj->scale, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5147,8 +5155,7 @@ static void P_Boss7Thinker(mobj_t *mobj)
|
|||
mobj_t *smoke = P_SpawnMobj(mobj->x, mobj->y, mobj->z + mobj->height, MT_SMOKE);
|
||||
if (!P_MobjWasRemoved(smoke))
|
||||
{
|
||||
smoke->destscale = mobj->destscale;
|
||||
P_SetScale(smoke, smoke->destscale);
|
||||
P_SetScale(smoke, mobj->destscale, true);
|
||||
smoke->momz = FixedMul(FRACUNIT, smoke->scale);
|
||||
}
|
||||
}
|
||||
|
@ -5599,7 +5606,7 @@ static void P_Boss9Thinker(mobj_t *mobj)
|
|||
if (mobj->hprev)
|
||||
{
|
||||
mobj->hprev->destscale = FRACUNIT + (2*TICRATE - mobj->fuse)*(FRACUNIT/2)/TICRATE + FixedMul(FINECOSINE(angle>>ANGLETOFINESHIFT),FRACUNIT/2);
|
||||
P_SetScale(mobj->hprev, mobj->hprev->destscale);
|
||||
P_SetScale(mobj->hprev, mobj->hprev->destscale, false);
|
||||
|
||||
P_MoveOrigin(mobj->hprev, mobj->x, mobj->y, mobj->z + mobj->height/2 - mobj->hprev->height/2);
|
||||
mobj->hprev->momx = mobj->momx;
|
||||
|
@ -5625,8 +5632,8 @@ static void P_Boss9Thinker(mobj_t *mobj)
|
|||
{
|
||||
S_StopSound(missile);
|
||||
if (mobj->extravalue1 >= 2)
|
||||
P_SetScale(missile, FRACUNIT>>1);
|
||||
missile->destscale = missile->scale>>1;
|
||||
P_SetScale(missile, FRACUNIT/2, true);
|
||||
missile->destscale = missile->scale/2;
|
||||
missile->fuse = TICRATE/2;
|
||||
missile->scalespeed = abs(missile->destscale - missile->scale)/missile->fuse;
|
||||
missile->z -= missile->height/2;
|
||||
|
@ -5649,7 +5656,7 @@ static void P_Boss9Thinker(mobj_t *mobj)
|
|||
spread->angle = missile->angle+(ANGLE_11hh/2)*(i-2);
|
||||
P_InstaThrust(spread,spread->angle,-spread->info->speed);
|
||||
spread->momz = missile->momz;
|
||||
P_SetScale(spread, missile->scale);
|
||||
P_SetScale(spread, missile->scale, true);
|
||||
spread->destscale = missile->destscale;
|
||||
spread->scalespeed = missile->scalespeed;
|
||||
spread->fuse = missile->fuse;
|
||||
|
@ -5673,7 +5680,7 @@ static void P_Boss9Thinker(mobj_t *mobj)
|
|||
spread = P_SpawnMissile(mobj, mobj->target, missile->type);
|
||||
if (P_MobjWasRemoved(spread))
|
||||
continue;
|
||||
P_SetScale(spread, missile->scale);
|
||||
P_SetScale(spread, missile->scale, true);
|
||||
spread->destscale = missile->destscale;
|
||||
spread->fuse = missile->fuse;
|
||||
spread->z -= spread->height/2;
|
||||
|
@ -5730,12 +5737,12 @@ static void P_Boss9Thinker(mobj_t *mobj)
|
|||
{
|
||||
if (mobj->health > mobj->info->damage)
|
||||
{
|
||||
P_SetScale(missile, FRACUNIT/3);
|
||||
P_SetScale(missile, FRACUNIT/3, true);
|
||||
missile->color = SKINCOLOR_MAGENTA; // sonic OVA/4 purple power
|
||||
}
|
||||
else
|
||||
{
|
||||
P_SetScale(missile, FRACUNIT/5);
|
||||
P_SetScale(missile, FRACUNIT/5, true);
|
||||
missile->color = SKINCOLOR_SUNSET; // sonic cd electric power
|
||||
}
|
||||
missile->destscale = missile->scale*2;
|
||||
|
@ -5798,10 +5805,7 @@ static void P_Boss9Thinker(mobj_t *mobj)
|
|||
if (!P_MobjWasRemoved(missile))
|
||||
{
|
||||
if (mobj->extravalue1 >= 2)
|
||||
{
|
||||
missile->destscale = FRACUNIT>>1;
|
||||
P_SetScale(missile, missile->destscale);
|
||||
}
|
||||
P_SetScale(missile, FRACUNIT/2, true);
|
||||
missile->fuse = 3*TICRATE;
|
||||
missile->z -= missile->height/2;
|
||||
|
||||
|
@ -5820,8 +5824,7 @@ static void P_Boss9Thinker(mobj_t *mobj)
|
|||
spread->angle = missile->angle+(ANGLE_11hh/2)*(i-2);
|
||||
P_InstaThrust(spread,spread->angle,spread->info->speed);
|
||||
spread->momz = missile->momz;
|
||||
spread->destscale = FRACUNIT>>1;
|
||||
P_SetScale(spread, spread->destscale);
|
||||
P_SetScale(spread, FRACUNIT/2, true);
|
||||
spread->fuse = missile->fuse;
|
||||
}
|
||||
P_InstaThrust(missile,missile->angle,missile->info->speed);
|
||||
|
@ -5838,8 +5841,7 @@ static void P_Boss9Thinker(mobj_t *mobj)
|
|||
spread = P_SpawnMissile(mobj, mobj->target, missile->type);
|
||||
if (!P_MobjWasRemoved(spread))
|
||||
{
|
||||
spread->destscale = FRACUNIT>>1;
|
||||
P_SetScale(spread, spread->destscale);
|
||||
P_SetScale(spread, FRACUNIT/2, true);
|
||||
spread->fuse = missile->fuse;
|
||||
spread->z -= spread->height/2;
|
||||
}
|
||||
|
@ -6103,8 +6105,12 @@ static void P_Boss9Thinker(mobj_t *mobj)
|
|||
whoosh->flags |= MF_NOCLIPHEIGHT;
|
||||
#endif
|
||||
|
||||
P_SetMobjState(mobj->tracer, S_JETFUMEFLASH);
|
||||
P_SetScale(mobj->tracer, mobj->scale << 1);
|
||||
if (!P_MobjWasRemoved(mobj->tracer))
|
||||
{
|
||||
P_SetMobjState(mobj->tracer, S_JETFUMEFLASH);
|
||||
P_SetScale(mobj->tracer, 2*mobj->scale, false);
|
||||
mobj->tracer->old_scale = mobj->tracer->scale;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -6439,28 +6445,24 @@ void P_SpawnParaloop(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 numb
|
|||
//
|
||||
// Sets the sprite scaling
|
||||
//
|
||||
void P_SetScale(mobj_t *mobj, fixed_t newscale)
|
||||
void P_SetScale(mobj_t *mobj, fixed_t newscale, boolean instant)
|
||||
{
|
||||
player_t *player;
|
||||
fixed_t oldscale;
|
||||
|
||||
if (!mobj)
|
||||
return;
|
||||
|
||||
oldscale = mobj->scale; //keep for adjusting stuff below
|
||||
|
||||
mobj->scale = newscale;
|
||||
|
||||
mobj->radius = FixedMul(FixedDiv(mobj->radius, oldscale), newscale);
|
||||
mobj->height = FixedMul(FixedDiv(mobj->height, oldscale), newscale);
|
||||
|
||||
player = mobj->player;
|
||||
|
||||
if (player)
|
||||
if (mobj->player)
|
||||
{
|
||||
G_GhostAddScale(newscale);
|
||||
player->viewheight = FixedMul(FixedDiv(player->viewheight, oldscale), newscale); // Nonono don't calculate viewheight elsewhere, this is the best place for it!
|
||||
// Nonono don't calculate viewheight elsewhere, this is the best place for it!
|
||||
mobj->player->viewheight = FixedMul(FixedDiv(mobj->player->viewheight, mobj->scale), newscale);
|
||||
}
|
||||
|
||||
mobj->radius = FixedMul(FixedDiv(mobj->radius, mobj->scale), newscale);
|
||||
mobj->height = FixedMul(FixedDiv(mobj->height, mobj->scale), newscale);
|
||||
|
||||
mobj->scale = newscale;
|
||||
if (instant)
|
||||
mobj->destscale = mobj->old_scale = newscale;
|
||||
}
|
||||
|
||||
void P_Attract(mobj_t *source, mobj_t *dest, boolean nightsgrab) // Home in on your target
|
||||
|
@ -6815,8 +6817,7 @@ static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield)
|
|||
thing->flags |= MF_NOCLIPHEIGHT;
|
||||
thing->eflags = (thing->eflags & ~MFE_VERTICALFLIP)|(thing->target->eflags & MFE_VERTICALFLIP);
|
||||
|
||||
P_SetScale(thing, FixedMul(thing->target->scale, thing->target->player->shieldscale));
|
||||
thing->destscale = thing->scale;
|
||||
P_SetScale(thing, FixedMul(thing->target->scale, thing->target->player->shieldscale), true);
|
||||
thing->old_scale = FixedMul(thing->target->old_scale, thing->target->player->shieldscale);
|
||||
|
||||
#define NewMH(mobj) mobj->height // Ugly mobj-height and player-height defines, for the sake of prettier code
|
||||
|
@ -7164,11 +7165,11 @@ static void P_MobjScaleThink(mobj_t *mobj)
|
|||
correctionType = 2; // Correct Z position by moving down
|
||||
|
||||
if (abs(mobj->scale - mobj->destscale) < mobj->scalespeed)
|
||||
P_SetScale(mobj, mobj->destscale);
|
||||
P_SetScale(mobj, mobj->destscale, false);
|
||||
else if (mobj->scale < mobj->destscale)
|
||||
P_SetScale(mobj, mobj->scale + mobj->scalespeed);
|
||||
P_SetScale(mobj, mobj->scale + mobj->scalespeed, false);
|
||||
else if (mobj->scale > mobj->destscale)
|
||||
P_SetScale(mobj, mobj->scale - mobj->scalespeed);
|
||||
P_SetScale(mobj, mobj->scale - mobj->scalespeed, false);
|
||||
|
||||
if (correctionType == 1)
|
||||
mobj->z -= (mobj->height - oldheight)/2;
|
||||
|
@ -7261,8 +7262,9 @@ static boolean P_DrownNumbersSceneryThink(mobj_t *mobj)
|
|||
mobj->x = mobj->target->x;
|
||||
mobj->y = mobj->target->y;
|
||||
|
||||
P_SetScale(mobj, mobj->target->scale, false);
|
||||
mobj->destscale = mobj->target->destscale;
|
||||
P_SetScale(mobj, mobj->target->scale);
|
||||
mobj->old_scale = mobj->target->old_scale;
|
||||
|
||||
if (mobj->target->eflags & MFE_VERTICALFLIP)
|
||||
{
|
||||
|
@ -7423,10 +7425,10 @@ static boolean P_ParticleGenSceneryThink(mobj_t *mobj)
|
|||
(mobjtype_t)mobj->threshold);
|
||||
if (!P_MobjWasRemoved(spawn))
|
||||
{
|
||||
P_SetScale(spawn, mobj->scale);
|
||||
spawn->momz = FixedMul(mobj->movefactor, spawn->scale);
|
||||
P_SetScale(spawn, mobj->scale, true);
|
||||
spawn->destscale = spawn->scale/100;
|
||||
spawn->scalespeed = spawn->scale/mobj->health;
|
||||
spawn->momz = FixedMul(mobj->movefactor, spawn->scale);
|
||||
spawn->tics = (tic_t)mobj->health;
|
||||
spawn->flags2 |= (mobj->flags2 & MF2_OBJECTFLIP);
|
||||
spawn->angle += P_RandomKey(36)*ANG10; // irrelevant for default objects but might make sense for some custom ones
|
||||
|
@ -7646,8 +7648,7 @@ static void P_RosySceneryThink(mobj_t *mobj)
|
|||
mobj_t *cdlhrt = P_SpawnMobjFromMobj(mobj, 0, 0, mobj->height, MT_CDLHRT);
|
||||
if (!P_MobjWasRemoved(cdlhrt))
|
||||
{
|
||||
cdlhrt->destscale = (5*mobj->scale) >> 4;
|
||||
P_SetScale(cdlhrt, cdlhrt->destscale);
|
||||
P_SetScale(cdlhrt, (5*mobj->scale) >> 4, true);
|
||||
cdlhrt->fuse = (5*TICRATE) >> 1;
|
||||
cdlhrt->momz = mobj->scale;
|
||||
P_SetTarget(&cdlhrt->target, mobj);
|
||||
|
@ -7901,8 +7902,9 @@ static void P_MobjSceneryThink(mobj_t *mobj)
|
|||
|
||||
mobj->eflags |= (mobj->target->eflags & MFE_VERTICALFLIP);
|
||||
|
||||
P_SetScale(mobj, mobj->target->scale, false);
|
||||
mobj->destscale = mobj->target->destscale;
|
||||
P_SetScale(mobj, mobj->target->scale);
|
||||
mobj->old_scale = mobj->target->old_scale;
|
||||
|
||||
if (!(mobj->eflags & MFE_VERTICALFLIP))
|
||||
mobj->z = mobj->target->z + mobj->target->height + FixedMul((16 + abs((signed)(leveltime % TICRATE) - TICRATE/2))*FRACUNIT, mobj->target->scale);
|
||||
|
@ -8052,7 +8054,9 @@ static void P_MobjSceneryThink(mobj_t *mobj)
|
|||
}
|
||||
P_SetThingPosition(mobj);
|
||||
|
||||
P_SetScale(mobj, mobj->target->scale);
|
||||
P_SetScale(mobj, mobj->target->scale, false);
|
||||
mobj->destscale = mobj->target->destscale;
|
||||
mobj->old_scale = mobj->target->old_scale;
|
||||
}
|
||||
break;
|
||||
case MT_TUTORIALFLOWER:
|
||||
|
@ -8494,8 +8498,8 @@ static void P_ArrowThink(mobj_t *mobj)
|
|||
if (!P_MobjWasRemoved(dust))
|
||||
{
|
||||
dust->tics = 18;
|
||||
dust->scalespeed = 4096;
|
||||
dust->destscale = FRACUNIT/32;
|
||||
dust->scalespeed = FRACUNIT/16;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9906,9 +9910,9 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
|
|||
traindust->frame = P_RandomRange(0, 8)|FF_TRANS90;
|
||||
traindust->angle = mobj->angle;
|
||||
traindust->tics = TICRATE*4;
|
||||
P_SetScale(traindust, FRACUNIT*6, true);
|
||||
traindust->destscale = FRACUNIT*64;
|
||||
traindust->scalespeed = FRACUNIT/24;
|
||||
P_SetScale(traindust, FRACUNIT*6);
|
||||
}
|
||||
break;
|
||||
case MT_TRAINSTEAMSPAWNER:
|
||||
|
@ -9919,9 +9923,9 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
|
|||
P_SetMobjState(steam, S_TRAINSTEAM);
|
||||
steam->frame = P_RandomRange(0, 1)|FF_TRANS90;
|
||||
steam->tics = TICRATE*8;
|
||||
P_SetScale(steam, FRACUNIT*16, true);
|
||||
steam->destscale = FRACUNIT*64;
|
||||
steam->scalespeed = FRACUNIT/8;
|
||||
P_SetScale(steam, FRACUNIT*16);
|
||||
steam->momx = P_SignedRandom()*32;
|
||||
steam->momy = -64*FRACUNIT;
|
||||
steam->momz = 2*FRACUNIT;
|
||||
|
@ -10927,7 +10931,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type, ...)
|
|||
if (titlemapinaction) mobj->flags &= ~MF_NOTHINK;
|
||||
break;
|
||||
case MT_LOCKONINF:
|
||||
P_SetScale(mobj, (mobj->destscale = 3*mobj->scale));
|
||||
P_SetScale(mobj, 3*mobj->scale, true);
|
||||
break;
|
||||
case MT_CYBRAKDEMON_NAPALM_BOMB_LARGE:
|
||||
mobj->fuse = mobj->info->painchance;
|
||||
|
@ -10938,8 +10942,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type, ...)
|
|||
if (P_MobjWasRemoved(spawn))
|
||||
break;
|
||||
|
||||
spawn->destscale = mobj->scale;
|
||||
P_SetScale(spawn, mobj->scale);
|
||||
P_SetScale(spawn, mobj->scale, true);
|
||||
P_SetTarget(&spawn->target, mobj);
|
||||
}
|
||||
break;
|
||||
|
@ -10956,8 +10959,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type, ...)
|
|||
if (P_MobjWasRemoved(spawn))
|
||||
break;
|
||||
|
||||
spawn->destscale = mobj->scale;
|
||||
P_SetScale(spawn, mobj->scale);
|
||||
P_SetScale(spawn, mobj->scale, true);
|
||||
P_SetTarget(&mobj->tracer, spawn);
|
||||
P_SetTarget(&spawn->target, mobj);
|
||||
}
|
||||
|
@ -10974,8 +10976,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type, ...)
|
|||
if (P_MobjWasRemoved(ball))
|
||||
continue;
|
||||
|
||||
ball->destscale = mobj->scale;
|
||||
P_SetScale(ball, mobj->scale);
|
||||
P_SetScale(ball, mobj->scale, true);
|
||||
P_SetTarget(&ball->target, mobj);
|
||||
ball->movedir = FixedAngle(FixedMul(FixedDiv(i<<FRACBITS, mobj->info->damage<<FRACBITS), 360<<FRACBITS));
|
||||
ball->threshold = ball->radius + mobj->radius + FixedMul(ball->info->painchance, ball->scale);
|
||||
|
@ -10996,8 +10997,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type, ...)
|
|||
if (P_MobjWasRemoved(ball))
|
||||
continue;
|
||||
|
||||
ball->destscale = mobj->scale;
|
||||
P_SetScale(ball, mobj->scale);
|
||||
P_SetScale(ball, mobj->scale, true);
|
||||
P_SetTarget(&lastball->tracer, ball);
|
||||
P_SetTarget(&ball->target, mobj);
|
||||
lastball = ball;
|
||||
|
@ -11209,7 +11209,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type, ...)
|
|||
|
||||
if (mobj->skin) // correct inadequecies above.
|
||||
{
|
||||
mobj->sprite2 = P_GetSkinSprite2(mobj->skin, (mobj->frame & FF_FRAMEMASK), NULL);
|
||||
mobj->sprite2 = P_GetSkinSprite2(mobj->skin, P_GetStateSprite2(mobj->state), NULL);
|
||||
mobj->frame &= ~FF_FRAMEMASK;
|
||||
}
|
||||
|
||||
|
@ -11856,7 +11856,7 @@ void P_SpawnPlayer(INT32 playernum)
|
|||
p->awayviewtics = 0;
|
||||
|
||||
// set the scale to the mobj's destscale so settings get correctly set. if we don't, they sometimes don't.
|
||||
P_SetScale(mobj, mobj->destscale);
|
||||
P_SetScale(mobj, mobj->destscale, true);
|
||||
P_FlashPal(p, 0, 0); // Resets
|
||||
|
||||
// Set bounds accurately.
|
||||
|
@ -12030,7 +12030,7 @@ void P_MovePlayerToStarpost(INT32 playernum)
|
|||
|
||||
z = p->starpostz << FRACBITS;
|
||||
|
||||
P_SetScale(mobj, (mobj->destscale = abs(p->starpostscale)));
|
||||
P_SetScale(mobj, abs(p->starpostscale), true);
|
||||
|
||||
if (p->starpostscale < 0)
|
||||
{
|
||||
|
@ -13138,8 +13138,8 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean
|
|||
if (P_MobjWasRemoved(corona))
|
||||
break;
|
||||
|
||||
P_SetScale(corona, (corona->destscale = mobj->scale*3));
|
||||
P_SetTarget(&mobj->tracer, corona);
|
||||
P_SetScale(corona, 3*mobj->scale, true);
|
||||
}
|
||||
break;
|
||||
case MT_FLAMEHOLDER:
|
||||
|
@ -13157,8 +13157,8 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean
|
|||
if (P_MobjWasRemoved(corona))
|
||||
break;
|
||||
|
||||
P_SetScale(corona, (corona->destscale = flame->scale*3));
|
||||
P_SetTarget(&flame->tracer, corona);
|
||||
P_SetScale(corona, 3*flame->scale, true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -13246,10 +13246,8 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean
|
|||
case MT_DSZSTALAGMITE:
|
||||
case MT_DSZ2STALAGMITE:
|
||||
case MT_KELP:
|
||||
if (mthing->args[0]) { // make mobj twice as big as normal
|
||||
P_SetScale(mobj, 2*mobj->scale); // not 2*FRACUNIT in case of something like the old ERZ3 mode
|
||||
mobj->destscale = mobj->scale;
|
||||
}
|
||||
if (mthing->args[0]) // make mobj twice as big as normal
|
||||
P_SetScale(mobj, 2*mobj->scale, true); // not 2*FRACUNIT in case of something like the old ERZ3 mode
|
||||
break;
|
||||
case MT_THZTREE:
|
||||
{ // Spawn the branches
|
||||
|
@ -13328,10 +13326,7 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean
|
|||
case MT_LAVAFALL:
|
||||
mobj->fuse = 30 + mthing->args[0];
|
||||
if (mthing->args[1])
|
||||
{
|
||||
P_SetScale(mobj, 2*mobj->scale);
|
||||
mobj->destscale = mobj->scale;
|
||||
}
|
||||
P_SetScale(mobj, 2*mobj->scale, true);
|
||||
break;
|
||||
case MT_PYREFLY:
|
||||
//start on fire if args[0], otherwise behave normally
|
||||
|
@ -13394,8 +13389,7 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean
|
|||
break;
|
||||
P_SetTarget(&elecmobj->target, mobj);
|
||||
elecmobj->angle = FixedAngle(mthing->angle << FRACBITS);
|
||||
elecmobj->destscale = mobj->scale*2;
|
||||
P_SetScale(elecmobj, elecmobj->destscale);
|
||||
P_SetScale(elecmobj, 2*mobj->scale, true);
|
||||
}
|
||||
break;
|
||||
case MT_STARPOST:
|
||||
|
@ -13453,8 +13447,8 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean
|
|||
return false;
|
||||
}
|
||||
base->angle = mobjangle + ANGLE_90;
|
||||
P_SetScale(base, mobj->scale, true);
|
||||
base->destscale = mobj->destscale;
|
||||
P_SetScale(base, mobj->scale);
|
||||
P_SetTarget(&base->target, mobj);
|
||||
P_SetTarget(&mobj->tracer, base);
|
||||
}
|
||||
|
@ -13631,8 +13625,9 @@ static mobj_t *P_SpawnMobjFromMapThing(mapthing_t *mthing, fixed_t x, fixed_t y,
|
|||
return NULL;
|
||||
mobj->spawnpoint = mthing;
|
||||
|
||||
P_SetScale(mobj, FixedMul(mobj->scale, mthing->scale));
|
||||
P_SetScale(mobj, FixedMul(mobj->scale, mthing->scale), false);
|
||||
mobj->destscale = FixedMul(mobj->destscale, mthing->scale);
|
||||
mobj->old_scale = FixedMul(mobj->old_scale, mthing->scale);
|
||||
|
||||
mobj->spritexscale = mthing->spritexscale;
|
||||
mobj->spriteyscale = mthing->spriteyscale;
|
||||
|
@ -14086,8 +14081,7 @@ mobj_t *P_SpawnXYZMissile(mobj_t *source, mobj_t *dest, mobjtype_t type,
|
|||
if (source->eflags & MFE_VERTICALFLIP)
|
||||
th->flags2 |= MF2_OBJECTFLIP;
|
||||
|
||||
th->destscale = source->scale;
|
||||
P_SetScale(th, source->scale);
|
||||
P_SetScale(th, source->scale, true);
|
||||
|
||||
speed = FixedMul(th->info->speed, th->scale);
|
||||
|
||||
|
@ -14150,8 +14144,7 @@ mobj_t *P_SpawnAlteredDirectionMissile(mobj_t *source, mobjtype_t type, fixed_t
|
|||
if (source->eflags & MFE_VERTICALFLIP)
|
||||
th->flags2 |= MF2_OBJECTFLIP;
|
||||
|
||||
th->destscale = source->scale;
|
||||
P_SetScale(th, source->scale);
|
||||
P_SetScale(th, source->scale, true);
|
||||
|
||||
speed = FixedMul(th->info->speed, th->scale);
|
||||
|
||||
|
@ -14217,8 +14210,7 @@ mobj_t *P_SpawnPointMissile(mobj_t *source, fixed_t xa, fixed_t ya, fixed_t za,
|
|||
if (source->eflags & MFE_VERTICALFLIP)
|
||||
th->flags2 |= MF2_OBJECTFLIP;
|
||||
|
||||
th->destscale = source->scale;
|
||||
P_SetScale(th, source->scale);
|
||||
P_SetScale(th, source->scale, true);
|
||||
|
||||
speed = FixedMul(th->info->speed, th->scale);
|
||||
|
||||
|
@ -14289,8 +14281,7 @@ mobj_t *P_SpawnMissile(mobj_t *source, mobj_t *dest, mobjtype_t type)
|
|||
if (source->eflags & MFE_VERTICALFLIP)
|
||||
th->flags2 |= MF2_OBJECTFLIP;
|
||||
|
||||
th->destscale = source->scale;
|
||||
P_SetScale(th, source->scale);
|
||||
P_SetScale(th, source->scale, true);
|
||||
|
||||
if (source->type == MT_METALSONIC_BATTLE && source->health < 4)
|
||||
speed = FixedMul(FixedMul(th->info->speed, 3*FRACUNIT/2), th->scale);
|
||||
|
@ -14392,8 +14383,7 @@ mobj_t *P_SPMAngle(mobj_t *source, mobjtype_t type, angle_t angle, UINT8 allowai
|
|||
if (source->eflags & MFE_VERTICALFLIP)
|
||||
th->flags2 |= MF2_OBJECTFLIP;
|
||||
|
||||
th->destscale = source->scale;
|
||||
P_SetScale(th, source->scale);
|
||||
P_SetScale(th, source->scale, true);
|
||||
|
||||
th->flags2 |= flags2;
|
||||
|
||||
|
@ -14475,8 +14465,8 @@ mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zo
|
|||
newmobj->old_z2 = mobj->old_z2 + zofs;
|
||||
}
|
||||
|
||||
P_SetScale(newmobj, mobj->scale, false);
|
||||
newmobj->destscale = mobj->destscale;
|
||||
P_SetScale(newmobj, mobj->scale);
|
||||
|
||||
newmobj->old_x2 = mobj->old_x2 + xofs;
|
||||
newmobj->old_y2 = mobj->old_y2 + yofs;
|
||||
|
@ -14505,9 +14495,13 @@ mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zo
|
|||
|
||||
newmobj->old_scale2 = mobj->old_scale2;
|
||||
newmobj->old_scale = mobj->old_scale;
|
||||
newmobj->old_spritexscale2 = mobj->old_spritexscale2;
|
||||
newmobj->old_spritexscale = mobj->old_spritexscale;
|
||||
newmobj->old_spriteyscale2 = mobj->old_spriteyscale2;
|
||||
newmobj->old_spriteyscale = mobj->old_spriteyscale;
|
||||
newmobj->old_spritexoffset2 = mobj->old_spritexoffset2;
|
||||
newmobj->old_spritexoffset = mobj->old_spritexoffset;
|
||||
newmobj->old_spriteyoffset2 = mobj->old_spriteyoffset2;
|
||||
newmobj->old_spriteyoffset = mobj->old_spriteyoffset;
|
||||
|
||||
return newmobj;
|
||||
|
|
14
src/p_mobj.h
14
src/p_mobj.h
|
@ -308,15 +308,15 @@ typedef struct mobj_s
|
|||
angle_t spriteroll, old_spriteroll, old_spriteroll2;
|
||||
spritenum_t sprite; // used to find patch_t and flip value
|
||||
UINT32 frame; // frame number, plus bits see p_pspr.h
|
||||
UINT8 sprite2; // player sprites
|
||||
UINT16 sprite2; // player sprites
|
||||
UINT16 anim_duration; // for FF_ANIMATE states
|
||||
|
||||
UINT32 renderflags; // render flags
|
||||
INT32 blendmode; // blend mode
|
||||
fixed_t spritexscale, spriteyscale;
|
||||
fixed_t spritexoffset, spriteyoffset;
|
||||
fixed_t old_spritexscale, old_spriteyscale;
|
||||
fixed_t old_spritexoffset, old_spriteyoffset;
|
||||
fixed_t old_spritexscale, old_spriteyscale, old_spritexscale2, old_spriteyscale2;
|
||||
fixed_t old_spritexoffset, old_spriteyoffset, old_spritexoffset2, old_spriteyoffset2;
|
||||
struct pslope_s *floorspriteslope; // The slope that the floorsprite is rotated by
|
||||
|
||||
struct msecnode_s *touching_sectorlist; // a linked list of sectors where this object appears
|
||||
|
@ -451,15 +451,15 @@ typedef struct precipmobj_s
|
|||
angle_t spriteroll, old_spriteroll, old_spriteroll2;
|
||||
spritenum_t sprite; // used to find patch_t and flip value
|
||||
UINT32 frame; // frame number, plus bits see p_pspr.h
|
||||
UINT8 sprite2; // player sprites
|
||||
UINT16 sprite2; // player sprites
|
||||
UINT16 anim_duration; // for FF_ANIMATE states
|
||||
|
||||
UINT32 renderflags; // render flags
|
||||
INT32 blendmode; // blend mode
|
||||
fixed_t spritexscale, spriteyscale;
|
||||
fixed_t spritexoffset, spriteyoffset;
|
||||
fixed_t old_spritexscale, old_spriteyscale;
|
||||
fixed_t old_spritexoffset, old_spriteyoffset;
|
||||
fixed_t old_spritexscale, old_spriteyscale, old_spritexscale2, old_spriteyscale2;
|
||||
fixed_t old_spritexoffset, old_spriteyoffset, old_spritexoffset2, old_spriteyoffset2;
|
||||
struct pslope_s *floorspriteslope; // The slope that the floorsprite is rotated by
|
||||
|
||||
struct mprecipsecnode_s *touching_sectorlist; // a linked list of sectors where this object appears
|
||||
|
@ -527,7 +527,7 @@ void P_SnowThinker(precipmobj_t *mobj);
|
|||
void P_RainThinker(precipmobj_t *mobj);
|
||||
void P_NullPrecipThinker(precipmobj_t *mobj);
|
||||
void P_RemovePrecipMobj(precipmobj_t *mobj);
|
||||
void P_SetScale(mobj_t *mobj, fixed_t newscale);
|
||||
void P_SetScale(mobj_t *mobj, fixed_t newscale, boolean instant);
|
||||
void P_XYMovement(mobj_t *mo);
|
||||
void P_RingXYMovement(mobj_t *mo);
|
||||
void P_SceneryXYMovement(mobj_t *mo);
|
||||
|
|
|
@ -97,6 +97,11 @@
|
|||
/// \brief Frame flags - Animate: Start at a random place in the animation (mutually exclusive with above)
|
||||
#define FF_RANDOMANIM 0x40000000
|
||||
|
||||
/// \brief Animation flags: Bits used for the animation ID
|
||||
#define SPR2F_MASK 0x3FF
|
||||
/// \brief Animation flags: "Super" flag
|
||||
#define SPR2F_SUPER 0x400
|
||||
|
||||
/** \brief translucency tables
|
||||
|
||||
\todo add another asm routine which use the fg and bg indexes in the
|
||||
|
|
|
@ -1882,7 +1882,7 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
|
|||
diff |= MD_TICS;
|
||||
if (mobj->sprite != mobj->state->sprite)
|
||||
diff |= MD_SPRITE;
|
||||
if (mobj->sprite == SPR_PLAY && mobj->sprite2 != (mobj->state->frame&FF_FRAMEMASK))
|
||||
if (mobj->sprite == SPR_PLAY && mobj->sprite2 != P_GetStateSprite2(mobj->state))
|
||||
diff |= MD_SPRITE;
|
||||
if (mobj->frame != mobj->state->frame)
|
||||
diff |= MD_FRAME;
|
||||
|
@ -2066,7 +2066,7 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
|
|||
if (diff & MD_SPRITE) {
|
||||
WRITEUINT16(save_p, mobj->sprite);
|
||||
if (mobj->sprite == SPR_PLAY)
|
||||
WRITEUINT8(save_p, mobj->sprite2);
|
||||
WRITEUINT16(save_p, mobj->sprite2);
|
||||
}
|
||||
if (diff & MD_FRAME)
|
||||
{
|
||||
|
@ -3096,12 +3096,12 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker)
|
|||
if (diff & MD_SPRITE) {
|
||||
mobj->sprite = READUINT16(save_p);
|
||||
if (mobj->sprite == SPR_PLAY)
|
||||
mobj->sprite2 = READUINT8(save_p);
|
||||
mobj->sprite2 = READUINT16(save_p);
|
||||
}
|
||||
else {
|
||||
mobj->sprite = mobj->state->sprite;
|
||||
if (mobj->sprite == SPR_PLAY)
|
||||
mobj->sprite2 = mobj->state->frame&FF_FRAMEMASK;
|
||||
mobj->sprite2 = P_GetStateSprite2(mobj->state);
|
||||
}
|
||||
if (diff & MD_FRAME)
|
||||
{
|
||||
|
|
|
@ -3328,8 +3328,6 @@ static void P_InitializeSeg(seg_t *seg)
|
|||
seg->lightmaps = NULL; // list of static lightmap for this seg
|
||||
#endif
|
||||
|
||||
seg->numlights = 0;
|
||||
seg->rlights = NULL;
|
||||
seg->polyseg = NULL;
|
||||
seg->dontrenderme = false;
|
||||
}
|
||||
|
|
253
src/p_user.c
253
src/p_user.c
|
@ -1378,7 +1378,7 @@ void P_DoSuperTransformation(player_t *player, boolean giverings)
|
|||
// P_DoSuperDetransformation
|
||||
//
|
||||
// Detransform into regular Sonic!
|
||||
static void P_DoSuperDetransformation(player_t *player)
|
||||
void P_DoSuperDetransformation(player_t *player)
|
||||
{
|
||||
player->powers[pw_emeralds] = 0; // lost the power stones
|
||||
P_SpawnGhostMobj(player->mo);
|
||||
|
@ -1400,7 +1400,7 @@ static void P_DoSuperDetransformation(player_t *player)
|
|||
if (!G_CoopGametype())
|
||||
player->powers[pw_flashing] = flashingtics-1;
|
||||
|
||||
if (player->mo->sprite2 & FF_SPR2SUPER)
|
||||
if (player->mo->sprite2 & SPR2F_SUPER)
|
||||
P_SetMobjState(player->mo, player->mo->state-states);
|
||||
|
||||
// Inform the netgame that the champion has fallen in the heat of battle.
|
||||
|
@ -2038,8 +2038,7 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj)
|
|||
P_SetTarget(&ghost->target, mobj);
|
||||
P_SetTarget(&ghost->dontdrawforviewmobj, mobj); // Hide the ghost in first-person
|
||||
|
||||
P_SetScale(ghost, mobj->scale);
|
||||
ghost->destscale = mobj->scale;
|
||||
P_SetScale(ghost, mobj->scale, true);
|
||||
|
||||
if (mobj->eflags & MFE_VERTICALFLIP)
|
||||
{
|
||||
|
@ -2098,6 +2097,11 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj)
|
|||
ghost->old_pitch = mobj->old_pitch2;
|
||||
ghost->old_roll = mobj->old_roll2;
|
||||
ghost->old_spriteroll = mobj->old_spriteroll2;
|
||||
ghost->old_spritexscale = mobj->old_spritexscale2;
|
||||
ghost->old_spriteyscale = mobj->old_spriteyscale2;
|
||||
ghost->old_spritexoffset = mobj->old_spritexoffset2;
|
||||
ghost->old_spriteyoffset = mobj->old_spriteyoffset2;
|
||||
ghost->old_scale = mobj->old_scale2;
|
||||
|
||||
return ghost;
|
||||
}
|
||||
|
@ -2153,7 +2157,7 @@ void P_SpawnThokMobj(player_t *player)
|
|||
mobj->eflags |= (player->mo->eflags & MFE_VERTICALFLIP);
|
||||
|
||||
// scale
|
||||
P_SetScale(mobj, (mobj->destscale = player->mo->scale));
|
||||
P_SetScale(mobj, player->mo->scale, true);
|
||||
|
||||
if (type == MT_THOK) // spintrail-specific modification for MT_THOK
|
||||
{
|
||||
|
@ -2217,8 +2221,7 @@ void P_SpawnSpinMobj(player_t *player, mobjtype_t type)
|
|||
mobj->eflags |= (player->mo->eflags & MFE_VERTICALFLIP);
|
||||
|
||||
// scale
|
||||
P_SetScale(mobj, player->mo->scale);
|
||||
mobj->destscale = player->mo->scale;
|
||||
P_SetScale(mobj, player->mo->scale, true);
|
||||
|
||||
if (type == MT_THOK) // spintrail-specific modification for MT_THOK
|
||||
{
|
||||
|
@ -3041,9 +3044,8 @@ static void P_CheckUnderwaterAndSpaceTimer(player_t *player)
|
|||
P_SetMobjState(numbermobj, numbermobj->info->spawnstate+timeleft);
|
||||
|
||||
P_SetTarget(&numbermobj->target, player->mo);
|
||||
P_SetScale(numbermobj, player->mo->scale, true);
|
||||
numbermobj->threshold = 40;
|
||||
numbermobj->destscale = player->mo->scale;
|
||||
P_SetScale(numbermobj, player->mo->scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3105,10 +3107,7 @@ static void P_CheckInvincibilityTimer(player_t *player)
|
|||
{
|
||||
mobj_t *sparkle = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_IVSP);
|
||||
if (!P_MobjWasRemoved(sparkle))
|
||||
{
|
||||
sparkle->destscale = player->mo->scale;
|
||||
P_SetScale(sparkle, player->mo->scale);
|
||||
}
|
||||
P_SetScale(sparkle, player->mo->scale, true);
|
||||
}
|
||||
|
||||
// Resume normal music stuff.
|
||||
|
@ -3183,8 +3182,7 @@ static void P_DoBubbleBreath(player_t *player)
|
|||
if (bubble)
|
||||
{
|
||||
bubble->threshold = 42;
|
||||
bubble->destscale = player->mo->scale;
|
||||
P_SetScale(bubble, bubble->destscale);
|
||||
P_SetScale(bubble, player->mo->scale, true);
|
||||
}
|
||||
|
||||
// Tails stirs up the water while flying in it
|
||||
|
@ -3206,20 +3204,14 @@ static void P_DoBubbleBreath(player_t *player)
|
|||
player->mo->y + stirwatery,
|
||||
stirwaterz, MT_SMALLBUBBLE);
|
||||
if (!P_MobjWasRemoved(bubble))
|
||||
{
|
||||
bubble->destscale = player->mo->scale;
|
||||
P_SetScale(bubble,bubble->destscale);
|
||||
}
|
||||
P_SetScale(bubble, player->mo->scale, true);
|
||||
|
||||
bubble = P_SpawnMobj(
|
||||
player->mo->x - stirwaterx,
|
||||
player->mo->y - stirwatery,
|
||||
stirwaterz, MT_SMALLBUBBLE);
|
||||
if (!P_MobjWasRemoved(bubble))
|
||||
{
|
||||
bubble->destscale = player->mo->scale;
|
||||
P_SetScale(bubble,bubble->destscale);
|
||||
}
|
||||
P_SetScale(bubble, player->mo->scale, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4189,16 +4181,6 @@ static void P_DoFiring(player_t *player, ticcmd_t *cmd)
|
|||
|
||||
I_Assert(player != NULL);
|
||||
I_Assert(!P_MobjWasRemoved(player->mo));
|
||||
|
||||
// Toss a flag
|
||||
if (cmd->buttons & BT_TOSSFLAG && G_GametypeHasTeams()
|
||||
&& !(player->powers[pw_super]) && !(player->tossdelay))
|
||||
{
|
||||
if (!(player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
|
||||
P_PlayerEmeraldBurst(player, true); // Toss emeralds
|
||||
else
|
||||
P_PlayerFlagBurst(player, true);
|
||||
}
|
||||
|
||||
if (!(cmd->buttons & (BT_ATTACK|BT_FIRENORMAL)))
|
||||
{
|
||||
|
@ -4208,7 +4190,7 @@ static void P_DoFiring(player_t *player, ticcmd_t *cmd)
|
|||
return;
|
||||
}
|
||||
|
||||
if (player->pflags & PF_ATTACKDOWN || player->climbing)
|
||||
if (player->pflags & PF_ATTACKDOWN || player->climbing || (G_TagGametype() && !(player->pflags & PF_TAGIT)))
|
||||
return;
|
||||
|
||||
// Fire a fireball if we have the Fire Flower powerup!
|
||||
|
@ -4224,7 +4206,7 @@ static void P_DoFiring(player_t *player, ticcmd_t *cmd)
|
|||
}
|
||||
|
||||
// No ringslinging outside of ringslinger!
|
||||
if (!G_RingSlingerGametype() || player->weapondelay || (G_TagGametype() && !(player->pflags & PF_TAGIT)))
|
||||
if (!G_RingSlingerGametype() || player->weapondelay)
|
||||
return;
|
||||
|
||||
player->pflags |= PF_ATTACKDOWN;
|
||||
|
@ -4424,10 +4406,7 @@ static void P_DoSuperStuff(player_t *player)
|
|||
{
|
||||
spark = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_SUPERSPARK);
|
||||
if (!P_MobjWasRemoved(spark))
|
||||
{
|
||||
spark->destscale = player->mo->scale;
|
||||
P_SetScale(spark, player->mo->scale);
|
||||
}
|
||||
P_SetScale(spark, player->mo->scale, true);
|
||||
}
|
||||
|
||||
// Ran out of rings while super!
|
||||
|
@ -4452,14 +4431,14 @@ boolean P_SuperReady(player_t *player, boolean transform)
|
|||
|| !ALL7EMERALDS(emeralds)
|
||||
|| !(player->rings >= 50)))
|
||||
return false;
|
||||
|
||||
|
||||
if (player->mo
|
||||
&& !player->powers[pw_tailsfly]
|
||||
&& !player->powers[pw_carry]
|
||||
&& (player->charflags & SF_SUPER)
|
||||
&& !P_PlayerInPain(player)
|
||||
&& !player->climbing
|
||||
&& !(player->pflags & (PF_FULLSTASIS|PF_THOKKED|PF_STARTDASH|PF_GLIDING|PF_SLIDING|PF_SHIELDABILITY))
|
||||
&& !(player->pflags & (PF_JUMPSTASIS|PF_THOKKED|PF_STARTDASH|PF_GLIDING|PF_SLIDING|PF_SHIELDABILITY))
|
||||
&& ((player->pflags & PF_JUMPED) || (P_IsObjectOnGround(player->mo) && (player->panim == PA_IDLE || player->panim == PA_EDGE
|
||||
|| player->panim == PA_WALK || player->panim == PA_RUN || (player->charflags & SF_DASHMODE && player->panim == PA_DASH))))
|
||||
&& !(maptol & TOL_NIGHTS))
|
||||
|
@ -4677,8 +4656,7 @@ void P_DoSpinDashDust(player_t *player)
|
|||
P_SetMobjState(particle, S_SPINDUST_FIRE1);
|
||||
|
||||
P_SetTarget(&particle->target, player->mo);
|
||||
particle->destscale = (2*player->mo->scale)/3;
|
||||
P_SetScale(particle, particle->destscale);
|
||||
P_SetScale(particle, (2*player->mo->scale)/3, true);
|
||||
if (player->mo->eflags & MFE_VERTICALFLIP) // readjust z position if needed
|
||||
particle->z = player->mo->z + player->mo->height - particle->height;
|
||||
prandom[0] = P_RandomFixed()<<2; // P_RandomByte()<<10
|
||||
|
@ -5077,7 +5055,7 @@ void P_TwinSpinRejuvenate(player_t *player, mobjtype_t type)
|
|||
if (!P_MobjWasRemoved(missile))
|
||||
{
|
||||
P_SetTarget(&missile->target, player->mo);
|
||||
P_SetScale(missile, (missile->destscale >>= 1));
|
||||
P_SetScale(missile, missile->destscale/2, true);
|
||||
missile->angle = ang + movang;
|
||||
missile->fuse = TICRATE/2;
|
||||
missile->extravalue2 = (99*FRACUNIT)/100;
|
||||
|
@ -5281,7 +5259,7 @@ static boolean P_PlayerShieldThink(player_t *player, ticcmd_t *cmd, mobj_t *lock
|
|||
//
|
||||
// Handles player jumping
|
||||
//
|
||||
static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
|
||||
static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd, boolean spinshieldhack)
|
||||
{
|
||||
mobj_t *lockonthok = NULL, *visual = NULL;
|
||||
|
||||
|
@ -5314,45 +5292,53 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
|
|||
;
|
||||
else if (P_PlayerShieldThink(player, cmd, lockonthok, visual))
|
||||
;
|
||||
else if ((cmd->buttons & BT_SPIN) && !LUA_HookPlayer(player, HOOK(JumpSpinSpecial)))
|
||||
else if (cmd->buttons & BT_SPIN)
|
||||
{
|
||||
switch (player->charability)
|
||||
if (spinshieldhack && !(player->pflags & PF_SPINDOWN) && P_SuperReady(player, true)
|
||||
&& !player->powers[pw_invulnerability] && !(player->powers[pw_shield] & SH_NOSTACK)) // These two checks are no longer in P_SuperReady
|
||||
{
|
||||
case CA_THOK:
|
||||
if (player->powers[pw_super]) // Super Sonic float
|
||||
{
|
||||
if ((player->speed > 5*player->mo->scale) // FixedMul(5<<FRACBITS, player->mo->scale), but scale is FRACUNIT-based
|
||||
&& (P_MobjFlip(player->mo)*player->mo->momz <= 0))
|
||||
{
|
||||
if (player->panim != PA_RUN && player->panim != PA_WALK)
|
||||
{
|
||||
if (player->speed >= FixedMul(player->runspeed, player->mo->scale))
|
||||
P_SetMobjState(player->mo, S_PLAY_FLOAT_RUN);
|
||||
else
|
||||
P_SetMobjState(player->mo, S_PLAY_FLOAT);
|
||||
}
|
||||
|
||||
player->mo->momz = 0;
|
||||
player->pflags &= ~(PF_STARTJUMP|PF_SPINNING);
|
||||
player->secondjump = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CA_TELEKINESIS:
|
||||
if (!(player->pflags & (PF_THOKKED|PF_SPINDOWN)) || (player->charflags & SF_MULTIABILITY))
|
||||
{
|
||||
P_Telekinesis(player,
|
||||
-FixedMul(player->actionspd, player->mo->scale), // -ve thrust (pulling towards player)
|
||||
FixedMul(384*FRACUNIT, player->mo->scale));
|
||||
}
|
||||
break;
|
||||
case CA_TWINSPIN:
|
||||
if ((player->charability2 == CA2_MELEE) && (!(player->pflags & (PF_THOKKED|PF_SPINDOWN)) || player->charflags & SF_MULTIABILITY))
|
||||
P_DoTwinSpin(player);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
// If you're using two-button play, can turn Super and aren't already,
|
||||
// and you don't have a shield, then turn Super!
|
||||
P_DoSuperTransformation(player, false);
|
||||
}
|
||||
else if (!LUA_HookPlayer(player, HOOK(JumpSpinSpecial)))
|
||||
switch (player->charability)
|
||||
{
|
||||
case CA_THOK:
|
||||
if (player->powers[pw_super]) // Super Sonic float
|
||||
{
|
||||
if ((player->speed > 5*player->mo->scale) // FixedMul(5<<FRACBITS, player->mo->scale), but scale is FRACUNIT-based
|
||||
&& (P_MobjFlip(player->mo)*player->mo->momz <= 0))
|
||||
{
|
||||
if (player->panim != PA_RUN && player->panim != PA_WALK)
|
||||
{
|
||||
if (player->speed >= FixedMul(player->runspeed, player->mo->scale))
|
||||
P_SetMobjState(player->mo, S_PLAY_FLOAT_RUN);
|
||||
else
|
||||
P_SetMobjState(player->mo, S_PLAY_FLOAT);
|
||||
}
|
||||
|
||||
player->mo->momz = 0;
|
||||
player->pflags &= ~(PF_STARTJUMP|PF_SPINNING);
|
||||
player->secondjump = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CA_TELEKINESIS:
|
||||
if (!(player->pflags & (PF_THOKKED|PF_SPINDOWN)) || (player->charflags & SF_MULTIABILITY))
|
||||
{
|
||||
P_Telekinesis(player,
|
||||
-FixedMul(player->actionspd, player->mo->scale), // -ve thrust (pulling towards player)
|
||||
FixedMul(384*FRACUNIT, player->mo->scale));
|
||||
}
|
||||
break;
|
||||
case CA_TWINSPIN:
|
||||
if ((player->charability2 == CA2_MELEE) && (!(player->pflags & (PF_THOKKED|PF_SPINDOWN)) || player->charflags & SF_MULTIABILITY))
|
||||
P_DoTwinSpin(player);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7417,9 +7403,8 @@ static void P_NiGHTSMovement(player_t *player)
|
|||
firstmobj = P_SpawnMobj(player->mo->x + P_ReturnThrustX(player->mo, player->mo->angle+ANGLE_90, spawndist), player->mo->y + P_ReturnThrustY(player->mo, player->mo->angle+ANGLE_90, spawndist), z, MT_NIGHTSPARKLE);
|
||||
if (!P_MobjWasRemoved(firstmobj))
|
||||
{
|
||||
firstmobj->destscale = player->mo->scale;
|
||||
P_SetTarget(&firstmobj->target, player->mo);
|
||||
P_SetScale(firstmobj, player->mo->scale);
|
||||
P_SetScale(firstmobj, player->mo->scale, true);
|
||||
// Superloop turns sparkles red
|
||||
if (player->powers[pw_nights_superloop])
|
||||
P_SetMobjState(firstmobj, mobjinfo[MT_NIGHTSPARKLE].seestate);
|
||||
|
@ -7427,10 +7412,8 @@ static void P_NiGHTSMovement(player_t *player)
|
|||
secondmobj = P_SpawnMobj(player->mo->x + P_ReturnThrustX(player->mo, player->mo->angle-ANGLE_90, spawndist), player->mo->y + P_ReturnThrustY(player->mo, player->mo->angle-ANGLE_90, spawndist), z, MT_NIGHTSPARKLE);
|
||||
if (!P_MobjWasRemoved(secondmobj))
|
||||
{
|
||||
secondmobj->destscale = player->mo->scale;
|
||||
P_SetTarget(&secondmobj->target, player->mo);
|
||||
P_SetScale(secondmobj, player->mo->scale);
|
||||
|
||||
P_SetScale(secondmobj, player->mo->scale, true);
|
||||
// Superloop turns sparkles red
|
||||
if (player->powers[pw_nights_superloop])
|
||||
P_SetMobjState(secondmobj, mobjinfo[MT_NIGHTSPARKLE].seestate);
|
||||
|
@ -7445,7 +7428,7 @@ static void P_NiGHTSMovement(player_t *player)
|
|||
{
|
||||
helpermobj->fuse = player->mo->fuse = leveltime;
|
||||
P_SetTarget(&helpermobj->target, player->mo);
|
||||
P_SetScale(helpermobj, player->mo->scale);
|
||||
P_SetScale(helpermobj, player->mo->scale, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7645,8 +7628,7 @@ static void P_NiGHTSMovement(player_t *player)
|
|||
water->flags2 |= MF2_OBJECTFLIP;
|
||||
water->eflags |= MFE_VERTICALFLIP;
|
||||
}
|
||||
water->destscale = player->mo->scale;
|
||||
P_SetScale(water, player->mo->scale);
|
||||
P_SetScale(water, player->mo->scale, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7889,8 +7871,7 @@ void P_ElementalFire(player_t *player, boolean cropcircle)
|
|||
P_SetTarget(&flame->target, player->mo);
|
||||
flame->angle = travelangle + i*(ANGLE_MAX/numangles);
|
||||
flame->fuse = TICRATE*7; // takes about an extra second to hit the ground
|
||||
flame->destscale = player->mo->scale;
|
||||
P_SetScale(flame, player->mo->scale);
|
||||
P_SetScale(flame, player->mo->scale, true);
|
||||
if (!(player->mo->flags2 & MF2_OBJECTFLIP) != !(player->powers[pw_gravityboots])) // take gravity boots into account
|
||||
flame->flags2 |= MF2_OBJECTFLIP;
|
||||
flame->eflags = (flame->eflags & ~MFE_VERTICALFLIP)|(player->mo->eflags & MFE_VERTICALFLIP);
|
||||
|
@ -7927,8 +7908,7 @@ void P_ElementalFire(player_t *player, boolean cropcircle)
|
|||
P_SetTarget(&flame->target, player->mo);
|
||||
flame->angle = travelangle;
|
||||
flame->fuse = TICRATE*6;
|
||||
flame->destscale = player->mo->scale;
|
||||
P_SetScale(flame, player->mo->scale);
|
||||
P_SetScale(flame, player->mo->scale, true);
|
||||
if (!(player->mo->flags2 & MF2_OBJECTFLIP) != !(player->powers[pw_gravityboots])) // take gravity boots into account
|
||||
flame->flags2 |= MF2_OBJECTFLIP;
|
||||
flame->eflags = (flame->eflags & ~MFE_VERTICALFLIP)|(player->mo->eflags & MFE_VERTICALFLIP);
|
||||
|
@ -7976,8 +7956,7 @@ void P_SpawnSkidDust(player_t *player, fixed_t radius, boolean sound)
|
|||
}
|
||||
particle->tics = 10;
|
||||
|
||||
particle->destscale = (2*mo->scale)/3;
|
||||
P_SetScale(particle, particle->destscale);
|
||||
P_SetScale(particle, (2*mo->scale)/3, true);
|
||||
P_SetObjectMomZ(particle, FRACUNIT, false);
|
||||
|
||||
if (mo->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER)) // overrides fire version
|
||||
|
@ -8074,6 +8053,7 @@ void P_MovePlayer(player_t *player)
|
|||
{
|
||||
ticcmd_t *cmd;
|
||||
INT32 i;
|
||||
boolean spinshieldhack = false; // Hack: Is Spin and Shield bound to the same button (pressed on the same tic)?
|
||||
|
||||
fixed_t runspd;
|
||||
|
||||
|
@ -8566,8 +8546,7 @@ void P_MovePlayer(player_t *player)
|
|||
water->flags2 |= MF2_OBJECTFLIP;
|
||||
water->eflags |= MFE_VERTICALFLIP;
|
||||
}
|
||||
water->destscale = player->mo->scale;
|
||||
P_SetScale(water, player->mo->scale);
|
||||
P_SetScale(water, player->mo->scale, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8696,10 +8675,13 @@ void P_MovePlayer(player_t *player)
|
|||
&& !(player->mo->eflags & (MFE_UNDERWATER|MFE_TOUCHWATER)))
|
||||
P_ElementalFire(player, false);
|
||||
|
||||
if ((cmd->buttons & (BT_SPIN|BT_SHIELD)) == (BT_SPIN|BT_SHIELD) && !(player->pflags & (PF_SPINDOWN|PF_SHIELDDOWN)))
|
||||
spinshieldhack = true; // Spin and Shield is bound to the same button (pressed on the same tic), so enable two-button play (Jump and Spin+Shield)
|
||||
|
||||
P_DoSpinAbility(player, cmd);
|
||||
|
||||
// jumping
|
||||
P_DoJumpStuff(player, cmd);
|
||||
P_DoJumpStuff(player, cmd, spinshieldhack);
|
||||
|
||||
// If you're not spinning, you'd better not be spindashing!
|
||||
if (!(player->pflags & PF_SPINNING) && player->powers[pw_carry] != CR_NIGHTSMODE)
|
||||
|
@ -8777,30 +8759,32 @@ void P_MovePlayer(player_t *player)
|
|||
if (!(player->mo->momz || player->mo->momx || player->mo->momy) && !(player->mo->eflags & MFE_GOOWATER)
|
||||
&& player->panim == PA_IDLE && !(player->powers[pw_carry]))
|
||||
P_DoTeeter(player);
|
||||
|
||||
// Toss a flag
|
||||
if (G_GametypeHasTeams() && (cmd->buttons & BT_TOSSFLAG) && !(player->powers[pw_super]) && !(player->tossdelay))
|
||||
{
|
||||
if (!(player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
|
||||
P_PlayerEmeraldBurst(player, true); // Toss emeralds
|
||||
else
|
||||
P_PlayerFlagBurst(player, true);
|
||||
}
|
||||
|
||||
// Check for fire and shield buttons
|
||||
if (!player->exiting && !(player->pflags & PF_STASIS))
|
||||
if (!player->exiting)
|
||||
{
|
||||
// Check for fire buttons
|
||||
P_DoFiring(player, cmd);
|
||||
|
||||
// Release the shield button
|
||||
if (!(cmd->buttons & BT_SHIELD))
|
||||
player->pflags &= ~PF_SHIELDDOWN;
|
||||
|
||||
|
||||
// Shield button behavior
|
||||
// Check P_PlayerShieldThink for actual shields!
|
||||
else if (!(player->pflags & PF_SHIELDDOWN))
|
||||
if ((cmd->buttons & BT_SHIELD) && !(player->pflags & PF_SHIELDDOWN) && !spinshieldhack)
|
||||
{
|
||||
// Transform into super if we can!
|
||||
if (P_SuperReady(player, true))
|
||||
P_DoSuperTransformation(player, false);
|
||||
|
||||
|
||||
// Detransform from super if we can!
|
||||
else if (P_SuperReady(player, false))
|
||||
P_DoSuperDetransformation(player);
|
||||
|
||||
player->pflags |= PF_SHIELDDOWN;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9817,9 +9801,10 @@ static CV_PossibleValue_t CV_CamSpeed[] = {{0, "MIN"}, {1*FRACUNIT, "MAX"}, {0,
|
|||
static CV_PossibleValue_t rotation_cons_t[] = {{1, "MIN"}, {25, "MAX"}, {0, NULL}};
|
||||
static CV_PossibleValue_t CV_CamRotate[] = {{-720, "MIN"}, {720, "MAX"}, {0, NULL}};
|
||||
static CV_PossibleValue_t multiplier_cons_t[] = {{0, "MIN"}, {3*FRACUNIT, "MAX"}, {0, NULL}};
|
||||
static CV_PossibleValue_t campos_cons_t[] = { {INT32_MIN, "MIN"}, {INT32_MAX, "MAX"}, {0, NULL} };
|
||||
|
||||
consvar_t cv_cam_dist = CVAR_INIT ("cam_curdist", "160", CV_FLOAT|CV_ALLOWLUA, NULL, NULL);
|
||||
consvar_t cv_cam_height = CVAR_INIT ("cam_curheight", "25", CV_FLOAT|CV_ALLOWLUA, NULL, NULL);
|
||||
consvar_t cv_cam_dist = CVAR_INIT ("cam_curdist", "160", CV_FLOAT|CV_ALLOWLUA, campos_cons_t, NULL);
|
||||
consvar_t cv_cam_height = CVAR_INIT ("cam_curheight", "25", CV_FLOAT|CV_ALLOWLUA, campos_cons_t, NULL);
|
||||
consvar_t cv_cam_still = CVAR_INIT ("cam_still", "Off", CV_ALLOWLUA, CV_OnOff, NULL);
|
||||
consvar_t cv_cam_speed = CVAR_INIT ("cam_speed", "0.3", CV_FLOAT|CV_SAVE|CV_ALLOWLUA, CV_CamSpeed, NULL);
|
||||
consvar_t cv_cam_rotate = CVAR_INIT ("cam_rotate", "0", CV_CALL|CV_NOINIT|CV_ALLOWLUA, CV_CamRotate, CV_CamRotate_OnChange);
|
||||
|
@ -9827,8 +9812,8 @@ consvar_t cv_cam_rotspeed = CVAR_INIT ("cam_rotspeed", "10", CV_SAVE|CV_ALLOWLUA
|
|||
consvar_t cv_cam_turnmultiplier = CVAR_INIT ("cam_turnmultiplier", "0.75", CV_FLOAT|CV_SAVE|CV_ALLOWLUA, multiplier_cons_t, NULL);
|
||||
consvar_t cv_cam_orbit = CVAR_INIT ("cam_orbit", "Off", CV_SAVE|CV_ALLOWLUA, CV_OnOff, NULL);
|
||||
consvar_t cv_cam_adjust = CVAR_INIT ("cam_adjust", "On", CV_SAVE|CV_ALLOWLUA, CV_OnOff, NULL);
|
||||
consvar_t cv_cam2_dist = CVAR_INIT ("cam2_curdist", "160", CV_FLOAT|CV_ALLOWLUA, NULL, NULL);
|
||||
consvar_t cv_cam2_height = CVAR_INIT ("cam2_curheight", "25", CV_FLOAT|CV_ALLOWLUA, NULL, NULL);
|
||||
consvar_t cv_cam2_dist = CVAR_INIT ("cam2_curdist", "160", CV_FLOAT|CV_ALLOWLUA, campos_cons_t, NULL);
|
||||
consvar_t cv_cam2_height = CVAR_INIT ("cam2_curheight", "25", CV_FLOAT|CV_ALLOWLUA, campos_cons_t, NULL);
|
||||
consvar_t cv_cam2_still = CVAR_INIT ("cam2_still", "Off", CV_ALLOWLUA, CV_OnOff, NULL);
|
||||
consvar_t cv_cam2_speed = CVAR_INIT ("cam2_speed", "0.3", CV_FLOAT|CV_SAVE|CV_ALLOWLUA, CV_CamSpeed, NULL);
|
||||
consvar_t cv_cam2_rotate = CVAR_INIT ("cam2_rotate", "0", CV_CALL|CV_NOINIT|CV_ALLOWLUA, CV_CamRotate, CV_CamRotate2_OnChange);
|
||||
|
@ -9840,23 +9825,23 @@ consvar_t cv_cam2_adjust = CVAR_INIT ("cam2_adjust", "On", CV_SAVE|CV_ALLOWLUA,
|
|||
// [standard vs simple][p1 or p2]
|
||||
consvar_t cv_cam_savedist[2][2] = {
|
||||
{ // standard
|
||||
CVAR_INIT ("cam_dist", "192", CV_FLOAT|CV_SAVE|CV_CALL|CV_ALLOWLUA, NULL, CV_UpdateCamDist),
|
||||
CVAR_INIT ("cam2_dist", "192", CV_FLOAT|CV_SAVE|CV_CALL|CV_ALLOWLUA, NULL, CV_UpdateCam2Dist),
|
||||
CVAR_INIT ("cam_dist", "192", CV_FLOAT|CV_SAVE|CV_CALL|CV_ALLOWLUA, campos_cons_t, CV_UpdateCamDist),
|
||||
CVAR_INIT ("cam2_dist", "192", CV_FLOAT|CV_SAVE|CV_CALL|CV_ALLOWLUA, campos_cons_t, CV_UpdateCam2Dist),
|
||||
},
|
||||
{ // simple
|
||||
CVAR_INIT ("cam_simpledist", "256", CV_FLOAT|CV_SAVE|CV_CALL|CV_ALLOWLUA, NULL, CV_UpdateCamDist),
|
||||
CVAR_INIT ("cam2_simpledist", "256", CV_FLOAT|CV_SAVE|CV_CALL|CV_ALLOWLUA, NULL, CV_UpdateCam2Dist),
|
||||
CVAR_INIT ("cam_simpledist", "256", CV_FLOAT|CV_SAVE|CV_CALL|CV_ALLOWLUA, campos_cons_t, CV_UpdateCamDist),
|
||||
CVAR_INIT ("cam2_simpledist", "256", CV_FLOAT|CV_SAVE|CV_CALL|CV_ALLOWLUA, campos_cons_t, CV_UpdateCam2Dist),
|
||||
|
||||
}
|
||||
};
|
||||
consvar_t cv_cam_saveheight[2][2] = {
|
||||
{ // standard
|
||||
CVAR_INIT ("cam_height", "40", CV_FLOAT|CV_SAVE|CV_CALL|CV_ALLOWLUA, NULL, CV_UpdateCamDist),
|
||||
CVAR_INIT ("cam2_height", "40", CV_FLOAT|CV_SAVE|CV_CALL|CV_ALLOWLUA, NULL, CV_UpdateCam2Dist),
|
||||
CVAR_INIT ("cam_height", "40", CV_FLOAT|CV_SAVE|CV_CALL|CV_ALLOWLUA, campos_cons_t, CV_UpdateCamDist),
|
||||
CVAR_INIT ("cam2_height", "40", CV_FLOAT|CV_SAVE|CV_CALL|CV_ALLOWLUA, campos_cons_t, CV_UpdateCam2Dist),
|
||||
},
|
||||
{ // simple
|
||||
CVAR_INIT ("cam_simpleheight", "60", CV_FLOAT|CV_SAVE|CV_CALL|CV_ALLOWLUA, NULL, CV_UpdateCamDist),
|
||||
CVAR_INIT ("cam2_simpleheight", "60", CV_FLOAT|CV_SAVE|CV_CALL|CV_ALLOWLUA, NULL, CV_UpdateCam2Dist),
|
||||
CVAR_INIT ("cam_simpleheight", "60", CV_FLOAT|CV_SAVE|CV_CALL|CV_ALLOWLUA, campos_cons_t, CV_UpdateCamDist),
|
||||
CVAR_INIT ("cam2_simpleheight", "60", CV_FLOAT|CV_SAVE|CV_CALL|CV_ALLOWLUA, campos_cons_t, CV_UpdateCam2Dist),
|
||||
|
||||
}
|
||||
};
|
||||
|
@ -10999,8 +10984,7 @@ static void P_SpawnSparks(mobj_t *mo, angle_t maindir)
|
|||
spark->momz = mo->momz + r3;
|
||||
|
||||
P_Thrust(spark, R_PointToAngle2(mo->x, mo->y, spark->x, spark->y), 8*FRACUNIT);
|
||||
P_SetScale(spark, FRACUNIT/4);
|
||||
spark->destscale = spark->scale;
|
||||
P_SetScale(spark, FRACUNIT/4, true);
|
||||
spark->fuse = TICRATE/3;
|
||||
}
|
||||
|
||||
|
@ -11434,10 +11418,10 @@ void P_DoTailsOverlay(player_t *player, mobj_t *tails)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (tails->state != states+chosenstate)
|
||||
if (tails->state != &states[chosenstate])
|
||||
{
|
||||
if (states[chosenstate].sprite == SPR_PLAY)
|
||||
tails->sprite2 = P_GetSkinSprite2(((skin_t *)tails->skin), (states[chosenstate].frame & FF_FRAMEMASK), player);
|
||||
tails->sprite2 = P_GetSkinSprite2(((skin_t *)tails->skin), P_GetStateSprite2(&states[chosenstate]), player);
|
||||
P_SetMobjState(tails, chosenstate);
|
||||
}
|
||||
}
|
||||
|
@ -11472,8 +11456,9 @@ void P_DoTailsOverlay(player_t *player, mobj_t *tails)
|
|||
tails->threshold = player->mo->z;
|
||||
tails->movecount = player->panim;
|
||||
tails->angle = horizangle;
|
||||
P_SetScale(tails, player->mo->scale);
|
||||
P_SetScale(tails, player->mo->scale, false);
|
||||
tails->destscale = player->mo->destscale;
|
||||
tails->old_scale = player->mo->old_scale;
|
||||
tails->radius = player->mo->radius;
|
||||
tails->height = player->mo->height;
|
||||
zoffs = FixedMul(zoffs, tails->scale);
|
||||
|
@ -11564,7 +11549,9 @@ void P_DoMetalJetFume(player_t *player, mobj_t *fume)
|
|||
y = mo->y + radiusY + FixedMul(offsetH, factorY);
|
||||
z = mo->z + heightoffset + offsetV;
|
||||
bubble = P_SpawnMobj(x, y, z, MT_SMALLBUBBLE);
|
||||
bubble->scale = mo->scale >> 1;
|
||||
P_SetScale(bubble, mo->scale/2, true);
|
||||
bubble->destscale = mo->scale;
|
||||
bubble->scalespeed = FixedMul(bubble->scalespeed, mo->scale);
|
||||
P_SetTarget(&bubble->dontdrawforviewmobj, mo); // Hide the bubble in first-person
|
||||
}
|
||||
|
||||
|
@ -11585,7 +11572,7 @@ void P_DoMetalJetFume(player_t *player, mobj_t *fume)
|
|||
if (stat == fume->info->spawnstate) // If currently inivisble, activate!
|
||||
{
|
||||
P_SetMobjState(fume, (stat = fume->info->seestate));
|
||||
P_SetScale(fume, mo->scale);
|
||||
P_SetScale(fume, mo->scale, false);
|
||||
resetinterp = true;
|
||||
}
|
||||
|
||||
|
@ -11600,7 +11587,7 @@ void P_DoMetalJetFume(player_t *player, mobj_t *fume)
|
|||
if (dashmode == DASHMODE_THRESHOLD && dashmode > (tic_t)fume->movecount) // If just about to enter dashmode, play the startup animation again
|
||||
{
|
||||
P_SetMobjState(fume, (stat = fume->info->seestate));
|
||||
P_SetScale(fume, mo->scale << 1);
|
||||
P_SetScale(fume, 2*mo->scale, true);
|
||||
}
|
||||
fume->flags2 = (fume->flags2 & ~MF2_DONTDRAW) | (mo->flags2 & MF2_DONTDRAW);
|
||||
fume->destscale = (mo->scale + FixedDiv(player->speed, player->normalspeed)) / (underwater ? 6 : 3);
|
||||
|
@ -12054,7 +12041,7 @@ void P_PlayerThink(player_t *player)
|
|||
ticmiss++;
|
||||
|
||||
P_DoRopeHang(player);
|
||||
P_DoJumpStuff(player, &player->cmd);
|
||||
P_DoJumpStuff(player, &player->cmd, false); // P_DoRopeHang would set PF_SPINDOWN, so no spinshieldhack here
|
||||
}
|
||||
else //if (player->powers[pw_carry] == CR_ZOOMTUBE)
|
||||
{
|
||||
|
@ -12324,6 +12311,12 @@ void P_PlayerThink(player_t *player)
|
|||
player->pflags &= ~PF_SPINDOWN;
|
||||
}
|
||||
|
||||
// Check for Shield button
|
||||
if (cmd->buttons & BT_SHIELD)
|
||||
player->pflags |= PF_SHIELDDOWN;
|
||||
else
|
||||
player->pflags &= ~PF_SHIELDDOWN;
|
||||
|
||||
// IF PLAYER NOT HERE THEN FLASH END IF
|
||||
if (player->quittime && player->powers[pw_flashing] < flashingtics - 1
|
||||
&& !(G_TagGametype() && !(player->pflags & PF_TAGIT)) && !player->gotflag)
|
||||
|
|
|
@ -1292,10 +1292,9 @@ void R_RenderPortalHorizonLine(sector_t *sector)
|
|||
|| frontsector->ceilingpic == skyflatnum
|
||||
|| (frontsector->heightsec != -1 && sectors[frontsector->heightsec].floorpic == skyflatnum))
|
||||
{
|
||||
ceilingplane = R_FindPlane(frontsector, frontsector->ceilingheight, frontsector->ceilingpic,
|
||||
ceilinglightlevel, frontsector->ceilingxoffset, frontsector->ceilingxscale, frontsector->ceilingyscale,
|
||||
frontsector->ceilingyoffset, frontsector->ceilingangle,
|
||||
ceilingcolormap, NULL, NULL, NULL, NULL);
|
||||
ceilingplane = R_FindPlane(frontsector, frontsector->ceilingheight, frontsector->ceilingpic, ceilinglightlevel,
|
||||
frontsector->ceilingxoffset, frontsector->ceilingyoffset, frontsector->ceilingxscale, frontsector->ceilingyscale,
|
||||
frontsector->ceilingangle, ceilingcolormap, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
else
|
||||
ceilingplane = NULL;
|
||||
|
|
|
@ -740,9 +740,6 @@ typedef struct seg_s
|
|||
lightmap_t *lightmaps; // for static lightmap
|
||||
#endif
|
||||
|
||||
// Why slow things down by calculating lightlists for every thick side?
|
||||
size_t numlights;
|
||||
r_lightlist_t *rlights;
|
||||
polyobj_t *polyseg;
|
||||
boolean dontrenderme;
|
||||
boolean glseg;
|
||||
|
@ -826,6 +823,7 @@ typedef struct drawseg_s
|
|||
INT16 *sprtopclip;
|
||||
INT16 *sprbottomclip;
|
||||
fixed_t *maskedtexturecol;
|
||||
fixed_t *maskedtextureheight; // For handling sloped midtextures
|
||||
fixed_t *invscale;
|
||||
|
||||
struct visplane_s *ffloorplanes[MAXFFLOORS];
|
||||
|
@ -837,8 +835,6 @@ typedef struct drawseg_s
|
|||
|
||||
UINT8 portalpass; // if > 0 and <= portalrender, do not affect sprite clipping
|
||||
|
||||
fixed_t *maskedtextureheight; // For handling sloped midtextures
|
||||
|
||||
vertex_t leftpos, rightpos; // Used for rendering FOF walls with slopes
|
||||
} drawseg_t;
|
||||
|
||||
|
|
|
@ -817,6 +817,10 @@ void R_ResetMobjInterpolationState(mobj_t *mobj)
|
|||
mobj->old_roll2 = mobj->old_roll;
|
||||
mobj->old_spriteroll2 = mobj->old_spriteroll;
|
||||
mobj->old_scale2 = mobj->old_scale;
|
||||
mobj->old_spritexscale2 = mobj->old_spritexscale;
|
||||
mobj->old_spriteyscale2 = mobj->old_spriteyscale;
|
||||
mobj->old_spritexoffset2 = mobj->old_spritexoffset;
|
||||
mobj->old_spriteyoffset2 = mobj->old_spriteyoffset;
|
||||
mobj->old_x = mobj->x;
|
||||
mobj->old_y = mobj->y;
|
||||
mobj->old_z = mobj->z;
|
||||
|
@ -853,6 +857,10 @@ void R_ResetPrecipitationMobjInterpolationState(precipmobj_t *mobj)
|
|||
mobj->old_pitch2 = mobj->old_pitch;
|
||||
mobj->old_roll2 = mobj->old_roll;
|
||||
mobj->old_spriteroll2 = mobj->old_spriteroll;
|
||||
mobj->old_spritexscale2 = mobj->old_spritexscale;
|
||||
mobj->old_spriteyscale2 = mobj->old_spriteyscale;
|
||||
mobj->old_spritexoffset2 = mobj->old_spritexoffset;
|
||||
mobj->old_spriteyoffset2 = mobj->old_spriteyoffset;
|
||||
mobj->old_x = mobj->x;
|
||||
mobj->old_y = mobj->y;
|
||||
mobj->old_z = mobj->z;
|
||||
|
|
79
src/r_main.c
79
src/r_main.c
|
@ -66,6 +66,10 @@ sector_t *viewsector;
|
|||
player_t *viewplayer;
|
||||
mobj_t *r_viewmobj;
|
||||
|
||||
boolean r_renderwalls;
|
||||
boolean r_renderfloors;
|
||||
boolean r_renderthings;
|
||||
|
||||
fixed_t rendertimefrac;
|
||||
fixed_t renderdeltatics;
|
||||
boolean renderisnewtic;
|
||||
|
@ -149,8 +153,6 @@ consvar_t cv_flipcam2 = CVAR_INIT ("flipcam2", "No", CV_SAVE|CV_CALL|CV_NOINIT,
|
|||
|
||||
consvar_t cv_shadow = CVAR_INIT ("shadow", "On", CV_SAVE, CV_OnOff, NULL);
|
||||
consvar_t cv_skybox = CVAR_INIT ("skybox", "On", CV_SAVE, CV_OnOff, NULL);
|
||||
consvar_t cv_ffloorclip = CVAR_INIT ("r_ffloorclip", "On", CV_SAVE, CV_OnOff, NULL);
|
||||
consvar_t cv_spriteclip = CVAR_INIT ("r_spriteclip", "On", CV_SAVE, CV_OnOff, NULL);
|
||||
consvar_t cv_allowmlook = CVAR_INIT ("allowmlook", "Yes", CV_NETVAR|CV_ALLOWLUA, CV_YesNo, NULL);
|
||||
consvar_t cv_showhud = CVAR_INIT ("showhud", "Yes", CV_CALL|CV_ALLOWLUA, CV_YesNo, R_SetViewSize);
|
||||
consvar_t cv_translucenthud = CVAR_INIT ("translucenthud", "10", CV_SAVE, translucenthud_cons_t, NULL);
|
||||
|
@ -162,12 +164,17 @@ consvar_t cv_drawdist_precip = CVAR_INIT ("drawdist_precip", "1024", CV_SAVE, dr
|
|||
consvar_t cv_fov = CVAR_INIT ("fov", "90", CV_SAVE|CV_FLOAT|CV_CALL, fov_cons_t, Fov_OnChange);
|
||||
consvar_t cv_fovadjust = CVAR_INIT ("fovadjust", "On", CV_SAVE|CV_CALL, CV_OnOff, Fov_OnChange);
|
||||
consvar_t cv_fovchange = CVAR_INIT ("fovchange", "Off", CV_SAVE, CV_OnOff, NULL);
|
||||
|
||||
// Okay, whoever said homremoval causes a performance hit should be shot.
|
||||
consvar_t cv_homremoval = CVAR_INIT ("homremoval", "No", CV_SAVE, homremoval_cons_t, NULL);
|
||||
|
||||
consvar_t cv_maxportals = CVAR_INIT ("maxportals", "2", CV_SAVE, maxportals_cons_t, NULL);
|
||||
|
||||
consvar_t cv_renderview = CVAR_INIT ("renderview", "On", 0, CV_OnOff, NULL);
|
||||
consvar_t cv_renderwalls = CVAR_INIT ("r_renderwalls", "On", 0, CV_OnOff, NULL);
|
||||
consvar_t cv_renderfloors = CVAR_INIT ("r_renderfloors", "On", 0, CV_OnOff, NULL);
|
||||
consvar_t cv_renderthings = CVAR_INIT ("r_renderthings", "On", 0, CV_OnOff, NULL);
|
||||
consvar_t cv_ffloorclip = CVAR_INIT ("r_ffloorclip", "On", 0, CV_OnOff, NULL);
|
||||
consvar_t cv_spriteclip = CVAR_INIT ("r_spriteclip", "On", 0, CV_OnOff, NULL);
|
||||
|
||||
consvar_t cv_homremoval = CVAR_INIT ("homremoval", "No", CV_SAVE, homremoval_cons_t, NULL);
|
||||
|
||||
consvar_t cv_renderstats = CVAR_INIT ("renderstats", "Off", 0, CV_OnOff, NULL);
|
||||
|
||||
void SplitScreen_OnChange(void)
|
||||
|
@ -384,33 +391,26 @@ fixed_t R_PointToDist(fixed_t x, fixed_t y)
|
|||
return R_PointToDist2(viewx, viewy, x, y);
|
||||
}
|
||||
|
||||
//
|
||||
// R_ScaleFromGlobalAngle
|
||||
// Returns the texture mapping scale for the current line (horizontal span)
|
||||
// at the given angle.
|
||||
// rw_distance must be calculated first.
|
||||
//
|
||||
// killough 5/2/98: reformatted, cleaned up
|
||||
//
|
||||
// note: THIS IS USED ONLY FOR WALLS!
|
||||
fixed_t R_ScaleFromGlobalAngle(angle_t visangle)
|
||||
line_t *R_GetFFloorLine(const seg_t *seg, const ffloor_t *pfloor)
|
||||
{
|
||||
angle_t anglea = ANGLE_90 + (visangle-viewangle);
|
||||
angle_t angleb = ANGLE_90 + (visangle-rw_normalangle);
|
||||
fixed_t den = FixedMul(rw_distance, FINESINE(anglea>>ANGLETOFINESHIFT));
|
||||
// proff 11/06/98: Changed for high-res
|
||||
fixed_t num = FixedMul(projectiony, FINESINE(angleb>>ANGLETOFINESHIFT));
|
||||
|
||||
if (den > num>>16)
|
||||
if (pfloor->master->flags & ML_TFERLINE)
|
||||
{
|
||||
num = FixedDiv(num, den);
|
||||
if (num > 64*FRACUNIT)
|
||||
return 64*FRACUNIT;
|
||||
if (num < 256)
|
||||
return 256;
|
||||
return num;
|
||||
size_t linenum = seg->linedef - pfloor->target->lines[0];
|
||||
return pfloor->master->frontsector->lines[0] + linenum;
|
||||
}
|
||||
return 64*FRACUNIT;
|
||||
else
|
||||
return pfloor->master;
|
||||
}
|
||||
|
||||
side_t *R_GetFFloorSide(const seg_t *seg, const ffloor_t *pfloor)
|
||||
{
|
||||
if (pfloor->master->flags & ML_TFERLINE)
|
||||
{
|
||||
line_t *newline = R_GetFFloorLine(seg, pfloor);
|
||||
return &sides[newline->sidenum[0]];
|
||||
}
|
||||
else
|
||||
return &sides[pfloor->master->sidenum[0]];
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1654,17 +1654,11 @@ void R_RenderPlayerView(player_t *player)
|
|||
|
||||
void R_RegisterEngineStuff(void)
|
||||
{
|
||||
CV_RegisterVar(&cv_gravity);
|
||||
CV_RegisterVar(&cv_tailspickup);
|
||||
CV_RegisterVar(&cv_allowmlook);
|
||||
CV_RegisterVar(&cv_homremoval);
|
||||
CV_RegisterVar(&cv_flipcam);
|
||||
CV_RegisterVar(&cv_flipcam2);
|
||||
|
||||
// Enough for dedicated server
|
||||
// Do nothing for dedicated server
|
||||
if (dedicated)
|
||||
return;
|
||||
|
||||
CV_RegisterVar(&cv_homremoval);
|
||||
CV_RegisterVar(&cv_translucency);
|
||||
CV_RegisterVar(&cv_drawdist);
|
||||
CV_RegisterVar(&cv_drawdist_nights);
|
||||
|
@ -1679,6 +1673,13 @@ void R_RegisterEngineStuff(void)
|
|||
|
||||
CV_RegisterVar(&cv_shadow);
|
||||
CV_RegisterVar(&cv_skybox);
|
||||
CV_RegisterVar(&cv_renderview);
|
||||
CV_RegisterVar(&cv_renderhitboxinterpolation);
|
||||
CV_RegisterVar(&cv_renderhitboxgldepth);
|
||||
CV_RegisterVar(&cv_renderhitbox);
|
||||
CV_RegisterVar(&cv_renderwalls);
|
||||
CV_RegisterVar(&cv_renderfloors);
|
||||
CV_RegisterVar(&cv_renderthings);
|
||||
CV_RegisterVar(&cv_ffloorclip);
|
||||
CV_RegisterVar(&cv_spriteclip);
|
||||
|
||||
|
@ -1717,8 +1718,6 @@ void R_RegisterEngineStuff(void)
|
|||
|
||||
CV_RegisterVar(&cv_maxportals);
|
||||
|
||||
CV_RegisterVar(&cv_movebob);
|
||||
|
||||
// Frame interpolation/uncapped
|
||||
CV_RegisterVar(&cv_fpscap);
|
||||
}
|
||||
|
|
14
src/r_main.h
14
src/r_main.h
|
@ -80,13 +80,15 @@ angle_t R_PointToAngle2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1);
|
|||
fixed_t R_PointToDist(fixed_t x, fixed_t y);
|
||||
fixed_t R_PointToDist2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1);
|
||||
|
||||
fixed_t R_ScaleFromGlobalAngle(angle_t visangle);
|
||||
boolean R_IsPointInSector(sector_t *sector, fixed_t x, fixed_t y);
|
||||
subsector_t *R_PointInSubsector(fixed_t x, fixed_t y);
|
||||
subsector_t *R_PointInSubsectorOrNull(fixed_t x, fixed_t y);
|
||||
|
||||
boolean R_DoCulling(line_t *cullheight, line_t *viewcullheight, fixed_t vz, fixed_t bottomh, fixed_t toph);
|
||||
|
||||
line_t *R_GetFFloorLine(const seg_t *seg, const ffloor_t *pfloor);
|
||||
side_t *R_GetFFloorSide(const seg_t *seg, const ffloor_t *pfloor);
|
||||
|
||||
// Render stats
|
||||
|
||||
extern precise_t ps_prevframetime;// time when previous frame was rendered
|
||||
|
@ -117,12 +119,18 @@ extern consvar_t cv_chasecam, cv_chasecam2;
|
|||
extern consvar_t cv_flipcam, cv_flipcam2;
|
||||
|
||||
extern consvar_t cv_shadow;
|
||||
extern consvar_t cv_ffloorclip, cv_spriteclip;
|
||||
extern consvar_t cv_translucency;
|
||||
extern consvar_t cv_drawdist, cv_drawdist_nights, cv_drawdist_precip;
|
||||
extern consvar_t cv_fov, cv_fovadjust, cv_fovchange;
|
||||
extern consvar_t cv_skybox;
|
||||
extern consvar_t cv_tailspickup;
|
||||
extern consvar_t cv_renderview;
|
||||
extern consvar_t cv_renderhitbox, cv_renderhitboxinterpolation, cv_renderhitboxgldepth;
|
||||
extern consvar_t cv_renderwalls, cv_renderfloors, cv_renderthings;
|
||||
extern consvar_t cv_ffloorclip, cv_spriteclip;
|
||||
|
||||
extern boolean r_renderwalls;
|
||||
extern boolean r_renderfloors;
|
||||
extern boolean r_renderthings;
|
||||
|
||||
// Called by startup code.
|
||||
void R_Init(void);
|
||||
|
|
|
@ -657,6 +657,9 @@ void R_DrawPlanes(void)
|
|||
visplane_t *pl;
|
||||
INT32 i;
|
||||
|
||||
if (!r_renderfloors)
|
||||
return;
|
||||
|
||||
R_UpdatePlaneRipple();
|
||||
|
||||
for (i = 0; i < MAXVISPLANES; i++, pl++)
|
||||
|
@ -935,9 +938,6 @@ void R_DrawSinglePlane(visplane_t *pl)
|
|||
if (!(pl->minx <= pl->maxx))
|
||||
return;
|
||||
|
||||
if (!cv_renderfloors.value)
|
||||
return;
|
||||
|
||||
// sky flat
|
||||
if (pl->picnum == skyflatnum)
|
||||
{
|
||||
|
|
357
src/r_segs.c
357
src/r_segs.c
|
@ -16,7 +16,6 @@
|
|||
#include "r_sky.h"
|
||||
|
||||
#include "r_portal.h"
|
||||
#include "r_splats.h"
|
||||
|
||||
#include "w_wad.h"
|
||||
#include "z_zone.h"
|
||||
|
@ -75,6 +74,8 @@ static fixed_t *maskedtextureheight = NULL;
|
|||
static fixed_t *thicksidecol = NULL;
|
||||
static fixed_t *invscale = NULL;
|
||||
|
||||
static boolean texcoltables;
|
||||
|
||||
//SoM: 3/23/2000: Use boom opening limit removal
|
||||
static size_t numopenings;
|
||||
static INT16 *openings, *lastopening;
|
||||
|
@ -88,10 +89,6 @@ void R_ClearSegTables(void)
|
|||
curtexturecolumntable = texturecolumntable;
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
// R_RenderMaskedSegRange
|
||||
// ==========================================================================
|
||||
|
||||
transnum_t R_GetLinedefTransTable(fixed_t alpha)
|
||||
{
|
||||
return (20*(FRACUNIT - alpha - 1) + FRACUNIT) >> (FRACBITS+1);
|
||||
|
@ -111,10 +108,12 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
|
|||
INT32 times, repeats;
|
||||
INT64 overflow_test;
|
||||
INT32 range;
|
||||
UINT8 vertflip;
|
||||
unsigned lengthcol;
|
||||
|
||||
if (!cv_renderwalls.value)
|
||||
return;
|
||||
fixed_t wall_scaley;
|
||||
fixed_t scalestep;
|
||||
fixed_t scale1;
|
||||
|
||||
// Calculate light table.
|
||||
// Use different light tables
|
||||
|
@ -163,9 +162,17 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
|
|||
colfunc = colfuncs[COLDRAWFUNC_FUZZY];
|
||||
}
|
||||
|
||||
fixed_t wall_scaley = sidedef->scaley_mid;
|
||||
fixed_t scalestep = FixedDiv(ds->scalestep, wall_scaley);
|
||||
fixed_t scale1 = FixedDiv(ds->scale1, wall_scaley);
|
||||
vertflip = textures[texnum]->flip & 2;
|
||||
|
||||
wall_scaley = sidedef->scaley_mid;
|
||||
if (wall_scaley < 0)
|
||||
{
|
||||
wall_scaley = -wall_scaley;
|
||||
vertflip = !vertflip;
|
||||
}
|
||||
|
||||
scalestep = FixedDiv(ds->scalestep, wall_scaley);
|
||||
scale1 = FixedDiv(ds->scale1, wall_scaley);
|
||||
|
||||
range = max(ds->x2-ds->x1, 1);
|
||||
rw_scalestep = scalestep;
|
||||
|
@ -174,7 +181,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
|
|||
// Texture must be cached
|
||||
R_CheckTextureCache(texnum);
|
||||
|
||||
if (textures[texnum]->flip & 2) // vertically flipped?
|
||||
if (vertflip) // vertically flipped?
|
||||
colfunc_2s = R_DrawFlippedMaskedColumn;
|
||||
else
|
||||
colfunc_2s = R_DrawMaskedColumn; // render the usual 2sided single-patch packed texture
|
||||
|
@ -470,6 +477,11 @@ static boolean R_IsFFloorTranslucent(visffloor_t *pfloor)
|
|||
return false;
|
||||
}
|
||||
|
||||
static fixed_t R_GetSlopeTextureSlide(pslope_t *slope, angle_t lineangle)
|
||||
{
|
||||
return FixedMul(slope->zdelta, FINECOSINE((lineangle-slope->xydirection)>>ANGLETOFINESHIFT));
|
||||
}
|
||||
|
||||
//
|
||||
// R_RenderThickSideRange
|
||||
// Renders all the thick sides in the given range.
|
||||
|
@ -494,19 +506,18 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
|||
INT64 top_frac, top_step, bottom_frac, bottom_step;
|
||||
// skew FOF walls with slopes?
|
||||
fixed_t ffloortextureslide = 0;
|
||||
INT32 oldx = -1;
|
||||
fixed_t oldtexturecolumn = -1;
|
||||
fixed_t left_top, left_bottom; // needed here for slope skewing
|
||||
pslope_t *skewslope = NULL;
|
||||
boolean do_texture_skew;
|
||||
boolean dont_peg_bottom;
|
||||
fixed_t wall_offsetx;
|
||||
fixed_t wall_scalex, wall_scaley;
|
||||
UINT8 vertflip;
|
||||
unsigned lengthcol;
|
||||
|
||||
void (*colfunc_2s) (column_t *, unsigned);
|
||||
|
||||
if (!cv_renderwalls.value)
|
||||
return;
|
||||
|
||||
// Calculate light table.
|
||||
// Use different light tables
|
||||
// for horizontal / vertical / diagonal. Diagonal?
|
||||
|
@ -515,15 +526,13 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
|||
curline = ds->curline;
|
||||
backsector = pfloor->target;
|
||||
frontsector = curline->frontsector == pfloor->target ? curline->backsector : curline->frontsector;
|
||||
sidedef = &sides[pfloor->master->sidenum[0]];
|
||||
sidedef = R_GetFFloorSide(curline, pfloor);
|
||||
|
||||
colfunc = colfuncs[BASEDRAWFUNC];
|
||||
|
||||
if (pfloor->master->flags & ML_TFERLINE)
|
||||
{
|
||||
size_t linenum = curline->linedef-backsector->lines[0];
|
||||
line_t *newline = pfloor->master->frontsector->lines[0] + linenum;
|
||||
sidedef = &sides[newline->sidenum[0]];
|
||||
line_t *newline = R_GetFFloorLine(curline, pfloor);
|
||||
do_texture_skew = newline->flags & ML_SKEWTD;
|
||||
dont_peg_bottom = newline->flags & ML_DONTPEGBOTTOM;
|
||||
}
|
||||
|
@ -534,6 +543,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
|||
}
|
||||
|
||||
texnum = R_GetTextureNum(sidedef->midtexture);
|
||||
vertflip = textures[texnum]->flip & 2;
|
||||
|
||||
if (pfloor->fofflags & FOF_TRANSLUCENT)
|
||||
{
|
||||
|
@ -687,18 +697,25 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
|||
|
||||
wall_scalex = FixedDiv(FRACUNIT, sidedef->scalex_mid);
|
||||
wall_scaley = sidedef->scaley_mid;
|
||||
if (wall_scaley < 0)
|
||||
{
|
||||
wall_scaley = -wall_scaley;
|
||||
vertflip = !vertflip;
|
||||
}
|
||||
|
||||
thicksidecol = ffloortexturecolumn;
|
||||
|
||||
wall_offsetx = ds->offsetx + sidedef->offsetx_mid;
|
||||
|
||||
if (wall_scalex == FRACUNIT)
|
||||
{
|
||||
for (INT32 x = x1; x <= x2; x++)
|
||||
thicksidecol[x] = ds->thicksidecol[x] + ds->offsetx;
|
||||
thicksidecol[x] = ds->thicksidecol[x];
|
||||
}
|
||||
else
|
||||
{
|
||||
for (INT32 x = x1; x <= x2; x++)
|
||||
thicksidecol[x] = FixedDiv(ds->thicksidecol[x], wall_scalex) + ds->offsetx;
|
||||
thicksidecol[x] = FixedDiv(ds->thicksidecol[x], wall_scalex);
|
||||
}
|
||||
|
||||
mfloorclip = ds->sprbottomclip;
|
||||
|
@ -733,7 +750,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
|||
if (skewslope)
|
||||
{
|
||||
angle_t lineangle = R_PointToAngle2(curline->v1->x, curline->v1->y, curline->v2->x, curline->v2->y);
|
||||
ffloortextureslide = FixedMul(skewslope->zdelta, FINECOSINE((lineangle-skewslope->xydirection)>>ANGLETOFINESHIFT));
|
||||
ffloortextureslide = FixedMul(R_GetSlopeTextureSlide(skewslope, lineangle), wall_scaley);
|
||||
}
|
||||
|
||||
dc_texturemid += offsetvalue;
|
||||
|
@ -741,7 +758,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
|||
// Texture must be cached
|
||||
R_CheckTextureCache(texnum);
|
||||
|
||||
if (textures[texnum]->flip & 2) // vertically flipped?
|
||||
if (vertflip) // vertically flipped?
|
||||
colfunc_2s = R_DrawRepeatFlippedMaskedColumn;
|
||||
else
|
||||
colfunc_2s = R_DrawRepeatMaskedColumn;
|
||||
|
@ -775,9 +792,9 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
|||
// skew FOF walls
|
||||
if (ffloortextureslide)
|
||||
{
|
||||
if (oldx != -1)
|
||||
dc_texturemid += FixedMul(ffloortextureslide, thicksidecol[oldx]-thicksidecol[dc_x]);
|
||||
oldx = dc_x;
|
||||
if (oldtexturecolumn != -1)
|
||||
dc_texturemid += FixedMul(ffloortextureslide, oldtexturecolumn-ds->thicksidecol[dc_x]);
|
||||
oldtexturecolumn = ds->thicksidecol[dc_x];
|
||||
}
|
||||
|
||||
// Calculate bounds
|
||||
|
@ -814,7 +831,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
|||
dc_iscale = FixedMul(0xffffffffu / (unsigned)spryscale, wall_scaley);
|
||||
|
||||
// Get data for the column
|
||||
col = R_GetColumn(texnum, (thicksidecol[dc_x] >> FRACBITS));
|
||||
col = R_GetColumn(texnum, ((thicksidecol[dc_x] + wall_offsetx) >> FRACBITS));
|
||||
|
||||
// SoM: New code does not rely on R_DrawColumnShadowed_8 which
|
||||
// will (hopefully) put less strain on the stack.
|
||||
|
@ -988,26 +1005,77 @@ static boolean R_FFloorCanClip(visffloor_t *pfloor)
|
|||
#define HEIGHTBITS 12
|
||||
#define HEIGHTUNIT (1<<HEIGHTBITS)
|
||||
|
||||
static boolean didsolidcol; // True if at least one column was marked solid
|
||||
static void R_DrawRegularWall(UINT8 *source, INT32 height)
|
||||
{
|
||||
dc_source = source;
|
||||
dc_texheight = height;
|
||||
colfunc();
|
||||
}
|
||||
|
||||
static void R_DrawFlippedWall(UINT8 *source, INT32 height)
|
||||
{
|
||||
dc_texheight = height;
|
||||
R_DrawFlippedPost(source, (unsigned)height, colfunc);
|
||||
}
|
||||
|
||||
static void R_DrawNoWall(UINT8 *source, INT32 height)
|
||||
{
|
||||
(void)source;
|
||||
(void)height;
|
||||
}
|
||||
|
||||
static void R_RenderSegLoop (void)
|
||||
{
|
||||
angle_t angle;
|
||||
fixed_t textureoffset;
|
||||
size_t pindex;
|
||||
INT32 yl;
|
||||
INT32 yh;
|
||||
size_t pindex;
|
||||
INT32 yl;
|
||||
INT32 yh;
|
||||
|
||||
INT32 mid;
|
||||
INT32 mid;
|
||||
fixed_t texturecolumn = 0;
|
||||
fixed_t toptexturecolumn = 0;
|
||||
fixed_t bottomtexturecolumn = 0;
|
||||
fixed_t oldtexturecolumn = -1;
|
||||
fixed_t oldtexturecolumn_top = -1;
|
||||
fixed_t oldtexturecolumn_bottom = -1;
|
||||
INT32 top;
|
||||
INT32 bottom;
|
||||
INT32 i;
|
||||
INT32 top;
|
||||
INT32 bottom;
|
||||
INT32 i;
|
||||
|
||||
fixed_t topscaley = rw_toptexturescaley;
|
||||
fixed_t midscaley = rw_midtexturescaley;
|
||||
fixed_t bottomscaley = rw_bottomtexturescaley;
|
||||
|
||||
void (*drawtop)(UINT8 *, INT32) = R_DrawRegularWall;
|
||||
void (*drawmiddle)(UINT8 *, INT32) = R_DrawRegularWall;
|
||||
void (*drawbottom)(UINT8 *, INT32) = R_DrawRegularWall;
|
||||
|
||||
if (dc_numlights)
|
||||
colfunc = colfuncs[COLDRAWFUNC_SHADOWED];
|
||||
|
||||
if (toptexture && topscaley < 0)
|
||||
{
|
||||
topscaley = -topscaley;
|
||||
drawtop = R_DrawFlippedWall;
|
||||
}
|
||||
if (midtexture && midscaley < 0)
|
||||
{
|
||||
midscaley = -midscaley;
|
||||
drawmiddle = R_DrawFlippedWall;
|
||||
}
|
||||
if (bottomtexture && bottomscaley < 0)
|
||||
{
|
||||
bottomscaley = -bottomscaley;
|
||||
drawbottom = R_DrawFlippedWall;
|
||||
}
|
||||
|
||||
if (!r_renderwalls)
|
||||
{
|
||||
drawtop = R_DrawNoWall;
|
||||
drawmiddle = R_DrawNoWall;
|
||||
drawbottom = R_DrawNoWall;
|
||||
}
|
||||
|
||||
if (midtexture)
|
||||
R_CheckTextureCache(midtexture);
|
||||
|
@ -1242,33 +1310,14 @@ static void R_RenderSegLoop (void)
|
|||
// single sided line
|
||||
if (yl <= yh && yh >= 0 && yl < viewheight)
|
||||
{
|
||||
if (cv_renderwalls.value)
|
||||
{
|
||||
fixed_t offset = texturecolumn + rw_offsetx;
|
||||
|
||||
dc_yl = yl;
|
||||
dc_yh = yh;
|
||||
dc_texturemid = rw_midtexturemid;
|
||||
dc_iscale = FixedMul(0xffffffffu / (unsigned)rw_scale, rw_midtexturescaley);
|
||||
dc_source = R_GetColumn(midtexture, offset >> FRACBITS)->pixels;
|
||||
dc_texheight = textureheight[midtexture]>>FRACBITS;
|
||||
|
||||
//profile stuff ---------------------------------------------------------
|
||||
#ifdef TIMING
|
||||
ProfZeroTimer();
|
||||
#endif
|
||||
colfunc();
|
||||
#ifdef TIMING
|
||||
RDMSR(0x10,&mycount);
|
||||
mytotal += mycount; //64bit add
|
||||
|
||||
if (nombre--==0)
|
||||
I_Error("R_DrawColumn CPU Spy reports: 0x%d %d\n", *((INT32 *)&mytotal+1),
|
||||
(INT32)mytotal);
|
||||
#endif
|
||||
//profile stuff ---------------------------------------------------------
|
||||
}
|
||||
fixed_t offset = texturecolumn + rw_offsetx;
|
||||
|
||||
dc_yl = yl;
|
||||
dc_yh = yh;
|
||||
dc_texturemid = rw_midtexturemid;
|
||||
dc_texheight = textureheight[midtexture]>>FRACBITS;
|
||||
dc_iscale = FixedMul(0xffffffffu / (unsigned)rw_scale, midscaley);
|
||||
drawmiddle(R_GetColumn(midtexture, offset >> FRACBITS)->pixels, dc_texheight);
|
||||
|
||||
// dont draw anything more for this column, since
|
||||
// a midtexture blocks the view
|
||||
|
@ -1312,21 +1361,17 @@ static void R_RenderSegLoop (void)
|
|||
}
|
||||
else if (mid >= 0) // safe to draw top texture
|
||||
{
|
||||
if (cv_renderwalls.value)
|
||||
{
|
||||
fixed_t offset = rw_offset_top;
|
||||
if (rw_toptexturescalex < 0)
|
||||
offset = -offset;
|
||||
offset = toptexturecolumn + offset;
|
||||
fixed_t offset = rw_offset_top;
|
||||
if (rw_toptexturescalex < 0)
|
||||
offset = -offset;
|
||||
offset = toptexturecolumn + offset;
|
||||
|
||||
dc_yl = yl;
|
||||
dc_yh = mid;
|
||||
dc_texturemid = rw_toptexturemid;
|
||||
dc_iscale = FixedMul(0xffffffffu / (unsigned)rw_scale, rw_toptexturescaley);
|
||||
dc_source = R_GetColumn(toptexture, offset >> FRACBITS)->pixels;
|
||||
dc_texheight = textureheight[toptexture]>>FRACBITS;
|
||||
colfunc();
|
||||
}
|
||||
dc_yl = yl;
|
||||
dc_yh = mid;
|
||||
dc_texturemid = rw_toptexturemid;
|
||||
dc_texheight = textureheight[toptexture]>>FRACBITS;
|
||||
dc_iscale = FixedMul(0xffffffffu / (unsigned)rw_scale, topscaley);
|
||||
drawtop(R_GetColumn(toptexture, offset >> FRACBITS)->pixels, dc_texheight);
|
||||
ceilingclip[rw_x] = (INT16)mid;
|
||||
}
|
||||
else if (!rw_ceilingmarked) // entirely off top of screen
|
||||
|
@ -1336,8 +1381,8 @@ static void R_RenderSegLoop (void)
|
|||
ceilingclip[rw_x] = topclip;
|
||||
|
||||
if (oldtexturecolumn_top != -1)
|
||||
rw_toptexturemid += FixedMul(rw_toptextureslide, oldtexturecolumn_top-toptexturecolumn);
|
||||
oldtexturecolumn_top = toptexturecolumn;
|
||||
rw_toptexturemid += FixedMul(rw_toptextureslide, oldtexturecolumn_top-textureoffset);
|
||||
oldtexturecolumn_top = textureoffset;
|
||||
}
|
||||
else if (markceiling && (!rw_ceilingmarked)) // no top wall
|
||||
ceilingclip[rw_x] = topclip;
|
||||
|
@ -1363,21 +1408,17 @@ static void R_RenderSegLoop (void)
|
|||
}
|
||||
else if (mid < viewheight) // safe to draw bottom texture
|
||||
{
|
||||
if (cv_renderwalls.value)
|
||||
{
|
||||
fixed_t offset = rw_offset_bottom;
|
||||
if (rw_bottomtexturescalex < 0)
|
||||
offset = -offset;
|
||||
offset = bottomtexturecolumn + offset;
|
||||
fixed_t offset = rw_offset_bottom;
|
||||
if (rw_bottomtexturescalex < 0)
|
||||
offset = -offset;
|
||||
offset = bottomtexturecolumn + offset;
|
||||
|
||||
dc_yl = mid;
|
||||
dc_yh = yh;
|
||||
dc_texturemid = rw_bottomtexturemid;
|
||||
dc_iscale = FixedMul(0xffffffffu / (unsigned)rw_scale, rw_bottomtexturescaley);
|
||||
dc_source = R_GetColumn(bottomtexture, offset >> FRACBITS)->pixels;
|
||||
dc_texheight = textureheight[bottomtexture]>>FRACBITS;
|
||||
colfunc();
|
||||
}
|
||||
dc_yl = mid;
|
||||
dc_yh = yh;
|
||||
dc_texturemid = rw_bottomtexturemid;
|
||||
dc_texheight = textureheight[bottomtexture]>>FRACBITS;
|
||||
dc_iscale = FixedMul(0xffffffffu / (unsigned)rw_scale, bottomscaley);
|
||||
drawbottom(R_GetColumn(bottomtexture, offset >> FRACBITS)->pixels, dc_texheight);
|
||||
floorclip[rw_x] = (INT16)mid;
|
||||
}
|
||||
else if (!rw_floormarked) // entirely off bottom of screen
|
||||
|
@ -1387,8 +1428,8 @@ static void R_RenderSegLoop (void)
|
|||
floorclip[rw_x] = bottomclip;
|
||||
|
||||
if (oldtexturecolumn_bottom != -1)
|
||||
rw_bottomtexturemid += FixedMul(rw_bottomtextureslide, oldtexturecolumn_bottom-bottomtexturecolumn);
|
||||
oldtexturecolumn_bottom = bottomtexturecolumn;
|
||||
rw_bottomtexturemid += FixedMul(rw_bottomtextureslide, oldtexturecolumn_bottom-textureoffset);
|
||||
oldtexturecolumn_bottom = textureoffset;
|
||||
}
|
||||
else if (markfloor && (!rw_floormarked)) // no bottom wall
|
||||
floorclip[rw_x] = bottomclip;
|
||||
|
@ -1418,11 +1459,14 @@ static void R_RenderSegLoop (void)
|
|||
{
|
||||
if (oldtexturecolumn != -1)
|
||||
{
|
||||
rw_midtexturemid += FixedMul(rw_midtextureslide, oldtexturecolumn-texturecolumn);
|
||||
rw_midtextureback += FixedMul(rw_midtexturebackslide, oldtexturecolumn-texturecolumn);
|
||||
INT32 diff = oldtexturecolumn-textureoffset;
|
||||
if (rw_invmidtexturescalex < 0)
|
||||
diff = -diff;
|
||||
rw_midtexturemid += FixedMul(rw_midtextureslide, diff);
|
||||
rw_midtextureback += FixedMul(rw_midtexturebackslide, diff);
|
||||
}
|
||||
|
||||
oldtexturecolumn = texturecolumn;
|
||||
oldtexturecolumn = textureoffset;
|
||||
}
|
||||
|
||||
if (invscale)
|
||||
|
@ -1545,7 +1589,7 @@ static void R_AllocClippingTables(size_t range)
|
|||
static void R_AllocTextureColumnTables(size_t range)
|
||||
{
|
||||
size_t pos = curtexturecolumntable - texturecolumntable;
|
||||
size_t need = range * 3;
|
||||
size_t need = range * 4;
|
||||
|
||||
if (pos + need < texturecolumntablesize)
|
||||
return;
|
||||
|
@ -1566,15 +1610,48 @@ static void R_AllocTextureColumnTables(size_t range)
|
|||
for (drawseg_t *ds = drawsegs; ds < ds_p; ds++)
|
||||
{
|
||||
// Check if it's in range of the tables
|
||||
if (ds->maskedtexturecol + ds->x1 >= oldtable && ds->maskedtexturecol + ds->x1 <= oldlast)
|
||||
ds->maskedtexturecol = (ds->maskedtexturecol - oldtable) + texturecolumntable;
|
||||
if (ds->thicksidecol + ds->x1 >= oldtable && ds->thicksidecol + ds->x1 <= oldlast)
|
||||
ds->thicksidecol = (ds->thicksidecol - oldtable) + texturecolumntable;
|
||||
if (ds->invscale + ds->x1 >= oldtable && ds->invscale + ds->x1 <= oldlast)
|
||||
ds->invscale = (ds->invscale - oldtable) + texturecolumntable;
|
||||
#define CHECK(which) \
|
||||
if (which + ds->x1 >= oldtable && which + ds->x1 <= oldlast) \
|
||||
which = (which - oldtable) + texturecolumntable
|
||||
|
||||
CHECK(ds->maskedtexturecol);
|
||||
CHECK(ds->maskedtextureheight);
|
||||
CHECK(ds->thicksidecol);
|
||||
CHECK(ds->invscale);
|
||||
|
||||
#undef CHECK
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// R_ScaleFromGlobalAngle
|
||||
// Returns the texture mapping scale for the current line (horizontal span)
|
||||
// at the given angle.
|
||||
// rw_distance must be calculated first.
|
||||
//
|
||||
// killough 5/2/98: reformatted, cleaned up
|
||||
//
|
||||
// note: THIS IS USED ONLY FOR WALLS!
|
||||
static fixed_t R_ScaleFromGlobalAngle(angle_t visangle)
|
||||
{
|
||||
angle_t anglea = ANGLE_90 + (visangle-viewangle);
|
||||
angle_t angleb = ANGLE_90 + (visangle-rw_normalangle);
|
||||
fixed_t den = FixedMul(rw_distance, FINESINE(anglea>>ANGLETOFINESHIFT));
|
||||
// proff 11/06/98: Changed for high-res
|
||||
fixed_t num = FixedMul(projectiony, FINESINE(angleb>>ANGLETOFINESHIFT));
|
||||
|
||||
if (den > num>>16)
|
||||
{
|
||||
num = FixedDiv(num, den);
|
||||
if (num > 64*FRACUNIT)
|
||||
return 64*FRACUNIT;
|
||||
if (num < 256)
|
||||
return 256;
|
||||
return num;
|
||||
}
|
||||
return 64*FRACUNIT;
|
||||
}
|
||||
|
||||
//
|
||||
// R_StoreWallRange
|
||||
// A wall segment will be drawn
|
||||
|
@ -1746,11 +1823,14 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||
|
||||
midtexture = toptexture = bottomtexture = maskedtexture = 0;
|
||||
ds_p->maskedtexturecol = NULL;
|
||||
ds_p->maskedtextureheight = NULL;
|
||||
ds_p->numthicksides = numthicksides = 0;
|
||||
ds_p->thicksidecol = NULL;
|
||||
ds_p->invscale = NULL;
|
||||
ds_p->tsilheight = 0;
|
||||
|
||||
texcoltables = false;
|
||||
|
||||
numbackffloors = 0;
|
||||
|
||||
for (i = 0; i < MAXFFLOORS; i++)
|
||||
|
@ -1776,16 +1856,19 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||
angle_t lineangle = R_PointToAngle2(curline->v1->x, curline->v1->y, curline->v2->x, curline->v2->y);
|
||||
|
||||
if (frontsector->f_slope)
|
||||
floorfrontslide = FixedMul(frontsector->f_slope->zdelta, FINECOSINE((lineangle-frontsector->f_slope->xydirection)>>ANGLETOFINESHIFT));
|
||||
floorfrontslide = R_GetSlopeTextureSlide(frontsector->f_slope, lineangle);
|
||||
|
||||
if (frontsector->c_slope)
|
||||
ceilingfrontslide = FixedMul(frontsector->c_slope->zdelta, FINECOSINE((lineangle-frontsector->c_slope->xydirection)>>ANGLETOFINESHIFT));
|
||||
ceilingfrontslide = R_GetSlopeTextureSlide(frontsector->c_slope, lineangle);
|
||||
|
||||
if (backsector && backsector->f_slope)
|
||||
floorbackslide = FixedMul(backsector->f_slope->zdelta, FINECOSINE((lineangle-backsector->f_slope->xydirection)>>ANGLETOFINESHIFT));
|
||||
if (backsector)
|
||||
{
|
||||
if (backsector->f_slope)
|
||||
floorbackslide = R_GetSlopeTextureSlide(backsector->f_slope, lineangle);
|
||||
|
||||
if (backsector && backsector->c_slope)
|
||||
ceilingbackslide = FixedMul(backsector->c_slope->zdelta, FINECOSINE((lineangle-backsector->c_slope->xydirection)>>ANGLETOFINESHIFT));
|
||||
if (backsector->c_slope)
|
||||
ceilingbackslide = R_GetSlopeTextureSlide(backsector->c_slope, lineangle);
|
||||
}
|
||||
}
|
||||
|
||||
rw_midtexturescalex = sidedef->scalex_mid;
|
||||
|
@ -1801,26 +1884,27 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||
|
||||
fixed_t rowoffset = sidedef->rowoffset + sidedef->offsety_mid;
|
||||
fixed_t texheight = textureheight[midtexture];
|
||||
fixed_t scaley = abs(rw_midtexturescaley);
|
||||
|
||||
if (rw_midtexturescaley > 0)
|
||||
{
|
||||
if (linedef->flags & ML_NOSKEW)
|
||||
{
|
||||
if (linedef->flags & ML_DONTPEGBOTTOM)
|
||||
rw_midtexturemid = FixedMul(frontsector->floorheight - viewz, rw_midtexturescaley) + texheight;
|
||||
rw_midtexturemid = FixedMul(frontsector->floorheight - viewz, scaley) + texheight;
|
||||
else
|
||||
rw_midtexturemid = FixedMul(frontsector->ceilingheight - viewz, rw_midtexturescaley);
|
||||
rw_midtexturemid = FixedMul(frontsector->ceilingheight - viewz, scaley);
|
||||
}
|
||||
else if (linedef->flags & ML_DONTPEGBOTTOM)
|
||||
{
|
||||
rw_midtexturemid = FixedMul(worldbottom, rw_midtexturescaley) + texheight;
|
||||
rw_midtextureslide = floorfrontslide;
|
||||
rw_midtexturemid = FixedMul(worldbottom, scaley) + texheight;
|
||||
rw_midtextureslide = FixedMul(floorfrontslide, scaley);
|
||||
}
|
||||
else
|
||||
{
|
||||
// top of texture at top
|
||||
rw_midtexturemid = FixedMul(worldtop, rw_midtexturescaley);
|
||||
rw_midtextureslide = ceilingfrontslide;
|
||||
rw_midtexturemid = FixedMul(worldtop, scaley);
|
||||
rw_midtextureslide = FixedMul(ceilingfrontslide, scaley);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1831,20 +1915,20 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||
if (linedef->flags & ML_NOSKEW)
|
||||
{
|
||||
if (linedef->flags & ML_DONTPEGBOTTOM)
|
||||
rw_midtexturemid = FixedMul(frontsector->floorheight - viewz, rw_midtexturescaley);
|
||||
rw_midtexturemid = FixedMul(frontsector->floorheight - viewz, scaley);
|
||||
else
|
||||
rw_midtexturemid = FixedMul(frontsector->ceilingheight - viewz, rw_midtexturescaley) + texheight;
|
||||
rw_midtexturemid = FixedMul(frontsector->ceilingheight - viewz, scaley) + texheight;
|
||||
}
|
||||
else if (linedef->flags & ML_DONTPEGBOTTOM)
|
||||
{
|
||||
rw_midtexturemid = FixedMul(worldbottom, rw_midtexturescaley);
|
||||
rw_midtextureslide = floorfrontslide;
|
||||
rw_midtexturemid = FixedMul(worldbottom, scaley);
|
||||
rw_midtextureslide = FixedMul(floorfrontslide, scaley);
|
||||
}
|
||||
else
|
||||
{
|
||||
// top of texture at top
|
||||
rw_midtexturemid = FixedMul(worldtop, rw_midtexturescaley) + texheight;
|
||||
rw_midtextureslide = ceilingfrontslide;
|
||||
rw_midtexturemid = FixedMul(worldtop, scaley) + texheight;
|
||||
rw_midtextureslide = FixedMul(ceilingfrontslide, scaley);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2053,15 +2137,16 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||
{
|
||||
// top of texture at top
|
||||
rw_toptexturemid = worldtop;
|
||||
rw_toptextureslide = ceilingfrontslide;
|
||||
rw_toptextureslide = FixedMul(ceilingfrontslide, abs(rw_toptexturescaley));
|
||||
}
|
||||
else
|
||||
{
|
||||
rw_toptexturemid = worldhigh + texheight;
|
||||
rw_toptextureslide = ceilingbackslide;
|
||||
rw_toptextureslide = FixedMul(ceilingbackslide, abs(rw_toptexturescaley));
|
||||
}
|
||||
|
||||
rw_toptexturemid = FixedMul(rw_toptexturemid, rw_toptexturescaley);
|
||||
rw_toptexturemid = FixedMul(rw_toptexturemid, abs(rw_toptexturescaley));
|
||||
rw_toptexturemid += toprowoffset;
|
||||
}
|
||||
|
||||
// check BOTTOM TEXTURE
|
||||
|
@ -2092,24 +2177,24 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||
// bottom of texture at bottom
|
||||
// top of texture at top
|
||||
rw_bottomtexturemid = worldbottom;
|
||||
rw_bottomtextureslide = floorfrontslide;
|
||||
rw_bottomtextureslide = FixedMul(floorfrontslide, abs(rw_bottomtexturescaley));
|
||||
}
|
||||
else
|
||||
{
|
||||
// top of texture at top
|
||||
rw_bottomtexturemid = worldlow;
|
||||
rw_bottomtextureslide = floorbackslide;
|
||||
rw_bottomtextureslide = FixedMul(floorbackslide, abs(rw_bottomtexturescaley));
|
||||
}
|
||||
|
||||
rw_bottomtexturemid = FixedMul(rw_bottomtexturemid, rw_bottomtexturescaley);
|
||||
rw_bottomtexturemid = FixedMul(rw_bottomtexturemid, abs(rw_bottomtexturescaley));
|
||||
rw_bottomtexturemid += botrowoffset;
|
||||
}
|
||||
|
||||
rw_toptexturemid += toprowoffset;
|
||||
rw_bottomtexturemid += botrowoffset;
|
||||
|
||||
// allocate space for masked texture tables
|
||||
R_AllocTextureColumnTables(rw_stopx - start);
|
||||
|
||||
texcoltables = true;
|
||||
|
||||
if (frontsector && backsector && !Tag_Compare(&frontsector->tags, &backsector->tags) && (backsector->ffloors || frontsector->ffloors))
|
||||
{
|
||||
ffloor_t *rover;
|
||||
|
@ -2308,7 +2393,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||
ds_p->maskedtexturecol = maskedtexturecol = curtexturecolumntable - rw_x;
|
||||
curtexturecolumntable += rw_stopx - rw_x;
|
||||
|
||||
maskedtextureheight = ds_p->maskedtextureheight; // note to red, this == &(ds_p->maskedtextureheight[0])
|
||||
ds_p->maskedtextureheight = maskedtextureheight = curtexturecolumntable - rw_x;
|
||||
curtexturecolumntable += rw_stopx - rw_x;
|
||||
|
||||
maskedtexture = true;
|
||||
|
||||
|
@ -2350,13 +2436,14 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||
}
|
||||
}
|
||||
|
||||
rw_midtexturemid = FixedMul(rw_midtexturemid, rw_midtexturescaley);
|
||||
rw_midtextureback = FixedMul(rw_midtextureback, rw_midtexturescaley);
|
||||
rw_midtexturemid = FixedMul(rw_midtexturemid, abs(rw_midtexturescaley));
|
||||
rw_midtextureback = FixedMul(rw_midtextureback, abs(rw_midtexturescaley));
|
||||
|
||||
rw_midtextureslide = FixedMul(rw_midtextureslide, abs(rw_midtexturescaley));
|
||||
rw_midtexturebackslide = FixedMul(rw_midtexturebackslide, abs(rw_midtexturescaley));
|
||||
|
||||
rw_midtexturemid += sidedef->rowoffset + sidedef->offsety_mid;
|
||||
rw_midtextureback += sidedef->rowoffset + sidedef->offsety_mid;
|
||||
|
||||
maskedtexture = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
140
src/r_skins.c
140
src/r_skins.c
|
@ -35,30 +35,87 @@
|
|||
INT32 numskins = 0;
|
||||
skin_t **skins = NULL;
|
||||
|
||||
//
|
||||
// P_GetSkinSprite2
|
||||
// For non-super players, tries each sprite2's immediate predecessor until it finds one with a number of frames or ends up at standing.
|
||||
// For super players, does the same as above - but tries the super equivalent for each sprite2 before the non-super version.
|
||||
//
|
||||
|
||||
UINT8 P_GetSkinSprite2(skin_t *skin, UINT8 spr2, player_t *player)
|
||||
// Gets the animation ID of a state
|
||||
UINT16 P_GetStateSprite2(state_t *state)
|
||||
{
|
||||
UINT8 super = 0, i = 0;
|
||||
if (state->sprite2)
|
||||
return state->sprite2;
|
||||
else
|
||||
{
|
||||
// Transform the state frame into an animation ID
|
||||
UINT32 stateframe = state->frame & FF_FRAMEMASK;
|
||||
UINT16 spr2 = stateframe & ~FF_SPR2SUPER;
|
||||
|
||||
if (stateframe & FF_SPR2SUPER)
|
||||
spr2 |= SPR2F_SUPER;
|
||||
|
||||
return spr2;
|
||||
}
|
||||
}
|
||||
|
||||
// Gets the starting frame of an animation
|
||||
UINT16 P_GetSprite2StateFrame(state_t *state)
|
||||
{
|
||||
if (state->sprite2)
|
||||
return state->frame & FF_FRAMEMASK;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Checks if a state should use the "super" variant of the animation
|
||||
boolean P_IsStateSprite2Super(state_t *state)
|
||||
{
|
||||
if (state->sprite2)
|
||||
{
|
||||
if (state->sprite2 & SPR2F_SUPER)
|
||||
return true;
|
||||
}
|
||||
else if (state->frame & FF_SPR2SUPER)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Applies SPR2F_SUPER to an animation based on the actor's state
|
||||
UINT16 P_ApplySuperFlagToSprite2(UINT16 spr2, mobj_t *mobj)
|
||||
{
|
||||
if (mobj->player)
|
||||
{
|
||||
if (mobj->player->charflags & SF_NOSUPERSPRITES || (mobj->player->powers[pw_carry] == CR_NIGHTSMODE && (mobj->player->charflags & SF_NONIGHTSSUPER)))
|
||||
spr2 &= ~SPR2F_SUPER;
|
||||
else if (mobj->player->powers[pw_super] || (mobj->player->powers[pw_carry] == CR_NIGHTSMODE && (mobj->player->charflags & SF_SUPER)))
|
||||
spr2 |= SPR2F_SUPER;
|
||||
}
|
||||
|
||||
if (spr2 & SPR2F_SUPER)
|
||||
{
|
||||
if (mobj->eflags & MFE_FORCENOSUPER)
|
||||
spr2 &= ~SPR2F_SUPER;
|
||||
}
|
||||
else if (mobj->eflags & MFE_FORCESUPER)
|
||||
spr2 |= SPR2F_SUPER;
|
||||
|
||||
return spr2;
|
||||
}
|
||||
|
||||
// For non-super players, this tries each sprite2's immediate predecessor until it finds one with a number of frames or ends up at standing.
|
||||
// For super players, does the same as above - but tries the super equivalent for each sprite2 before the non-super version.
|
||||
UINT16 P_GetSkinSprite2(skin_t *skin, UINT16 spr2, player_t *player)
|
||||
{
|
||||
UINT16 super = 0;
|
||||
UINT8 i = 0;
|
||||
|
||||
if (!skin)
|
||||
return 0;
|
||||
|
||||
if ((playersprite_t)(spr2 & ~FF_SPR2SUPER) >= free_spr2)
|
||||
return 0;
|
||||
|
||||
while (!skin->sprites[spr2].numframes
|
||||
while (!P_IsValidSprite2(skin, spr2)
|
||||
&& spr2 != SPR2_STND
|
||||
&& ++i < 32) // recursion limiter
|
||||
{
|
||||
if (spr2 & FF_SPR2SUPER)
|
||||
if (spr2 & SPR2F_SUPER)
|
||||
{
|
||||
super = FF_SPR2SUPER;
|
||||
spr2 &= ~FF_SPR2SUPER;
|
||||
super = SPR2F_SUPER;
|
||||
spr2 &= ~SPR2F_SUPER;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -92,6 +149,51 @@ UINT8 P_GetSkinSprite2(skin_t *skin, UINT8 spr2, player_t *player)
|
|||
return spr2;
|
||||
}
|
||||
|
||||
// Gets the spritedef of a skin animation
|
||||
spritedef_t *P_GetSkinSpritedef(skin_t *skin, UINT16 spr2)
|
||||
{
|
||||
if (!skin)
|
||||
return NULL;
|
||||
|
||||
boolean is_super = spr2 & SPR2F_SUPER;
|
||||
|
||||
spr2 &= SPR2F_MASK;
|
||||
|
||||
if (spr2 >= free_spr2)
|
||||
return NULL;
|
||||
|
||||
if (is_super)
|
||||
return &skin->super.sprites[spr2];
|
||||
else
|
||||
return &skin->sprites[spr2];
|
||||
}
|
||||
|
||||
// Gets the spriteinfo of a skin animation
|
||||
spriteinfo_t *P_GetSkinSpriteInfo(skin_t *skin, UINT16 spr2)
|
||||
{
|
||||
if (!skin)
|
||||
return NULL;
|
||||
|
||||
boolean is_super = spr2 & SPR2F_SUPER;
|
||||
|
||||
spr2 &= SPR2F_MASK;
|
||||
|
||||
if (spr2 >= free_spr2)
|
||||
return NULL;
|
||||
|
||||
if (is_super)
|
||||
return &skin->super.sprinfo[spr2];
|
||||
else
|
||||
return &skin->sprinfo[spr2];
|
||||
}
|
||||
|
||||
// Checks if a skin animation is valid
|
||||
boolean P_IsValidSprite2(skin_t *skin, UINT16 spr2)
|
||||
{
|
||||
spritedef_t *sprdef = P_GetSkinSpritedef(skin, spr2);
|
||||
return sprdef && sprdef->numframes;
|
||||
}
|
||||
|
||||
static void Sk_SetDefaultValue(skin_t *skin)
|
||||
{
|
||||
INT32 i;
|
||||
|
@ -376,7 +478,7 @@ static void SetSkin(player_t *player, INT32 skinnum)
|
|||
player->mo->skin = skin;
|
||||
if (newcolor)
|
||||
player->mo->color = newcolor;
|
||||
P_SetScale(player->mo, player->mo->scale);
|
||||
P_SetScale(player->mo, player->mo->scale, false);
|
||||
player->mo->radius = radius;
|
||||
|
||||
P_SetMobjState(player->mo, player->mo->state-states); // Prevent visual errors when switching between skins with differing number of frames
|
||||
|
@ -500,10 +602,10 @@ static UINT16 W_CheckForPatchSkinMarkerInPwad(UINT16 wadid, UINT16 startlump)
|
|||
return INT16_MAX; // not found
|
||||
}
|
||||
|
||||
static void R_LoadSkinSprites(UINT16 wadnum, UINT16 *lump, UINT16 *lastlump, skin_t *skin, UINT8 start_spr2)
|
||||
static void R_LoadSkinSprites(UINT16 wadnum, UINT16 *lump, UINT16 *lastlump, skin_t *skin, UINT16 start_spr2)
|
||||
{
|
||||
UINT16 newlastlump;
|
||||
UINT8 sprite2;
|
||||
UINT16 sprite2;
|
||||
|
||||
*lump += 1; // start after S_SKIN
|
||||
*lastlump = W_CheckNumForNamePwad("S_END",wadnum,*lump); // stop at S_END
|
||||
|
@ -523,7 +625,7 @@ static void R_LoadSkinSprites(UINT16 wadnum, UINT16 *lump, UINT16 *lastlump, ski
|
|||
newlastlump++;
|
||||
// load all sprite sets we are aware of... for super!
|
||||
for (sprite2 = start_spr2; sprite2 < free_spr2; sprite2++)
|
||||
R_AddSingleSpriteDef(spr2names[sprite2], &skin->sprites[FF_SPR2SUPER|sprite2], wadnum, newlastlump, *lastlump);
|
||||
R_AddSingleSpriteDef(spr2names[sprite2], &skin->super.sprites[sprite2], wadnum, newlastlump, *lastlump);
|
||||
|
||||
newlastlump--;
|
||||
*lastlump = newlastlump; // okay, make the normal sprite set loading end there
|
||||
|
|
|
@ -80,9 +80,14 @@ typedef struct
|
|||
// specific sounds per skin
|
||||
sfxenum_t soundsid[NUMSKINSOUNDS]; // sound # in S_sfx table
|
||||
|
||||
spritedef_t sprites[NUMPLAYERSPRITES];
|
||||
spriteinfo_t sprinfo[NUMPLAYERSPRITES];
|
||||
|
||||
// contains super versions too
|
||||
spritedef_t sprites[NUMPLAYERSPRITES*2];
|
||||
spriteinfo_t sprinfo[NUMPLAYERSPRITES*2];
|
||||
struct {
|
||||
spritedef_t sprites[NUMPLAYERSPRITES];
|
||||
spriteinfo_t sprinfo[NUMPLAYERSPRITES];
|
||||
} super;
|
||||
} skin_t;
|
||||
|
||||
/// Externs
|
||||
|
@ -102,7 +107,14 @@ INT32 R_GetForcedSkin(INT32 playernum);
|
|||
void R_AddSkins(UINT16 wadnum, boolean mainfile);
|
||||
void R_PatchSkins(UINT16 wadnum, boolean mainfile);
|
||||
|
||||
UINT8 P_GetSkinSprite2(skin_t *skin, UINT8 spr2, player_t *player);
|
||||
UINT16 P_GetStateSprite2(state_t *state);
|
||||
UINT16 P_GetSprite2StateFrame(state_t *state);
|
||||
UINT16 P_GetSkinSprite2(skin_t *skin, UINT16 spr2, player_t *player);
|
||||
UINT16 P_ApplySuperFlagToSprite2(UINT16 spr2, mobj_t *mobj);
|
||||
spritedef_t *P_GetSkinSpritedef(skin_t *skin, UINT16 spr2);
|
||||
spriteinfo_t *P_GetSkinSpriteInfo(skin_t *skin, UINT16 spr2);
|
||||
boolean P_IsValidSprite2(skin_t *skin, UINT16 spr2);
|
||||
boolean P_IsStateSprite2Super(state_t *state);
|
||||
|
||||
void R_RefreshSprite2(void);
|
||||
|
||||
|
|
|
@ -687,12 +687,31 @@ void R_DrawMaskedColumn(column_t *column, unsigned lengthcol)
|
|||
static UINT8 *flippedcol = NULL;
|
||||
static size_t flippedcolsize = 0;
|
||||
|
||||
void R_DrawFlippedPost(UINT8 *source, unsigned length, void (*drawcolfunc)(void))
|
||||
{
|
||||
if (!length)
|
||||
return;
|
||||
|
||||
if (!flippedcolsize || length > flippedcolsize)
|
||||
{
|
||||
flippedcolsize = length;
|
||||
flippedcol = Z_Realloc(flippedcol, length, PU_STATIC, NULL);
|
||||
}
|
||||
|
||||
dc_source = flippedcol;
|
||||
|
||||
for (UINT8 *s = (UINT8 *)source, *d = flippedcol+length-1; d >= flippedcol; s++)
|
||||
*d-- = *s;
|
||||
|
||||
drawcolfunc();
|
||||
}
|
||||
|
||||
void R_DrawFlippedMaskedColumn(column_t *column, unsigned lengthcol)
|
||||
{
|
||||
INT32 topscreen;
|
||||
INT32 bottomscreen;
|
||||
fixed_t basetexturemid = dc_texturemid;
|
||||
UINT8 *d,*s;
|
||||
INT32 topdelta;
|
||||
|
||||
for (unsigned i = 0; i < column->num_posts; i++)
|
||||
{
|
||||
|
@ -700,7 +719,7 @@ void R_DrawFlippedMaskedColumn(column_t *column, unsigned lengthcol)
|
|||
if (!post->length)
|
||||
continue;
|
||||
|
||||
INT32 topdelta = lengthcol-post->length-post->topdelta;
|
||||
topdelta = lengthcol-post->length-post->topdelta;
|
||||
topscreen = sprtopscreen + spryscale*topdelta;
|
||||
bottomscreen = sprbotscreen == INT32_MAX ? topscreen + spryscale*post->length
|
||||
: sprbotscreen + spryscale*post->length;
|
||||
|
@ -727,21 +746,9 @@ void R_DrawFlippedMaskedColumn(column_t *column, unsigned lengthcol)
|
|||
|
||||
if (dc_yl <= dc_yh && dc_yh > 0)
|
||||
{
|
||||
if (post->length > flippedcolsize)
|
||||
{
|
||||
flippedcolsize = post->length;
|
||||
flippedcol = Z_Realloc(flippedcol, flippedcolsize, PU_STATIC, NULL);
|
||||
}
|
||||
|
||||
for (s = column->pixels+post->data_offset+post->length, d = flippedcol; d < flippedcol+post->length; --s)
|
||||
*d++ = *s;
|
||||
dc_source = flippedcol;
|
||||
dc_texturemid = basetexturemid - (topdelta<<FRACBITS);
|
||||
|
||||
// Still drawn by R_DrawColumn.
|
||||
colfunc();
|
||||
|
||||
Z_Free(dc_source);
|
||||
R_DrawFlippedPost(column->pixels + post->data_offset, post->length, colfunc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1564,7 +1571,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
// uncapped/interpolation
|
||||
interpmobjstate_t interp = {0};
|
||||
|
||||
if (!cv_renderthings.value)
|
||||
if (!r_renderthings)
|
||||
return;
|
||||
|
||||
// do interpolation
|
||||
|
@ -1606,20 +1613,22 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
// decide which patch to use for sprite relative to player
|
||||
#ifdef RANGECHECK
|
||||
if ((size_t)(thing->sprite) >= numsprites)
|
||||
I_Error("R_ProjectSprite: invalid sprite number %d ", thing->sprite);
|
||||
I_Error("R_ProjectSprite: invalid sprite number %d", thing->sprite);
|
||||
#endif
|
||||
|
||||
frame = thing->frame&FF_FRAMEMASK;
|
||||
frame = thing->frame & FF_FRAMEMASK;
|
||||
|
||||
//Fab : 02-08-98: 'skin' override spritedef currently used for skin
|
||||
if (thing->skin && thing->sprite == SPR_PLAY)
|
||||
{
|
||||
sprdef = &((skin_t *)thing->skin)->sprites[thing->sprite2];
|
||||
sprdef = P_GetSkinSpritedef(thing->skin, thing->sprite2);
|
||||
#ifdef ROTSPRITE
|
||||
sprinfo = &((skin_t *)thing->skin)->sprinfo[thing->sprite2];
|
||||
sprinfo = P_GetSkinSpriteInfo(thing->skin, thing->sprite2);
|
||||
#endif
|
||||
if (frame >= sprdef->numframes) {
|
||||
CONS_Alert(CONS_ERROR, M_GetText("R_ProjectSprite: invalid skins[\"%s\"].sprites[%sSPR2_%s] frame %s\n"), ((skin_t *)thing->skin)->name, ((thing->sprite2 & FF_SPR2SUPER) ? "FF_SPR2SUPER|": ""), spr2names[(thing->sprite2 & ~FF_SPR2SUPER)], sizeu5(frame));
|
||||
|
||||
if (frame >= sprdef->numframes)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("R_ProjectSprite: invalid skins[\"%s\"].sprites[SPR2_%s] %sframe %s\n"), ((skin_t *)thing->skin)->name, spr2names[thing->sprite2 & SPR2F_MASK], (thing->sprite2 & SPR2F_SUPER) ? "super ": "", sizeu5(frame));
|
||||
thing->sprite = states[S_UNKNOWN].sprite;
|
||||
thing->frame = states[S_UNKNOWN].frame;
|
||||
sprdef = &sprites[thing->sprite];
|
||||
|
@ -2721,7 +2730,7 @@ static void R_CreateDrawNodes(maskcount_t* mask, drawnode_t* head, boolean temps
|
|||
// Add the 3D floors, thicksides, and masked textures...
|
||||
for (ds = drawsegs + mask->drawsegs[1]; ds-- > drawsegs + mask->drawsegs[0];)
|
||||
{
|
||||
if (ds->numthicksides)
|
||||
if (ds->numthicksides && r_renderwalls)
|
||||
{
|
||||
for (i = 0; i < ds->numthicksides; i++)
|
||||
{
|
||||
|
@ -2740,17 +2749,19 @@ static void R_CreateDrawNodes(maskcount_t* mask, drawnode_t* head, boolean temps
|
|||
else {
|
||||
// Put it in!
|
||||
entry = R_CreateDrawNode(head);
|
||||
entry->plane = plane;
|
||||
entry->seg = ds;
|
||||
if (r_renderwalls)
|
||||
entry->seg = ds;
|
||||
if (r_renderfloors)
|
||||
entry->plane = plane;
|
||||
}
|
||||
ds->curline->polyseg->visplane = NULL;
|
||||
}
|
||||
if (ds->maskedtexturecol)
|
||||
if (ds->maskedtexturecol && r_renderwalls)
|
||||
{
|
||||
entry = R_CreateDrawNode(head);
|
||||
entry->seg = ds;
|
||||
}
|
||||
if (ds->numffloorplanes)
|
||||
if (ds->numffloorplanes && r_renderfloors)
|
||||
{
|
||||
for (i = 0; i < ds->numffloorplanes; i++)
|
||||
{
|
||||
|
@ -3217,9 +3228,6 @@ static void R_ClipVisSprite(vissprite_t *spr, INT32 x1, INT32 x2, portal_t* port
|
|||
(lowscale < spr->sortscale &&
|
||||
!R_PointOnSegSide (spr->gx, spr->gy, ds->curline)))
|
||||
{
|
||||
// masked mid texture?
|
||||
/*if (ds->maskedtexturecol)
|
||||
R_RenderMaskedSegRange (ds, r1, r2);*/
|
||||
// seg is behind sprite
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ extern fixed_t windowbottom;
|
|||
|
||||
void R_DrawMaskedColumn(column_t *column, unsigned lengthcol);
|
||||
void R_DrawFlippedMaskedColumn(column_t *column, unsigned lengthcol);
|
||||
void R_DrawFlippedPost(UINT8 *source, unsigned length, void (*drawcolfunc)(void));
|
||||
|
||||
// ----------------
|
||||
// SPRITE RENDERING
|
||||
|
|
|
@ -93,11 +93,6 @@ consvar_t cv_scr_width_w = CVAR_INIT ("scr_width_w", "640", CV_SAVE, CV_Unsigned
|
|||
consvar_t cv_scr_height_w = CVAR_INIT ("scr_height_w", "400", CV_SAVE, CV_Unsigned, NULL);
|
||||
consvar_t cv_scr_depth = CVAR_INIT ("scr_depth", "16 bits", CV_SAVE, scr_depth_cons_t, NULL);
|
||||
|
||||
consvar_t cv_renderview = CVAR_INIT ("renderview", "On", 0, CV_OnOff, NULL);
|
||||
consvar_t cv_renderwalls = CVAR_INIT ("renderwalls", "On", CV_NOTINNET|CV_CHEAT, CV_OnOff, NULL);
|
||||
consvar_t cv_renderfloors = CVAR_INIT ("renderfloors", "On", CV_NOTINNET|CV_CHEAT, CV_OnOff, NULL);
|
||||
consvar_t cv_renderthings = CVAR_INIT ("renderthings", "On", CV_NOTINNET|CV_CHEAT, CV_OnOff, NULL);
|
||||
|
||||
CV_PossibleValue_t cv_renderer_t[] = {
|
||||
{1, "Software"},
|
||||
#ifdef HWRENDER
|
||||
|
|
|
@ -172,9 +172,7 @@ extern CV_PossibleValue_t cv_renderer_t[];
|
|||
extern INT32 scr_bpp;
|
||||
|
||||
extern consvar_t cv_scr_width, cv_scr_height, cv_scr_width_w, cv_scr_height_w, cv_scr_depth, cv_fullscreen;
|
||||
extern consvar_t cv_renderwalls, cv_renderfloors, cv_renderthings;
|
||||
extern consvar_t cv_renderview, cv_renderer;
|
||||
extern consvar_t cv_renderhitbox, cv_renderhitboxinterpolation, cv_renderhitboxgldepth;
|
||||
extern consvar_t cv_renderer;
|
||||
// wait for page flipping to end or not
|
||||
extern consvar_t cv_vidwait;
|
||||
extern consvar_t cv_timescale;
|
||||
|
|
|
@ -371,9 +371,11 @@ void ST_LoadFaceGraphics(INT32 skinnum)
|
|||
spritedef_t *sprdef = &skins[skinnum]->sprites[SPR2_XTRA];
|
||||
spriteframe_t *sprframe = &sprdef->spriteframes[XTRA_LIFEPIC];
|
||||
faceprefix[skinnum] = W_CachePatchNum(sprframe->lumppat[0], PU_HUDGFX);
|
||||
if (skins[skinnum]->sprites[(SPR2_XTRA|FF_SPR2SUPER)].numframes > XTRA_LIFEPIC)
|
||||
|
||||
spritedef_t *super_sprdef = P_GetSkinSpritedef(skins[skinnum], SPR2_XTRA|SPR2F_SUPER);
|
||||
if (super_sprdef->numframes > XTRA_LIFEPIC)
|
||||
{
|
||||
sprdef = &skins[skinnum]->sprites[SPR2_XTRA|FF_SPR2SUPER];
|
||||
sprdef = super_sprdef;
|
||||
sprframe = &sprdef->spriteframes[0];
|
||||
superprefix[skinnum] = W_CachePatchNum(sprframe->lumppat[0], PU_HUDGFX);
|
||||
}
|
||||
|
@ -503,7 +505,7 @@ static void ST_DrawNightsOverlayNum(fixed_t x /* right border */, fixed_t y, fix
|
|||
static void ST_drawDebugInfo(void)
|
||||
{
|
||||
INT32 height = 0, h = 8, w = 18, lowh;
|
||||
void (*textfunc)(INT32, INT32, INT32, const char *);
|
||||
fixed_t textscale = FRACUNIT/2;
|
||||
|
||||
if (!(stplyr->mo && cv_debug))
|
||||
return;
|
||||
|
@ -512,12 +514,12 @@ static void ST_drawDebugInfo(void)
|
|||
|
||||
if ((moviemode == MM_GIF && cv_gif_downscale.value) || vid.dup == 1)
|
||||
{
|
||||
textfunc = V_DrawRightAlignedString;
|
||||
textscale = FRACUNIT;
|
||||
lowh = ((vid.height/vid.dup) - 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
textfunc = V_DrawRightAlignedSmallString;
|
||||
textscale = FRACUNIT/2;
|
||||
h /= 2;
|
||||
w /= 2;
|
||||
lowh = 0;
|
||||
|
@ -528,10 +530,10 @@ static void ST_drawDebugInfo(void)
|
|||
V_DrawRightAlignedThinString(320, 8+lowh, VFLAGS|V_REDMAP, "SOME INFO NOT VISIBLE");\
|
||||
return;\
|
||||
}\
|
||||
textfunc(320, height, VFLAGS, str);\
|
||||
V_DrawAlignedFontString(320, height, VFLAGS, textscale, textscale, str, hu_font, alignright);\
|
||||
height += h;
|
||||
|
||||
#define V_DrawDebugFlag(f, str) textfunc(width, height, VFLAGS|f, str);\
|
||||
#define V_DrawDebugFlag(f, str) V_DrawAlignedFontString(width, height, VFLAGS|f, textscale, textscale, str, hu_font, alignright);\
|
||||
width -= w
|
||||
|
||||
if (cv_debug & DBG_MEMORY)
|
||||
|
@ -1167,8 +1169,10 @@ static void ST_drawInput(void)
|
|||
V_DrawFill(x+16+(xoffs), y+(yoffs)-offs, 10, 10, col);\
|
||||
V_DrawCharacter(x+16+1+(xoffs), y+1+(yoffs)-offs, hudinfo[HUD_INPUT].f|symb, false)
|
||||
|
||||
drawbutt( 4,-3, BT_JUMP, 'J');
|
||||
drawbutt(15,-3, BT_SPIN, 'S');
|
||||
drawbutt( 4,-3, BT_JUMP, 'J' );
|
||||
drawbutt(15,-3, BT_SPIN, 'S' );
|
||||
drawbutt(26,-3, BT_SHIELD, '\0'); // Instead of a wide 'J' or 'S', we'll draw a thin "SH" for Shield
|
||||
V_DrawThinString(x+16+26, y+2+(-3)-offs, hudinfo[HUD_LIVES].f, "SH");
|
||||
|
||||
V_DrawFill(x+16+4, y+8, 21, 10, hudinfo[HUD_INPUT].f|20); // sundial backing
|
||||
if (stplyr->mo)
|
||||
|
@ -1545,13 +1549,16 @@ static void ST_drawPowerupHUD(void)
|
|||
{
|
||||
shieldoffs[q] = ICONSEP;
|
||||
|
||||
if ((stplyr->powers[pw_shield] & SH_NOSTACK & ~SH_FORCEHP) == SH_FORCE)
|
||||
if ((stplyr->powers[pw_shield] & SH_NOSTACK & ~SH_FORCEHP) == SH_FORCE
|
||||
&& (stplyr->powers[pw_shield] & SH_FORCEHP) > 0) // Special handling for >1HP Force Shields
|
||||
{
|
||||
UINT8 i, max = (stplyr->powers[pw_shield] & SH_FORCEHP);
|
||||
for (i = 0; i <= max; i++)
|
||||
{
|
||||
V_DrawSmallScaledPatch(offs-(i<<1), hudinfo[HUD_POWERUPS].y-(i<<1), (V_PERPLAYER|hudinfo[HUD_POWERUPS].f)|((i == max) ? V_HUDTRANS : V_HUDTRANSHALF), forceshield);
|
||||
}
|
||||
UINT8 max = (stplyr->powers[pw_shield] & SH_FORCEHP);
|
||||
|
||||
V_DrawSmallScaledPatch(offs, hudinfo[HUD_POWERUPS].y, V_PERPLAYER|hudinfo[HUD_POWERUPS].f|V_HUDTRANSHALF, forceshield);
|
||||
V_DrawSmallScaledPatch(offs-2, hudinfo[HUD_POWERUPS].y-2, V_PERPLAYER|hudinfo[HUD_POWERUPS].f|V_HUDTRANS, forceshield);
|
||||
|
||||
if (max > 1) // if the shield has more than 2 hits, show the extra n hits as "+n"
|
||||
V_DrawRightAlignedThinString(offs+16, hudinfo[HUD_POWERUPS].y, V_PERPLAYER|hudinfo[HUD_POWERUPS].f|V_HUDTRANS, va("+%d", max - 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1561,6 +1568,7 @@ static void ST_drawPowerupHUD(void)
|
|||
case SH_ELEMENTAL: p = watershield; break;
|
||||
case SH_ARMAGEDDON: p = bombshield; break;
|
||||
case SH_ATTRACT: p = ringshield; break;
|
||||
case SH_FORCE: p = forceshield; break;
|
||||
case SH_PITY: p = pityshield; break;
|
||||
case SH_PINK: p = pinkshield; break;
|
||||
case SH_FLAMEAURA: p = flameshield; break;
|
||||
|
|
24
src/string.c
24
src/string.c
|
@ -68,3 +68,27 @@ int endswith(const char *base, const char *tag)
|
|||
|
||||
return !memcmp(&base[base_length - tag_length], tag, tag_length);
|
||||
}
|
||||
|
||||
// strtok version that only skips over one delimiter at a time
|
||||
char *xstrtok(char *line, const char *delims)
|
||||
{
|
||||
static char *saveline = NULL;
|
||||
char *p;
|
||||
|
||||
if(line != NULL)
|
||||
saveline = line;
|
||||
|
||||
// see if we have reached the end of the line
|
||||
if(saveline == NULL || *saveline == '\0')
|
||||
return NULL;
|
||||
|
||||
p = saveline; // save start of this token
|
||||
|
||||
saveline += strcspn(saveline, delims); // get the number of non-delims characters, go past delimiter
|
||||
|
||||
if(*saveline != '\0') // trash the delim if necessary
|
||||
*saveline++ = '\0';
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
|
1264
src/v_video.c
1264
src/v_video.c
File diff suppressed because it is too large
Load diff
124
src/v_video.h
124
src/v_video.h
|
@ -17,6 +17,7 @@
|
|||
#include "doomdef.h"
|
||||
#include "doomtype.h"
|
||||
#include "r_defs.h"
|
||||
#include "hu_stuff.h" //font arrays
|
||||
|
||||
//
|
||||
// VIDEO
|
||||
|
@ -191,86 +192,93 @@ void V_DrawFadeFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c, UINT16 color, U
|
|||
|
||||
void V_DrawFadeConsBack(INT32 plines);
|
||||
void V_DrawPromptBack(INT32 boxheight, INT32 color);
|
||||
|
||||
// draw a single character
|
||||
void V_DrawCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed);
|
||||
// draw a single character, but for the chat
|
||||
void V_DrawChatCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed, UINT8 *colormap);
|
||||
|
||||
UINT8 *V_GetStringColormap(INT32 colorflags);
|
||||
|
||||
void V_DrawLevelTitle(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
// Generalized character drawing function, combining console & chat functionality with a specified font.
|
||||
void V_DrawFontCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed, fixed_t scale, UINT8 *colormap, fontdef_t font);
|
||||
#define V_DrawCharacter(x,y,c,l) V_DrawFontCharacter(x,y,c,l,FRACUNIT,NULL,hu_font)
|
||||
#define V_DrawChatCharacter(x,y,c,l,cm) V_DrawFontCharacter(x,y,c,l,FRACUNIT/2,cm,hu_font)
|
||||
|
||||
// wordwrap a string using the hu_font
|
||||
char *V_WordWrap(INT32 x, INT32 w, INT32 option, const char *string);
|
||||
UINT8 *V_GetStringColormap(INT32 colorflags);
|
||||
// Precompile a wordwrapped string to any given width, using a specified font.
|
||||
char *V_FontWordWrap(INT32 x, INT32 w, INT32 option, fixed_t scale, const char *string, fontdef_t font);
|
||||
#define V_WordWrap(x,w,o,str) V_FontWordWrap(x, w, o, FRACUNIT, str, hu_font)
|
||||
#define V_ChatWordWrap(x,w,o,str) V_FontWordWrap(x, w, o, FRACUNIT/2, str, hu_font)
|
||||
|
||||
enum string_align {
|
||||
alignleft = 0,
|
||||
aligncenter,
|
||||
alignright
|
||||
};
|
||||
|
||||
// Draw a string, using a supplied font and scale.
|
||||
void V_DrawFontString(INT32 x, INT32 y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font);
|
||||
void V_DrawAlignedFontString(INT32 x, INT32 y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font, enum string_align align);
|
||||
// Draw a string, using a supplied font and scale, at fixed_t coordinates.
|
||||
void V_DrawFontStringAtFixed(fixed_t x, fixed_t y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font);
|
||||
void V_DrawAlignedFontStringAtFixed(fixed_t x, fixed_t y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font, enum string_align align);
|
||||
|
||||
// Defines for old string drawers.
|
||||
// draw a string using the hu_font
|
||||
void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
void V_DrawCenteredString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
void V_DrawRightAlignedString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
|
||||
#define V_DrawString(x,y,o,str) V_DrawFontString(x,y,o,FRACUNIT,FRACUNIT,str,hu_font)
|
||||
#define V_DrawCenteredString(x,y,o,str) V_DrawAlignedFontString(x,y,o,FRACUNIT,FRACUNIT,str,hu_font,aligncenter)
|
||||
#define V_DrawRightAlignedString(x,y,o,str) V_DrawAlignedFontString(x,y,o,FRACUNIT,FRACUNIT,str,hu_font,alignright)
|
||||
// draw a string using the hu_font, 0.5x scale
|
||||
void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
void V_DrawCenteredSmallString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
void V_DrawRightAlignedSmallString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
|
||||
// draw a string using the tny_font
|
||||
void V_DrawThinString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
void V_DrawCenteredThinString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
void V_DrawRightAlignedThinString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
|
||||
#define V_DrawSmallString(x,y,o,str) V_DrawFontString(x,y,o,FRACUNIT/2,FRACUNIT/2,str,hu_font)
|
||||
#define V_DrawCenteredSmallString(x,y,o,str) V_DrawAlignedFontString(x,y,o,FRACUNIT/2,FRACUNIT/2,str,hu_font,aligncenter)
|
||||
#define V_DrawRightAlignedSmallString(x,y,o,str) V_DrawAlignedFontString(x,y,o,FRACUNIT/2,FRACUNIT/2,str,hu_font,alignright)
|
||||
// Write a string using the tny_font
|
||||
#define V_DrawThinString(x,y,o,str) V_DrawFontString(x,y,o,FRACUNIT,FRACUNIT,str,tny_font)
|
||||
#define V_DrawCenteredThinString(x,y,o,str) V_DrawAlignedFontString(x,y,o,FRACUNIT,FRACUNIT,str,tny_font,aligncenter)
|
||||
#define V_DrawRightAlignedThinString(x,y,o,str) V_DrawAlignedFontString(x,y,o,FRACUNIT,FRACUNIT,str,tny_font,alignright)
|
||||
// draw a string using the tny_font, 0.5x scale
|
||||
void V_DrawSmallThinString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
void V_DrawCenteredSmallThinString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
void V_DrawRightAlignedSmallThinString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
|
||||
#define V_DrawSmallThinString(x,y,o,str) V_DrawFontString(x,y,o,FRACUNIT/2,FRACUNIT/2,str,tny_font)
|
||||
#define V_DrawCenteredSmallThinString(x,y,o,str) V_DrawAlignedFontString(x,y,o,FRACUNIT/2,FRACUNIT/2,str,tny_font,aligncenter)
|
||||
#define V_DrawRightAlignedSmallThinString(x,y,o,str) V_DrawAlignedFontString(x,y,o,FRACUNIT/2,FRACUNIT/2,str,tny_font,alignright)
|
||||
// draw a string using the hu_font at fixed_t coordinates
|
||||
void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
void V_DrawCenteredStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
void V_DrawRightAlignedStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
|
||||
#define V_DrawStringAtFixed(x,y,o,str) V_DrawFontStringAtFixed(x,y,o,FRACUNIT,FRACUNIT,str,hu_font)
|
||||
#define V_DrawCenteredStringAtFixed(x,y,o,str) V_DrawAlignedFontStringAtFixed(x,y,o,FRACUNIT,FRACUNIT,str,hu_font,aligncenter)
|
||||
#define V_DrawRightAlignedStringAtFixed(x,y,o,str) V_DrawAlignedFontStringAtFixed(x,y,o,FRACUNIT,FRACUNIT,str,hu_font,alignright)
|
||||
// draw a string using the hu_font at fixed_t coordinates, 0.5x scale
|
||||
void V_DrawSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
void V_DrawCenteredSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
void V_DrawRightAlignedSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
|
||||
#define V_DrawSmallStringAtFixed(x,y,o,str) V_DrawFontStringAtFixed(x,y,o,FRACUNIT/2,FRACUNIT/2,str,hu_font)
|
||||
#define V_DrawCenteredSmallStringAtFixed(x,y,o,str) V_DrawAlignedFontStringAtFixed(x,y,o,FRACUNIT/2,FRACUNIT/2,str,hu_font,aligncenter)
|
||||
#define V_DrawRightAlignedSmallStringAtFixed(x,y,o,str) V_DrawAlignedFontStringAtFixed(x,y,o,FRACUNIT/2,FRACUNIT/2,str,hu_font,alignright)
|
||||
// draw a string using the tny_font at fixed_t coordinates
|
||||
void V_DrawThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
void V_DrawCenteredThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
void V_DrawRightAlignedThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
|
||||
#define V_DrawThinStringAtFixed(x,y,o,str) V_DrawFontStringAtFixed(x,y,o,FRACUNIT,FRACUNIT,str,tny_font)
|
||||
#define V_DrawCenteredThinStringAtFixed(x,y,o,str) V_DrawAlignedFontStringAtFixed(x,y,o,FRACUNIT,FRACUNIT,str,tny_font,aligncenter)
|
||||
#define V_DrawRightAlignedThinStringAtFixed(x,y,o,str) V_DrawAlignedFontStringAtFixed(x,y,o,FRACUNIT,FRACUNIT,str,tny_font,alignright)
|
||||
// draw a string using the tny_font at fixed_t coordinates, 0.5x scale
|
||||
void V_DrawSmallThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
void V_DrawCenteredSmallThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
void V_DrawRightAlignedSmallThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
#define V_DrawSmallThinStringAtFixed(x,y,o,str) V_DrawFontStringAtFixed(x,y,o,FRACUNIT/2,FRACUNIT/2,str,tny_font)
|
||||
#define V_DrawCenteredSmallThinStringAtFixed(x,y,o,str) V_DrawAlignedFontStringAtFixed(x,y,o,FRACUNIT/2,FRACUNIT/2,str,tny_font,aligncenter)
|
||||
#define V_DrawRightAlignedSmallThinStringAtFixed(x,y,o,str) V_DrawAlignedFontStringAtFixed(x,y,o,FRACUNIT/2,FRACUNIT/2,str,tny_font,alignright)
|
||||
// draw a string using the credit font
|
||||
#define V_DrawCreditString(x,y,o,str) V_DrawFontStringAtFixed(x,y,o,FRACUNIT,FRACUNIT,str,cred_font)
|
||||
// draw a string using the level title font
|
||||
#define V_DrawLevelTitle(x,y,o,str) V_DrawFontString(x,y,o|V_ALLOWLOWERCASE,FRACUNIT,FRACUNIT,str,lt_font)
|
||||
|
||||
// Draw tall nums, used for menu, HUD, intermission
|
||||
void V_DrawTallNum(INT32 x, INT32 y, INT32 flags, INT32 num);
|
||||
void V_DrawPaddedTallNum(INT32 x, INT32 y, INT32 flags, INT32 num, INT32 digits);
|
||||
void V_DrawLevelActNum(INT32 x, INT32 y, INT32 flags, UINT8 num);
|
||||
|
||||
// Find string width from lt_font chars
|
||||
INT32 V_LevelNameWidth(const char *string);
|
||||
INT32 V_LevelNameHeight(const char *string);
|
||||
INT16 V_LevelActNumWidth(UINT8 num); // act number width
|
||||
|
||||
void V_DrawCreditString(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
INT32 V_CreditStringWidth(const char *string);
|
||||
|
||||
// Draw a string using the nt_font
|
||||
void V_DrawNameTag(INT32 x, INT32 y, INT32 option, fixed_t scale, UINT8 *basecolormap, UINT8 *outlinecolormap, const char *string);
|
||||
INT32 V_CountNameTagLines(const char *string);
|
||||
INT32 V_NameTagWidth(const char *string);
|
||||
|
||||
// Find string width from hu_font chars
|
||||
INT32 V_StringWidth(const char *string, INT32 option);
|
||||
// Find string width from hu_font chars, 0.5x scale
|
||||
INT32 V_SmallStringWidth(const char *string, INT32 option);
|
||||
// Find string width from tny_font chars
|
||||
INT32 V_ThinStringWidth(const char *string, INT32 option);
|
||||
// Find string width from tny_font chars, 0.5x scale
|
||||
INT32 V_SmallThinStringWidth(const char *string, INT32 option);
|
||||
// Find string width or height from supplied font chars
|
||||
INT32 V_FontStringWidth(const char *string, INT32 option, fontdef_t font);
|
||||
INT32 V_FontStringHeight(const char *string, INT32 option, fontdef_t font);
|
||||
|
||||
// Defines for old string width functions.
|
||||
#define V_StringWidth(str,o) V_FontStringWidth(str,o,hu_font)
|
||||
#define V_SmallStringWidth(str,o) V_FontStringWidth(str,o,hu_font)/2
|
||||
#define V_ThinStringWidth(str,o) V_FontStringWidth(str,o,tny_font)
|
||||
#define V_SmallThinStringWidth(str,o) V_FontStringWidth(str,o,tny_font)/2
|
||||
#define V_CreditStringWidth(str) V_FontStringWidth(str,0,cred_font)
|
||||
#define V_NameTagWidth(str) V_FontStringWidth(str,0,ntb_font)
|
||||
#define V_LevelNameWidth(str) V_FontStringWidth(str,V_ALLOWLOWERCASE,lt_font)
|
||||
#define V_LevelNameHeight(str) V_FontStringHeight(str,0,lt_font)
|
||||
#define V_StringHeight(str,o) V_FontStringHeight(str,o,hu_font)
|
||||
|
||||
void V_DoPostProcessor(INT32 view, postimg_t type, INT32 param);
|
||||
|
||||
|
|
|
@ -579,9 +579,9 @@ void Y_IntermissionDrawer(void)
|
|||
{
|
||||
if (LUA_HudEnabled(hud_intermissiontitletext))
|
||||
{
|
||||
const char *ringtext = "\x82" "get 50 rings then";
|
||||
const char *ringtext = "\x82" "get 50 rings, then";
|
||||
const char *tut1text = "\x82" "press " "\x80" "shield";
|
||||
const char *tut2text = "\x82" "to " "\x80" "transform";
|
||||
const char *tut2text = "\x82" "to transform";
|
||||
ttheight = 8;
|
||||
V_DrawLevelTitle(data.spec.passedx1 + xoffset1, ttheight, 0, data.spec.passed1);
|
||||
ttheight += V_LevelNameHeight(data.spec.passed3) + 2;
|
||||
|
|
Loading…
Reference in a new issue