Merge remote-tracking branch 'origin/master' into texture-flats-optimization

This commit is contained in:
Jaime Passos 2019-11-11 14:05:03 -03:00
commit 4e6513b583
23 changed files with 1691 additions and 428 deletions

View File

@ -2089,12 +2089,59 @@ static void readmenu(MYFILE *f, INT32 num)
menupres[num].bgcolor = get_number(word2); menupres[num].bgcolor = get_number(word2);
titlechanged = true; titlechanged = true;
} }
else if (fastcmp(word, "HIDETITLEPICS") || fastcmp(word, "HIDEPICS")) else if (fastcmp(word, "HIDETITLEPICS") || fastcmp(word, "HIDEPICS") || fastcmp(word, "TITLEPICSHIDE"))
{ {
// true by default, except MM_MAIN // true by default, except MM_MAIN
menupres[num].hidetitlepics = (boolean)(value || word2[0] == 'T' || word2[0] == 'Y'); menupres[num].hidetitlepics = (boolean)(value || word2[0] == 'T' || word2[0] == 'Y');
titlechanged = true; titlechanged = true;
} }
else if (fastcmp(word, "TITLEPICSMODE"))
{
if (fastcmp(word2, "USER"))
menupres[num].ttmode = TTMODE_USER;
else if (fastcmp(word2, "ALACROIX"))
menupres[num].ttmode = TTMODE_ALACROIX;
else if (fastcmp(word2, "HIDE") || fastcmp(word2, "HIDDEN") || fastcmp(word2, "NONE"))
{
menupres[num].ttmode = TTMODE_USER;
menupres[num].ttname[0] = 0;
menupres[num].hidetitlepics = true;
}
else // if (fastcmp(word2, "OLD") || fastcmp(word2, "SSNTAILS"))
menupres[num].ttmode = TTMODE_OLD;
titlechanged = true;
}
else if (fastcmp(word, "TITLEPICSSCALE"))
{
// Don't handle Alacroix special case here; see Maincfg section.
menupres[num].ttscale = max(1, min(8, (UINT8)get_number(word2)));
titlechanged = true;
}
else if (fastcmp(word, "TITLEPICSNAME"))
{
strncpy(menupres[num].ttname, word2, 9);
titlechanged = true;
}
else if (fastcmp(word, "TITLEPICSX"))
{
menupres[num].ttx = (INT16)get_number(word2);
titlechanged = true;
}
else if (fastcmp(word, "TITLEPICSY"))
{
menupres[num].tty = (INT16)get_number(word2);
titlechanged = true;
}
else if (fastcmp(word, "TITLEPICSLOOP"))
{
menupres[num].ttloop = (INT16)get_number(word2);
titlechanged = true;
}
else if (fastcmp(word, "TITLEPICSTICS"))
{
menupres[num].tttics = (UINT16)get_number(word2);
titlechanged = true;
}
else if (fastcmp(word, "TITLESCROLLSPEED") || fastcmp(word, "TITLESCROLLXSPEED") else if (fastcmp(word, "TITLESCROLLSPEED") || fastcmp(word, "TITLESCROLLXSPEED")
|| fastcmp(word, "SCROLLSPEED") || fastcmp(word, "SCROLLXSPEED")) || fastcmp(word, "SCROLLSPEED") || fastcmp(word, "SCROLLXSPEED"))
{ {
@ -2308,6 +2355,7 @@ static actionpointer_t actionpointers[] =
{{A_ThrownRing}, "A_THROWNRING"}, {{A_ThrownRing}, "A_THROWNRING"},
{{A_SetSolidSteam}, "A_SETSOLIDSTEAM"}, {{A_SetSolidSteam}, "A_SETSOLIDSTEAM"},
{{A_UnsetSolidSteam}, "A_UNSETSOLIDSTEAM"}, {{A_UnsetSolidSteam}, "A_UNSETSOLIDSTEAM"},
{{A_SignSpin}, "S_SIGNSPIN"},
{{A_SignPlayer}, "A_SIGNPLAYER"}, {{A_SignPlayer}, "A_SIGNPLAYER"},
{{A_OverlayThink}, "A_OVERLAYTHINK"}, {{A_OverlayThink}, "A_OVERLAYTHINK"},
{{A_JetChase}, "A_JETCHASE"}, {{A_JetChase}, "A_JETCHASE"},
@ -3492,11 +3540,78 @@ static void readmaincfg(MYFILE *f)
titlemap = (INT16)value; titlemap = (INT16)value;
titlechanged = true; titlechanged = true;
} }
else if (fastcmp(word, "HIDETITLEPICS")) else if (fastcmp(word, "HIDETITLEPICS") || fastcmp(word, "TITLEPICSHIDE"))
{ {
hidetitlepics = (boolean)(value || word2[0] == 'T' || word2[0] == 'Y'); hidetitlepics = (boolean)(value || word2[0] == 'T' || word2[0] == 'Y');
titlechanged = true; titlechanged = true;
} }
else if (fastcmp(word, "TITLEPICSMODE"))
{
if (fastcmp(word2, "USER"))
ttmode = TTMODE_USER;
else if (fastcmp(word2, "ALACROIX"))
ttmode = TTMODE_ALACROIX;
else if (fastcmp(word2, "HIDE") || fastcmp(word2, "HIDDEN") || fastcmp(word2, "NONE"))
{
ttmode = TTMODE_USER;
ttname[0] = 0;
hidetitlepics = true;
}
else // if (fastcmp(word2, "OLD") || fastcmp(word2, "SSNTAILS"))
ttmode = TTMODE_OLD;
titlechanged = true;
}
else if (fastcmp(word, "TITLEPICSSCALE"))
{
ttscale = max(1, min(8, (UINT8)get_number(word2)));
titlechanged = true;
}
else if (fastcmp(word, "TITLEPICSSCALESAVAILABLE"))
{
// SPECIAL CASE for Alacroix: Comma-separated list of resolutions that are available
// for gfx loading.
ttavailable[0] = ttavailable[1] = ttavailable[2] = ttavailable[3] =\
ttavailable[4] = ttavailable[5] = false;
if (strstr(word2, "1") != NULL)
ttavailable[0] = true;
if (strstr(word2, "2") != NULL)
ttavailable[1] = true;
if (strstr(word2, "3") != NULL)
ttavailable[2] = true;
if (strstr(word2, "4") != NULL)
ttavailable[3] = true;
if (strstr(word2, "5") != NULL)
ttavailable[4] = true;
if (strstr(word2, "6") != NULL)
ttavailable[5] = true;
titlechanged = true;
}
else if (fastcmp(word, "TITLEPICSNAME"))
{
strncpy(ttname, word2, 9);
titlechanged = true;
}
else if (fastcmp(word, "TITLEPICSX"))
{
ttx = (INT16)get_number(word2);
titlechanged = true;
}
else if (fastcmp(word, "TITLEPICSY"))
{
tty = (INT16)get_number(word2);
titlechanged = true;
}
else if (fastcmp(word, "TITLEPICSLOOP"))
{
ttloop = (INT16)get_number(word2);
titlechanged = true;
}
else if (fastcmp(word, "TITLEPICSTICS"))
{
tttics = (UINT16)get_number(word2);
titlechanged = true;
}
else if (fastcmp(word, "TITLESCROLLSPEED") || fastcmp(word, "TITLESCROLLXSPEED")) else if (fastcmp(word, "TITLESCROLLSPEED") || fastcmp(word, "TITLESCROLLXSPEED"))
{ {
titlescrollxspeed = get_number(word2); titlescrollxspeed = get_number(word2);
@ -5385,59 +5500,18 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_BUBBLES4", "S_BUBBLES4",
// Level End Sign // Level End Sign
"S_SIGN1", "S_SIGN",
"S_SIGN2", "S_SIGNSPIN1",
"S_SIGN3", "S_SIGNSPIN2",
"S_SIGN4", "S_SIGNSPIN3",
"S_SIGN5", "S_SIGNSPIN4",
"S_SIGN6", "S_SIGNSPIN5",
"S_SIGN7", "S_SIGNSPIN6",
"S_SIGN8", "S_SIGNPLAYER",
"S_SIGN9", "S_SIGNSLOW",
"S_SIGN10", "S_SIGNSTOP",
"S_SIGN11", "S_SIGNBOARD",
"S_SIGN12", "S_EGGMANSIGN",
"S_SIGN13",
"S_SIGN14",
"S_SIGN15",
"S_SIGN16",
"S_SIGN17",
"S_SIGN18",
"S_SIGN19",
"S_SIGN20",
"S_SIGN21",
"S_SIGN22",
"S_SIGN23",
"S_SIGN24",
"S_SIGN25",
"S_SIGN26",
"S_SIGN27",
"S_SIGN28",
"S_SIGN29",
"S_SIGN30",
"S_SIGN31",
"S_SIGN32",
"S_SIGN33",
"S_SIGN34",
"S_SIGN35",
"S_SIGN36",
"S_SIGN37",
"S_SIGN38",
"S_SIGN39",
"S_SIGN40",
"S_SIGN41",
"S_SIGN42",
"S_SIGN43",
"S_SIGN44",
"S_SIGN45",
"S_SIGN46",
"S_SIGN47",
"S_SIGN48",
"S_SIGN49",
"S_SIGN50",
"S_SIGN51",
"S_SIGN52", // Eggman
"S_SIGN53",
// Spike Ball // Spike Ball
"S_SPIKEBALL1", "S_SPIKEBALL1",

File diff suppressed because it is too large Load Diff

View File

@ -77,6 +77,28 @@ void F_ContinueDrawer(void);
extern INT32 titlescrollxspeed; extern INT32 titlescrollxspeed;
extern INT32 titlescrollyspeed; extern INT32 titlescrollyspeed;
typedef enum
{
TTMODE_NONE = 0,
TTMODE_OLD,
TTMODE_ALACROIX,
TTMODE_USER
} ttmode_enum;
#define TTMAX_ALACROIX 30 // max frames for SONIC typeface, plus one for NULL terminating entry
#define TTMAX_USER 100
extern ttmode_enum ttmode;
extern UINT8 ttscale;
// ttmode user vars
extern char ttname[9];
extern INT16 ttx;
extern INT16 tty;
extern INT16 ttloop;
extern UINT16 tttics;
extern boolean ttavailable[6];
typedef enum typedef enum
{ {
TITLEMAP_OFF = 0, TITLEMAP_OFF = 0,
@ -89,13 +111,22 @@ typedef enum
extern mobj_t *titlemapcameraref; extern mobj_t *titlemapcameraref;
extern char curbgname[9]; extern char curbgname[9];
extern SINT8 curfadevalue; extern SINT8 curfadevalue;
extern boolean curhidepics;
extern INT32 curbgcolor; extern INT32 curbgcolor;
extern INT32 curbgxspeed; extern INT32 curbgxspeed;
extern INT32 curbgyspeed; extern INT32 curbgyspeed;
extern boolean curbghide; extern boolean curbghide;
extern boolean hidetitlemap; extern boolean hidetitlemap;
extern boolean curhidepics;
extern ttmode_enum curttmode;
extern UINT8 curttscale;
// ttmode user vars
extern char curttname[9];
extern INT16 curttx;
extern INT16 curtty;
extern INT16 curttloop;
extern UINT16 curtttics;
#define TITLEBACKGROUNDACTIVE (curfadevalue >= 0 || curbgname[0]) #define TITLEBACKGROUNDACTIVE (curfadevalue >= 0 || curbgname[0])
void F_InitMenuPresValues(void); void F_InitMenuPresValues(void);

View File

@ -2803,7 +2803,7 @@ void G_AddPlayer(INT32 playernum)
countplayers++; countplayers++;
if (!players->exiting) if (!players[i].exiting)
notexiting++; notexiting++;
if (!(cv_coopstarposts.value && (gametype == GT_COOP) && (p->starpostnum < players[i].starpostnum))) if (!(cv_coopstarposts.value && (gametype == GT_COOP) && (p->starpostnum < players[i].starpostnum)))
@ -3358,6 +3358,11 @@ void G_LoadGameData(void)
// Allow saving of gamedata beyond this point // Allow saving of gamedata beyond this point
gamedataloaded = true; gamedataloaded = true;
if (M_CheckParm("-gamedata") && M_IsNextParm())
{
strlcpy(gamedatafilename, M_GetNextParm(), sizeof gamedatafilename);
}
if (M_CheckParm("-resetdata")) if (M_CheckParm("-resetdata"))
return; // Don't load (essentially, reset). return; // Don't load (essentially, reset).

View File

@ -825,10 +825,10 @@ static void FreeMipmapColormap(INT32 patchnum, void *patch)
{ {
GLPatch_t* const grpatch = patch; GLPatch_t* const grpatch = patch;
(void)patchnum; //unused (void)patchnum; //unused
while (grpatch->mipmap.nextcolormap) while (grpatch->mipmap->nextcolormap)
{ {
GLMipmap_t *grmip = grpatch->mipmap.nextcolormap; GLMipmap_t *grmip = grpatch->mipmap->nextcolormap;
grpatch->mipmap.nextcolormap = grmip->nextcolormap; grpatch->mipmap->nextcolormap = grmip->nextcolormap;
if (grmip->grInfo.data) Z_Free(grmip->grInfo.data); if (grmip->grInfo.data) Z_Free(grmip->grInfo.data);
free(grmip); free(grmip);
} }
@ -1001,7 +1001,7 @@ void HWR_LiterallyGetFlat(lumpnum_t flatlumpnum)
if (flatlumpnum == LUMPERROR) if (flatlumpnum == LUMPERROR)
return; return;
grmip = &HWR_GetCachedGLPatch(flatlumpnum)->mipmap; grmip = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
if (!grmip->downloaded && !grmip->grInfo.data) if (!grmip->downloaded && !grmip->grInfo.data)
HWR_CacheFlat(grmip, flatlumpnum); HWR_CacheFlat(grmip, flatlumpnum);
@ -1069,22 +1069,22 @@ static void HWR_LoadMappedPatch(GLMipmap_t *grmip, GLPatch_t *gpatch)
void HWR_GetPatch(GLPatch_t *gpatch) void HWR_GetPatch(GLPatch_t *gpatch)
{ {
// is it in hardware cache // is it in hardware cache
if (!gpatch->mipmap.downloaded && !gpatch->mipmap.grInfo.data) if (!gpatch->mipmap->downloaded && !gpatch->mipmap->grInfo.data)
{ {
// load the software patch, PU_STATIC or the Z_Malloc for hardware patch will // load the software patch, PU_STATIC or the Z_Malloc for hardware patch will
// flush the software patch before the conversion! oh yeah I suffered // flush the software patch before the conversion! oh yeah I suffered
patch_t *ptr = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC); patch_t *ptr = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
HWR_MakePatch(ptr, gpatch, &gpatch->mipmap, true); HWR_MakePatch(ptr, gpatch, gpatch->mipmap, true);
// this is inefficient.. but the hardware patch in heap is purgeable so it should // this is inefficient.. but the hardware patch in heap is purgeable so it should
// not fragment memory, and besides the REAL cache here is the hardware memory // not fragment memory, and besides the REAL cache here is the hardware memory
Z_Free(ptr); Z_Free(ptr);
} }
HWD.pfnSetTexture(&gpatch->mipmap); HWD.pfnSetTexture(gpatch->mipmap);
// The system-memory patch data can be purged now. // The system-memory patch data can be purged now.
Z_ChangeTag(gpatch->mipmap.grInfo.data, PU_HWRCACHE_UNLOCKED); Z_ChangeTag(gpatch->mipmap->grInfo.data, PU_HWRCACHE_UNLOCKED);
} }
@ -1104,7 +1104,7 @@ void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap)
// search for the mimmap // search for the mimmap
// skip the first (no colormap translated) // skip the first (no colormap translated)
for (grmip = &gpatch->mipmap; grmip->nextcolormap; ) for (grmip = gpatch->mipmap; grmip->nextcolormap; )
{ {
grmip = grmip->nextcolormap; grmip = grmip->nextcolormap;
if (grmip->colormap == colormap) if (grmip->colormap == colormap)
@ -1134,7 +1134,7 @@ void HWR_UnlockCachedPatch(GLPatch_t *gpatch)
if (!gpatch) if (!gpatch)
return; return;
Z_ChangeTag(gpatch->mipmap.grInfo.data, PU_HWRCACHE_UNLOCKED); Z_ChangeTag(gpatch->mipmap->grInfo.data, PU_HWRCACHE_UNLOCKED);
Z_ChangeTag(gpatch, PU_HWRPATCHINFO_UNLOCKED); Z_ChangeTag(gpatch, PU_HWRPATCHINFO_UNLOCKED);
} }
@ -1222,7 +1222,7 @@ GLPatch_t *HWR_GetPic(lumpnum_t lumpnum)
grpatch = HWR_GetCachedGLPatch(lumpnum); grpatch = HWR_GetCachedGLPatch(lumpnum);
if (!grpatch->mipmap.downloaded && !grpatch->mipmap.grInfo.data) if (!grpatch->mipmap->downloaded && !grpatch->mipmap->grInfo.data)
{ {
pic_t *pic; pic_t *pic;
UINT8 *block; UINT8 *block;
@ -1238,19 +1238,19 @@ GLPatch_t *HWR_GetPic(lumpnum_t lumpnum)
grpatch->topoffset = 0; grpatch->topoffset = 0;
// find the good 3dfx size (boring spec) // find the good 3dfx size (boring spec)
HWR_ResizeBlock (grpatch->width, grpatch->height, &grpatch->mipmap.grInfo); HWR_ResizeBlock (grpatch->width, grpatch->height, &grpatch->mipmap->grInfo);
grpatch->mipmap.width = (UINT16)blockwidth; grpatch->mipmap->width = (UINT16)blockwidth;
grpatch->mipmap.height = (UINT16)blockheight; grpatch->mipmap->height = (UINT16)blockheight;
if (pic->mode == PALETTE) if (pic->mode == PALETTE)
grpatch->mipmap.grInfo.format = textureformat; // can be set by driver grpatch->mipmap->grInfo.format = textureformat; // can be set by driver
else else
grpatch->mipmap.grInfo.format = picmode2GR[pic->mode]; grpatch->mipmap->grInfo.format = picmode2GR[pic->mode];
Z_Free(grpatch->mipmap.grInfo.data); Z_Free(grpatch->mipmap->grInfo.data);
// allocate block // allocate block
block = MakeBlock(&grpatch->mipmap); block = MakeBlock(grpatch->mipmap);
// if rounddown, rounddown patches as well as textures // if rounddown, rounddown patches as well as textures
if (cv_grrounddown.value) if (cv_grrounddown.value)
@ -1280,25 +1280,25 @@ GLPatch_t *HWR_GetPic(lumpnum_t lumpnum)
if (grpatch->width == blockwidth && if (grpatch->width == blockwidth &&
grpatch->height == blockheight && grpatch->height == blockheight &&
format2bpp[grpatch->mipmap.grInfo.format] == format2bpp[picmode2GR[pic->mode]]) format2bpp[grpatch->mipmap->grInfo.format] == format2bpp[picmode2GR[pic->mode]])
{ {
// no conversion needed // no conversion needed
M_Memcpy(grpatch->mipmap.grInfo.data, pic->data,len); M_Memcpy(grpatch->mipmap->grInfo.data, pic->data,len);
} }
else else
HWR_DrawPicInCache(block, newwidth, newheight, HWR_DrawPicInCache(block, newwidth, newheight,
blockwidth*format2bpp[grpatch->mipmap.grInfo.format], blockwidth*format2bpp[grpatch->mipmap->grInfo.format],
pic, pic,
format2bpp[grpatch->mipmap.grInfo.format]); format2bpp[grpatch->mipmap->grInfo.format]);
Z_Unlock(pic); Z_Unlock(pic);
Z_ChangeTag(block, PU_HWRCACHE_UNLOCKED); Z_ChangeTag(block, PU_HWRCACHE_UNLOCKED);
grpatch->mipmap.flags = 0; grpatch->mipmap->flags = 0;
grpatch->max_s = (float)newwidth / (float)blockwidth; grpatch->max_s = (float)newwidth / (float)blockwidth;
grpatch->max_t = (float)newheight / (float)blockheight; grpatch->max_t = (float)newheight / (float)blockheight;
} }
HWD.pfnSetTexture(&grpatch->mipmap); HWD.pfnSetTexture(grpatch->mipmap);
//CONS_Debug(DBG_RENDER, "picloaded at %x as texture %d\n",grpatch->mipmap.grInfo.data, grpatch->mipmap.downloaded); //CONS_Debug(DBG_RENDER, "picloaded at %x as texture %d\n",grpatch->mipmap.grInfo.data, grpatch->mipmap.downloaded);
return grpatch; return grpatch;
@ -1314,6 +1314,7 @@ GLPatch_t *HWR_GetCachedGLPatchPwad(UINT16 wadnum, UINT16 lumpnum)
grpatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, NULL); grpatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, NULL);
grpatch->wadnum = wadnum; grpatch->wadnum = wadnum;
grpatch->lumpnum = lumpnum; grpatch->lumpnum = lumpnum;
grpatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, NULL);
M_AATreeSet(hwrcache, lumpnum, grpatch); M_AATreeSet(hwrcache, lumpnum, grpatch);
} }
@ -1417,7 +1418,7 @@ void HWR_GetFadeMask(lumpnum_t fademasklumpnum)
{ {
GLMipmap_t *grmip; GLMipmap_t *grmip;
grmip = &HWR_GetCachedGLPatch(fademasklumpnum)->mipmap; grmip = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
if (!grmip->downloaded && !grmip->grInfo.data) if (!grmip->downloaded && !grmip->grInfo.data)
HWR_CacheFadeMask(grmip, fademasklumpnum); HWR_CacheFadeMask(grmip, fademasklumpnum);

View File

@ -83,8 +83,8 @@ struct GLPatch_s
float max_s,max_t; float max_s,max_t;
UINT16 wadnum; // the software patch lump num for when the hardware patch UINT16 wadnum; // the software patch lump num for when the hardware patch
UINT16 lumpnum; // was flushed, and we need to re-create it UINT16 lumpnum; // was flushed, and we need to re-create it
GLMipmap_t mipmap; GLMipmap_t *mipmap;
}; } ATTRPACK;
typedef struct GLPatch_s GLPatch_t; typedef struct GLPatch_s GLPatch_t;
#endif //_HWR_DATA_ #endif //_HWR_DATA_

View File

@ -1205,7 +1205,8 @@ void HWR_DL_AddLight(gr_vissprite_t *spr, GLPatch_t *patch)
dynlights->nb++; dynlights->nb++;
} }
static GLPatch_t lightmappatch; static GLMipmap_t lightmappatchmipmap;
static GLPatch_t lightmappatch = { .mipmap = &lightmappatchmipmap };
void HWR_InitLight(void) void HWR_InitLight(void)
{ {
@ -1215,7 +1216,7 @@ void HWR_InitLight(void)
for (i = 0;i < NUMLIGHTS;i++) for (i = 0;i < NUMLIGHTS;i++)
lspr[i].dynamic_sqrradius = lspr[i].dynamic_radius*lspr[i].dynamic_radius; lspr[i].dynamic_sqrradius = lspr[i].dynamic_radius*lspr[i].dynamic_radius;
lightmappatch.mipmap.downloaded = false; lightmappatch.mipmap->downloaded = false;
coronalumpnum = W_CheckNumForName("CORONA"); coronalumpnum = W_CheckNumForName("CORONA");
} }
@ -1226,10 +1227,10 @@ static void HWR_SetLight(void)
{ {
int i, j; int i, j;
if (!lightmappatch.mipmap.downloaded && !lightmappatch.mipmap.grInfo.data) if (!lightmappatch.mipmap->downloaded && !lightmappatch.mipmap->grInfo.data)
{ {
UINT16 *Data = Z_Malloc(129*128*sizeof (UINT16), PU_HWRCACHE, &lightmappatch.mipmap.grInfo.data); UINT16 *Data = Z_Malloc(129*128*sizeof (UINT16), PU_HWRCACHE, &lightmappatch.mipmap->grInfo.data);
for (i = 0; i < 128; i++) for (i = 0; i < 128; i++)
{ {
@ -1242,23 +1243,23 @@ static void HWR_SetLight(void)
Data[i*128+j] = 0; Data[i*128+j] = 0;
} }
} }
lightmappatch.mipmap.grInfo.format = GR_TEXFMT_ALPHA_INTENSITY_88; lightmappatch.mipmap->grInfo.format = GR_TEXFMT_ALPHA_INTENSITY_88;
lightmappatch.width = 128; lightmappatch.width = 128;
lightmappatch.height = 128; lightmappatch.height = 128;
lightmappatch.mipmap.width = 128; lightmappatch.mipmap->width = 128;
lightmappatch.mipmap.height = 128; lightmappatch.mipmap->height = 128;
#ifdef GLIDE_API_COMPATIBILITY #ifdef GLIDE_API_COMPATIBILITY
lightmappatch.mipmap.grInfo.smallLodLog2 = GR_LOD_LOG2_128; lightmappatch.mipmap->grInfo.smallLodLog2 = GR_LOD_LOG2_128;
lightmappatch.mipmap.grInfo.largeLodLog2 = GR_LOD_LOG2_128; lightmappatch.mipmap->grInfo.largeLodLog2 = GR_LOD_LOG2_128;
lightmappatch.mipmap.grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1; lightmappatch.mipmap->grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
#endif #endif
lightmappatch.mipmap.flags = 0; //TF_WRAPXY; // DEBUG: view the overdraw ! lightmappatch.mipmap->flags = 0; //TF_WRAPXY; // DEBUG: view the overdraw !
} }
HWD.pfnSetTexture(&lightmappatch.mipmap); HWD.pfnSetTexture(lightmappatch.mipmap);
// The system-memory data can be purged now. // The system-memory data can be purged now.
Z_ChangeTag(lightmappatch.mipmap.grInfo.data, PU_HWRCACHE_UNLOCKED); Z_ChangeTag(lightmappatch.mipmap->grInfo.data, PU_HWRCACHE_UNLOCKED);
} }
//********************************************************** //**********************************************************

View File

@ -567,7 +567,7 @@ static GrTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
//CONS_Debug(DBG_RENDER, "libpng load error on %s\n", filename); //CONS_Debug(DBG_RENDER, "libpng load error on %s\n", filename);
png_destroy_read_struct(&png_ptr, &png_info_ptr, NULL); png_destroy_read_struct(&png_ptr, &png_info_ptr, NULL);
fclose(png_FILE); fclose(png_FILE);
Z_Free(grpatch->mipmap.grInfo.data); Z_Free(grpatch->mipmap->grInfo.data);
return 0; return 0;
} }
#ifdef USE_FAR_KEYWORD #ifdef USE_FAR_KEYWORD
@ -608,7 +608,7 @@ static GrTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
{ {
png_uint_32 i, pitch = png_get_rowbytes(png_ptr, png_info_ptr); png_uint_32 i, pitch = png_get_rowbytes(png_ptr, png_info_ptr);
png_bytep PNG_image = Z_Malloc(pitch*height, PU_HWRCACHE, &grpatch->mipmap.grInfo.data); png_bytep PNG_image = Z_Malloc(pitch*height, PU_HWRCACHE, &grpatch->mipmap->grInfo.data);
png_bytepp row_pointers = png_malloc(png_ptr, height * sizeof (png_bytep)); png_bytepp row_pointers = png_malloc(png_ptr, height * sizeof (png_bytep));
for (i = 0; i < height; i++) for (i = 0; i < height; i++)
row_pointers[i] = PNG_image + i*pitch; row_pointers[i] = PNG_image + i*pitch;
@ -682,7 +682,7 @@ static GrTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
pw = *w = header.xmax - header.xmin + 1; pw = *w = header.xmax - header.xmin + 1;
ph = *h = header.ymax - header.ymin + 1; ph = *h = header.ymax - header.ymin + 1;
image = Z_Malloc(pw*ph*4, PU_HWRCACHE, &grpatch->mipmap.grInfo.data); image = Z_Malloc(pw*ph*4, PU_HWRCACHE, &grpatch->mipmap->grInfo.data);
if (fread(palette, sizeof (UINT8), PALSIZE, file) != PALSIZE) if (fread(palette, sizeof (UINT8), PALSIZE, file) != PALSIZE)
{ {
@ -730,39 +730,42 @@ static void md2_loadTexture(md2_t *model)
if (model->grpatch) if (model->grpatch)
{ {
grpatch = model->grpatch; grpatch = model->grpatch;
Z_Free(grpatch->mipmap.grInfo.data); Z_Free(grpatch->mipmap->grInfo.data);
} }
else else
{
grpatch = Z_Calloc(sizeof *grpatch, PU_HWRPATCHINFO, grpatch = Z_Calloc(sizeof *grpatch, PU_HWRPATCHINFO,
&(model->grpatch)); &(model->grpatch));
grpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
}
if (!grpatch->mipmap.downloaded && !grpatch->mipmap.grInfo.data) if (!grpatch->mipmap->downloaded && !grpatch->mipmap->grInfo.data)
{ {
int w = 0, h = 0; int w = 0, h = 0;
#ifdef HAVE_PNG #ifdef HAVE_PNG
grpatch->mipmap.grInfo.format = PNG_Load(filename, &w, &h, grpatch); grpatch->mipmap->grInfo.format = PNG_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap.grInfo.format == 0) if (grpatch->mipmap->grInfo.format == 0)
#endif #endif
grpatch->mipmap.grInfo.format = PCX_Load(filename, &w, &h, grpatch); grpatch->mipmap->grInfo.format = PCX_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap.grInfo.format == 0) if (grpatch->mipmap->grInfo.format == 0)
return; return;
grpatch->mipmap.downloaded = 0; grpatch->mipmap->downloaded = 0;
grpatch->mipmap.flags = 0; grpatch->mipmap->flags = 0;
grpatch->width = (INT16)w; grpatch->width = (INT16)w;
grpatch->height = (INT16)h; grpatch->height = (INT16)h;
grpatch->mipmap.width = (UINT16)w; grpatch->mipmap->width = (UINT16)w;
grpatch->mipmap.height = (UINT16)h; grpatch->mipmap->height = (UINT16)h;
#ifdef GLIDE_API_COMPATIBILITY #ifdef GLIDE_API_COMPATIBILITY
// not correct! // not correct!
grpatch->mipmap.grInfo.smallLodLog2 = GR_LOD_LOG2_256; grpatch->mipmap->grInfo.smallLodLog2 = GR_LOD_LOG2_256;
grpatch->mipmap.grInfo.largeLodLog2 = GR_LOD_LOG2_256; grpatch->mipmap->grInfo.largeLodLog2 = GR_LOD_LOG2_256;
grpatch->mipmap.grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1; grpatch->mipmap->grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
#endif #endif
} }
HWD.pfnSetTexture(&grpatch->mipmap); HWD.pfnSetTexture(grpatch->mipmap);
HWR_UnlockCachedPatch(grpatch); HWR_UnlockCachedPatch(grpatch);
} }
@ -780,42 +783,45 @@ static void md2_loadBlendTexture(md2_t *model)
if (model->blendgrpatch) if (model->blendgrpatch)
{ {
grpatch = model->blendgrpatch; grpatch = model->blendgrpatch;
Z_Free(grpatch->mipmap.grInfo.data); Z_Free(grpatch->mipmap->grInfo.data);
} }
else else
{
grpatch = Z_Calloc(sizeof *grpatch, PU_HWRPATCHINFO, grpatch = Z_Calloc(sizeof *grpatch, PU_HWRPATCHINFO,
&(model->blendgrpatch)); &(model->blendgrpatch));
grpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
}
if (!grpatch->mipmap.downloaded && !grpatch->mipmap.grInfo.data) if (!grpatch->mipmap->downloaded && !grpatch->mipmap->grInfo.data)
{ {
int w = 0, h = 0; int w = 0, h = 0;
#ifdef HAVE_PNG #ifdef HAVE_PNG
grpatch->mipmap.grInfo.format = PNG_Load(filename, &w, &h, grpatch); grpatch->mipmap->grInfo.format = PNG_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap.grInfo.format == 0) if (grpatch->mipmap->grInfo.format == 0)
#endif #endif
grpatch->mipmap.grInfo.format = PCX_Load(filename, &w, &h, grpatch); grpatch->mipmap->grInfo.format = PCX_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap.grInfo.format == 0) if (grpatch->mipmap->grInfo.format == 0)
{ {
Z_Free(filename); Z_Free(filename);
return; return;
} }
grpatch->mipmap.downloaded = 0; grpatch->mipmap->downloaded = 0;
grpatch->mipmap.flags = 0; grpatch->mipmap->flags = 0;
grpatch->width = (INT16)w; grpatch->width = (INT16)w;
grpatch->height = (INT16)h; grpatch->height = (INT16)h;
grpatch->mipmap.width = (UINT16)w; grpatch->mipmap->width = (UINT16)w;
grpatch->mipmap.height = (UINT16)h; grpatch->mipmap->height = (UINT16)h;
#ifdef GLIDE_API_COMPATIBILITY #ifdef GLIDE_API_COMPATIBILITY
// not correct! // not correct!
grpatch->mipmap.grInfo.smallLodLog2 = GR_LOD_LOG2_256; grpatch->mipmap->grInfo.smallLodLog2 = GR_LOD_LOG2_256;
grpatch->mipmap.grInfo.largeLodLog2 = GR_LOD_LOG2_256; grpatch->mipmap->grInfo.largeLodLog2 = GR_LOD_LOG2_256;
grpatch->mipmap.grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1; grpatch->mipmap->grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
#endif #endif
} }
HWD.pfnSetTexture(&grpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary HWD.pfnSetTexture(grpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
HWR_UnlockCachedPatch(grpatch); HWR_UnlockCachedPatch(grpatch);
Z_Free(filename); Z_Free(filename);
@ -1029,8 +1035,8 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
cur = Z_Malloc(size*4, PU_HWRCACHE, &grmip->grInfo.data); cur = Z_Malloc(size*4, PU_HWRCACHE, &grmip->grInfo.data);
memset(cur, 0x00, size*4); memset(cur, 0x00, size*4);
image = gpatch->mipmap.grInfo.data; image = gpatch->mipmap->grInfo.data;
blendimage = blendgpatch->mipmap.grInfo.data; blendimage = blendgpatch->mipmap->grInfo.data;
// Average all of the translation's colors // Average all of the translation's colors
if (color == SKINCOLOR_NONE || color >= MAXTRANSLATIONS) if (color == SKINCOLOR_NONE || color >= MAXTRANSLATIONS)
@ -1145,13 +1151,13 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
if (colormap == colormaps || colormap == NULL) if (colormap == colormaps || colormap == NULL)
{ {
// Don't do any blending // Don't do any blending
HWD.pfnSetTexture(&gpatch->mipmap); HWD.pfnSetTexture(gpatch->mipmap);
return; return;
} }
// search for the mimmap // search for the mimmap
// skip the first (no colormap translated) // skip the first (no colormap translated)
for (grmip = &gpatch->mipmap; grmip->nextcolormap; ) for (grmip = gpatch->mipmap; grmip->nextcolormap; )
{ {
grmip = grmip->nextcolormap; grmip = grmip->nextcolormap;
if (grmip->colormap == colormap) if (grmip->colormap == colormap)
@ -1371,18 +1377,18 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
finalscale = md2->scale; finalscale = md2->scale;
//Hurdler: arf, I don't like that implementation at all... too much crappy //Hurdler: arf, I don't like that implementation at all... too much crappy
gpatch = md2->grpatch; gpatch = md2->grpatch;
if (!gpatch || !gpatch->mipmap.grInfo.format || !gpatch->mipmap.downloaded) if (!gpatch || !gpatch->mipmap->grInfo.format || !gpatch->mipmap->downloaded)
md2_loadTexture(md2); md2_loadTexture(md2);
gpatch = md2->grpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture... gpatch = md2->grpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
if ((gpatch && gpatch->mipmap.grInfo.format) // don't load the blend texture if the base texture isn't available if ((gpatch && gpatch->mipmap->grInfo.format) // don't load the blend texture if the base texture isn't available
&& (!md2->blendgrpatch || !((GLPatch_t *)md2->blendgrpatch)->mipmap.grInfo.format || !((GLPatch_t *)md2->blendgrpatch)->mipmap.downloaded)) && (!md2->blendgrpatch || !((GLPatch_t *)md2->blendgrpatch)->mipmap->grInfo.format || !((GLPatch_t *)md2->blendgrpatch)->mipmap->downloaded))
md2_loadBlendTexture(md2); md2_loadBlendTexture(md2);
if (gpatch && gpatch->mipmap.grInfo.format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture if (gpatch && gpatch->mipmap->grInfo.format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture
{ {
if ((skincolors_t)spr->mobj->color != SKINCOLOR_NONE && if ((skincolors_t)spr->mobj->color != SKINCOLOR_NONE &&
md2->blendgrpatch && ((GLPatch_t *)md2->blendgrpatch)->mipmap.grInfo.format md2->blendgrpatch && ((GLPatch_t *)md2->blendgrpatch)->mipmap->grInfo.format
&& gpatch->width == ((GLPatch_t *)md2->blendgrpatch)->width && gpatch->height == ((GLPatch_t *)md2->blendgrpatch)->height) && gpatch->width == ((GLPatch_t *)md2->blendgrpatch)->width && gpatch->height == ((GLPatch_t *)md2->blendgrpatch)->height)
{ {
INT32 skinnum = TC_DEFAULT; INT32 skinnum = TC_DEFAULT;
@ -1413,7 +1419,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
else else
{ {
// This is safe, since we know the texture has been downloaded // This is safe, since we know the texture has been downloaded
HWD.pfnSetTexture(&gpatch->mipmap); HWD.pfnSetTexture(gpatch->mipmap);
} }
} }
else else

View File

@ -808,7 +808,7 @@ state_t states[NUMSTATES] =
{SPR_PLAY, SPR2_LIFE, 20, {NULL}, 0, 4, S_NULL}, // S_PLAY_ICON3 {SPR_PLAY, SPR2_LIFE, 20, {NULL}, 0, 4, S_NULL}, // S_PLAY_ICON3
// Level end sign (uses player sprite) // Level end sign (uses player sprite)
{SPR_PLAY, SPR2_SIGN, 1, {NULL}, 0, 24, S_PLAY_SIGN}, // S_PLAY_SIGN {SPR_PLAY, SPR2_SIGN|FF_PAPERSPRITE, -1, {NULL}, 0, 29, S_PLAY_SIGN}, // S_PLAY_SIGN
// NiGHTS Player, transforming // NiGHTS Player, transforming
{SPR_PLAY, SPR2_TRNS|FF_ANIMATE, 7, {NULL}, 0, 4, S_PLAY_NIGHTS_TRANS2}, // S_PLAY_NIGHTS_TRANS1 {SPR_PLAY, SPR2_TRNS|FF_ANIMATE, 7, {NULL}, 0, 4, S_PLAY_NIGHTS_TRANS2}, // S_PLAY_NIGHTS_TRANS1
@ -1925,59 +1925,18 @@ state_t states[NUMSTATES] =
{SPR_BBLS, 3, 8, {A_BubbleCheck}, 0, 0, S_BUBBLES1}, // S_BUBBLES4 {SPR_BBLS, 3, 8, {A_BubbleCheck}, 0, 0, S_BUBBLES1}, // S_BUBBLES4
// Level End Sign // Level End Sign
{SPR_SIGN, 0, 1, {NULL}, 0, 0, S_SIGN2}, // S_SIGN1 {SPR_SIGN, 0, -1, {A_SignPlayer}, -3, 0, S_NULL}, // S_SIGN
{SPR_SIGN, 1, 1, {NULL}, 0, 0, S_SIGN3}, // S_SIGN2 {SPR_SIGN, 0, 1, {A_SignSpin}, 30, 0, S_SIGNSPIN2}, // S_SIGNSPIN1
{SPR_SIGN, 2, 1, {NULL}, 0, 0, S_SIGN4}, // S_SIGN3 {SPR_SIGN, 0, 0, {A_Repeat}, 4, S_SIGNSPIN1, S_SIGNSPIN3}, // S_SIGNSPIN2
{SPR_SIGN, 5, 1, {NULL}, 0, 0, S_SIGN5}, // S_SIGN4 {SPR_SIGN, 0, 0, {A_SignPlayer}, -2, 0, S_SIGNSPIN4}, // S_SIGNSPIN3
{SPR_SIGN, 0, 1, {NULL}, 0, 0, S_SIGN6}, // S_SIGN5 {SPR_SIGN, 0, 1, {A_SignSpin}, 30, 0, S_SIGNSPIN5}, // S_SIGNSPIN4
{SPR_SIGN, 1, 1, {NULL}, 0, 0, S_SIGN7}, // S_SIGN6 {SPR_SIGN, 0, 0, {A_Repeat}, 4, S_SIGNSPIN4, S_SIGNSPIN6}, // S_SIGNSPIN5
{SPR_SIGN, 2, 1, {NULL}, 0, 0, S_SIGN8}, // S_SIGN7 {SPR_SIGN, 0, 0, {A_SignPlayer}, -3, 0, S_SIGNSPIN1}, // S_SIGNSPIN6
{SPR_SIGN, 3, 1, {NULL}, 0, 0, S_SIGN9}, // S_SIGN8 {SPR_SIGN, 0, 1, {A_SignPlayer}, -1, 0, S_SIGNSLOW}, // S_SIGNPLAYER
{SPR_SIGN, 0, 1, {NULL}, 0, 0, S_SIGN10}, // S_SIGN9 {SPR_SIGN, 0, 1, {A_SignSpin}, 30, 0, S_SIGNSLOW}, // S_SIGNSLOW
{SPR_SIGN, 1, 1, {NULL}, 0, 0, S_SIGN11}, // S_SIGN10 {SPR_SIGN, 0, -1, {NULL}, 0, 0, S_NULL}, // S_SIGNSTOP
{SPR_SIGN, 2, 1, {NULL}, 0, 0, S_SIGN12}, // S_SIGN11 {SPR_SIGN, FF_PAPERSPRITE|2, -1, {NULL}, 0, 0, S_NULL}, // S_SIGNBOARD
{SPR_SIGN, 4, 1, {NULL}, 0, 0, S_SIGN13}, // S_SIGN12 {SPR_SIGN, FF_PAPERSPRITE|1, -1, {NULL}, 0, 29, S_NULL}, // S_EGGMANSIGN
{SPR_SIGN, 0, 1, {NULL}, 0, 0, S_SIGN14}, // S_SIGN13
{SPR_SIGN, 1, 1, {NULL}, 0, 0, S_SIGN15}, // S_SIGN14
{SPR_SIGN, 2, 1, {NULL}, 0, 0, S_SIGN16}, // S_SIGN15
{SPR_SIGN, 3, 1, {NULL}, 0, 0, S_SIGN17}, // S_SIGN16
{SPR_SIGN, 0, 1, {NULL}, 0, 0, S_SIGN18}, // S_SIGN17
{SPR_SIGN, 1, 1, {NULL}, 0, 0, S_SIGN19}, // S_SIGN18
{SPR_SIGN, 2, 1, {NULL}, 0, 0, S_SIGN20}, // S_SIGN19
{SPR_SIGN, 6, 1, {NULL}, 0, 0, S_SIGN21}, // S_SIGN20
{SPR_SIGN, 0, 1, {NULL}, 0, 0, S_SIGN22}, // S_SIGN21
{SPR_SIGN, 1, 1, {NULL}, 0, 0, S_SIGN23}, // S_SIGN22
{SPR_SIGN, 2, 1, {NULL}, 0, 0, S_SIGN24}, // S_SIGN23
{SPR_SIGN, 3, 1, {NULL}, 0, 0, S_SIGN25}, // S_SIGN24
{SPR_SIGN, 0, 1, {NULL}, 0, 0, S_SIGN26}, // S_SIGN25
{SPR_SIGN, 1, 1, {NULL}, 0, 0, S_SIGN27}, // S_SIGN26
{SPR_SIGN, 2, 1, {NULL}, 0, 0, S_SIGN28}, // S_SIGN27
{SPR_SIGN, 5, 1, {NULL}, 0, 0, S_SIGN29}, // S_SIGN28
{SPR_SIGN, 0, 1, {NULL}, 0, 0, S_SIGN30}, // S_SIGN29
{SPR_SIGN, 1, 1, {NULL}, 0, 0, S_SIGN31}, // S_SIGN30
{SPR_SIGN, 2, 1, {NULL}, 0, 0, S_SIGN32}, // S_SIGN31
{SPR_SIGN, 3, 1, {NULL}, 0, 0, S_SIGN33}, // S_SIGN32
{SPR_SIGN, 0, 1, {NULL}, 0, 0, S_SIGN34}, // S_SIGN33
{SPR_SIGN, 1, 1, {NULL}, 0, 0, S_SIGN35}, // S_SIGN34
{SPR_SIGN, 2, 1, {NULL}, 0, 0, S_SIGN36}, // S_SIGN35
{SPR_SIGN, 4, 1, {NULL}, 0, 0, S_SIGN37}, // S_SIGN36
{SPR_SIGN, 0, 1, {NULL}, 0, 0, S_SIGN38}, // S_SIGN37
{SPR_SIGN, 1, 1, {NULL}, 0, 0, S_SIGN39}, // S_SIGN38
{SPR_SIGN, 2, 1, {NULL}, 0, 0, S_SIGN40}, // S_SIGN39
{SPR_SIGN, 3, 1, {NULL}, 0, 0, S_SIGN41}, // S_SIGN40
{SPR_SIGN, 0, 1, {NULL}, 0, 0, S_SIGN42}, // S_SIGN41
{SPR_SIGN, 1, 1, {NULL}, 0, 0, S_SIGN43}, // S_SIGN42
{SPR_SIGN, 2, 1, {NULL}, 0, 0, S_SIGN44}, // S_SIGN43
{SPR_SIGN, 6, 1, {NULL}, 0, 0, S_SIGN45}, // S_SIGN44
{SPR_SIGN, 0, 1, {NULL}, 0, 0, S_SIGN46}, // S_SIGN45
{SPR_SIGN, 1, 1, {NULL}, 0, 0, S_SIGN47}, // S_SIGN46
{SPR_SIGN, 2, 1, {NULL}, 0, 0, S_SIGN48}, // S_SIGN47
{SPR_SIGN, 3, 1, {NULL}, 0, 0, S_SIGN49}, // S_SIGN48
{SPR_SIGN, 0, 1, {NULL}, 0, 0, S_SIGN50}, // S_SIGN49
{SPR_SIGN, 1, 1, {NULL}, 0, 0, S_SIGN51}, // S_SIGN50
{SPR_SIGN, 2, 1, {NULL}, 0, 0, S_SIGN53}, // S_SIGN51
{SPR_SIGN, 3, -1, {NULL}, 0, 0, S_NULL}, // S_SIGN52 Eggman
{SPR_SIGN, 7, -1, {A_SignPlayer}, 0, 0, S_NULL}, // S_SIGN53 Blank
// Spike Ball // Spike Ball
{SPR_SPIK, 0, 1, {NULL}, 0, 0, S_SPIKEBALL2}, // S_SPIKEBALL1 {SPR_SPIK, 0, 1, {NULL}, 0, 0, S_SPIKEBALL2}, // S_SPIKEBALL1
@ -5294,7 +5253,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
100, // mass 100, // mass
0, // damage 0, // damage
sfx_None, // activesound sfx_None, // activesound
MF_NOGRAVITY|MF_NOCLIPTHING|MF_NOBLOCKMAP|MF_RUNSPAWNFUNC, // flags MF_NOGRAVITY|MF_NOCLIPTHING|MF_NOBLOCKMAP|MF_RUNSPAWNFUNC|MF_SCENERY, // flags
S_NULL // raisestate S_NULL // raisestate
}, },
@ -5321,7 +5280,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
100, // mass 100, // mass
0, // damage 0, // damage
sfx_None, // activesound sfx_None, // activesound
MF_NOGRAVITY|MF_NOCLIPTHING|MF_NOBLOCKMAP|MF_RUNSPAWNFUNC, // flags MF_NOGRAVITY|MF_NOCLIPTHING|MF_NOBLOCKMAP|MF_RUNSPAWNFUNC|MF_SCENERY, // flags
S_NULL // raisestate S_NULL // raisestate
}, },
@ -7832,29 +7791,29 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
{ // MT_SIGN { // MT_SIGN
501, // doomednum 501, // doomednum
S_SIGN52, // spawnstate S_SIGN, // spawnstate
1000, // spawnhealth 1000, // spawnhealth
S_PLAY_SIGN, // seestate S_PLAY_SIGN, // seestate
sfx_lvpass, // seesound sfx_lvpass, // seesound
8, // reactiontime 8, // reactiontime
sfx_None, // attacksound sfx_None, // attacksound
S_NULL, // painstate S_SIGNPLAYER, // painstate
0, // painchance MT_SPARK, // painchance
sfx_None, // painsound sfx_None, // painsound
S_NULL, // meleestate S_EGGMANSIGN, // meleestate
S_NULL, // missilestate S_NULL, // missilestate
S_NULL, // deathstate S_SIGNSTOP, // deathstate
S_NULL, // xdeathstate S_NULL, // xdeathstate
sfx_None, // deathsound sfx_None, // deathsound
8, // speed 8, // speed
8*FRACUNIT, // radius 36*FRACUNIT, // radius
32*FRACUNIT, // height 32*FRACUNIT, // height
0, // display offset 0, // display offset
16, // mass 16, // mass
0, // damage 0, // damage
sfx_None, // activesound sfx_None, // activesound
MF_NOCLIP|MF_SCENERY, // flags MF_NOCLIP|MF_SCENERY|MF_BOUNCE|MF_RUNSPAWNFUNC, // flags
S_NULL // raisestate S_SIGNBOARD // raisestate
}, },
{ // MT_SPIKEBALL { // MT_SPIKEBALL
@ -13300,7 +13259,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL, // deathstate S_NULL, // deathstate
S_NULL, // xdeathstate S_NULL, // xdeathstate
sfx_None, // deathsound sfx_None, // deathsound
0, // speed 3200*FRACUNIT, // speed
30*FRACUNIT, // radius 30*FRACUNIT, // radius
32*FRACUNIT, // height 32*FRACUNIT, // height
1, // display offset 1, // display offset
@ -13388,7 +13347,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
100, // mass 100, // mass
0, // damage 0, // damage
sfx_None, // activesound sfx_None, // activesound
MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_SPAWNCEILING, // flags MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_SPAWNCEILING|MF_SCENERY, // flags
S_NULL // raisestate S_NULL // raisestate
}, },
@ -19038,7 +18997,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL, // deathstate S_NULL, // deathstate
S_PUMA_DOWN3, // xdeathstate S_PUMA_DOWN3, // xdeathstate
sfx_None, // deathsound sfx_None, // deathsound
0, // speed 2000*FRACUNIT, // speed
8*FRACUNIT, // radius 8*FRACUNIT, // radius
16*FRACUNIT, // height 16*FRACUNIT, // height
0, // display offset 0, // display offset
@ -19072,7 +19031,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
100, // mass 100, // mass
0, // damage 0, // damage
sfx_None, // activesound sfx_None, // activesound
MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY, // flags MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags
S_NULL // raisestate S_NULL // raisestate
}, },

View File

@ -63,6 +63,7 @@ void A_FishJump(); // Fish Jump
void A_ThrownRing(); // Sparkle trail for red ring void A_ThrownRing(); // Sparkle trail for red ring
void A_SetSolidSteam(); void A_SetSolidSteam();
void A_UnsetSolidSteam(); void A_UnsetSolidSteam();
void A_SignSpin();
void A_SignPlayer(); void A_SignPlayer();
void A_OverlayThink(); void A_OverlayThink();
void A_JetChase(); void A_JetChase();
@ -2058,59 +2059,18 @@ typedef enum state
S_BUBBLES4, S_BUBBLES4,
// Level End Sign // Level End Sign
S_SIGN1, S_SIGN,
S_SIGN2, S_SIGNSPIN1,
S_SIGN3, S_SIGNSPIN2,
S_SIGN4, S_SIGNSPIN3,
S_SIGN5, S_SIGNSPIN4,
S_SIGN6, S_SIGNSPIN5,
S_SIGN7, S_SIGNSPIN6,
S_SIGN8, S_SIGNPLAYER,
S_SIGN9, S_SIGNSLOW,
S_SIGN10, S_SIGNSTOP,
S_SIGN11, S_SIGNBOARD,
S_SIGN12, S_EGGMANSIGN,
S_SIGN13,
S_SIGN14,
S_SIGN15,
S_SIGN16,
S_SIGN17,
S_SIGN18,
S_SIGN19,
S_SIGN20,
S_SIGN21,
S_SIGN22,
S_SIGN23,
S_SIGN24,
S_SIGN25,
S_SIGN26,
S_SIGN27,
S_SIGN28,
S_SIGN29,
S_SIGN30,
S_SIGN31,
S_SIGN32,
S_SIGN33,
S_SIGN34,
S_SIGN35,
S_SIGN36,
S_SIGN37,
S_SIGN38,
S_SIGN39,
S_SIGN40,
S_SIGN41,
S_SIGN42,
S_SIGN43,
S_SIGN44,
S_SIGN45,
S_SIGN46,
S_SIGN47,
S_SIGN48,
S_SIGN49,
S_SIGN50,
S_SIGN51,
S_SIGN52, // Eggman
S_SIGN53,
// Spike Ball // Spike Ball
S_SPIKEBALL1, S_SPIKEBALL1,

View File

@ -2289,6 +2289,13 @@ void M_InitMenuPresTables(void)
// so-called "undefined" // so-called "undefined"
menupres[i].fadestrength = -1; menupres[i].fadestrength = -1;
menupres[i].hidetitlepics = -1; // inherits global hidetitlepics menupres[i].hidetitlepics = -1; // inherits global hidetitlepics
menupres[i].ttmode = TTMODE_NONE;
menupres[i].ttscale = UINT8_MAX;
menupres[i].ttname[0] = 0;
menupres[i].ttx = INT16_MAX;
menupres[i].tty = INT16_MAX;
menupres[i].ttloop = INT16_MAX;
menupres[i].tttics = UINT16_MAX;
menupres[i].enterwipe = -1; menupres[i].enterwipe = -1;
menupres[i].exitwipe = -1; menupres[i].exitwipe = -1;
menupres[i].bgcolor = -1; menupres[i].bgcolor = -1;
@ -2467,7 +2474,7 @@ static boolean MIT_SetCurFadeValue(UINT32 menutype, INT32 level, INT32 *retval,
return false; return false;
} }
static boolean MIT_SetCurHideTitlePics(UINT32 menutype, INT32 level, INT32 *retval, void **input, boolean fromoldest) static boolean MIT_SetCurTitlePics(UINT32 menutype, INT32 level, INT32 *retval, void **input, boolean fromoldest)
{ {
(void)input; (void)input;
(void)retval; (void)retval;
@ -2481,8 +2488,41 @@ static boolean MIT_SetCurHideTitlePics(UINT32 menutype, INT32 level, INT32 *retv
curhidepics = menupres[menutype].hidetitlepics; curhidepics = menupres[menutype].hidetitlepics;
return true; return true;
} }
else if (menupres[menutype].ttmode == TTMODE_USER)
{
if (menupres[menutype].ttname[0])
{
curhidepics = menupres[menutype].hidetitlepics;
curttmode = menupres[menutype].ttmode;
curttscale = (menupres[menutype].ttscale != UINT8_MAX ? menupres[menutype].ttscale : ttscale);
strncpy(curttname, menupres[menutype].ttname, 9);
curttx = (menupres[menutype].ttx != INT16_MAX ? menupres[menutype].ttx : ttx);
curtty = (menupres[menutype].tty != INT16_MAX ? menupres[menutype].tty : tty);
curttloop = (menupres[menutype].ttloop != INT16_MAX ? menupres[menutype].ttloop : ttloop);
curtttics = (menupres[menutype].tttics != UINT16_MAX ? menupres[menutype].tttics : tttics);
}
else
curhidepics = menupres[menutype].hidetitlepics;
return true;
}
else if (menupres[menutype].ttmode != TTMODE_NONE)
{
curhidepics = menupres[menutype].hidetitlepics;
curttmode = menupres[menutype].ttmode;
curttscale = (menupres[menutype].ttscale != UINT8_MAX ? menupres[menutype].ttscale : ttscale);
return true;
}
else if (!level) else if (!level)
{
curhidepics = hidetitlepics; curhidepics = hidetitlepics;
curttmode = ttmode;
curttscale = ttscale;
strncpy(curttname, ttname, 9);
curttx = ttx;
curtty = tty;
curttloop = ttloop;
curtttics = tttics;
}
return false; return false;
} }
@ -2527,9 +2567,9 @@ void M_SetMenuCurFadeValue(UINT8 defaultvalue)
M_IterateMenuTree(MIT_SetCurFadeValue, &defaultvalue); M_IterateMenuTree(MIT_SetCurFadeValue, &defaultvalue);
} }
void M_SetMenuCurHideTitlePics(void) void M_SetMenuCurTitlePics(void)
{ {
M_IterateMenuTree(MIT_SetCurHideTitlePics, NULL); M_IterateMenuTree(MIT_SetCurTitlePics, NULL);
} }
// ==================================== // ====================================
@ -2579,12 +2619,20 @@ static void M_HandleMenuPresState(menu_t *newMenu)
curbgyspeed = titlescrollyspeed; curbgyspeed = titlescrollyspeed;
curbghide = (gamestate != GS_TIMEATTACK); // show in time attack, hide in other menus curbghide = (gamestate != GS_TIMEATTACK); // show in time attack, hide in other menus
curttmode = ttmode;
curttscale = ttscale;
strncpy(curttname, ttname, 9);
curttx = ttx;
curtty = tty;
curttloop = ttloop;
curtttics = tttics;
// don't do the below during the in-game menus // don't do the below during the in-game menus
if (gamestate != GS_TITLESCREEN && gamestate != GS_TIMEATTACK) if (gamestate != GS_TITLESCREEN && gamestate != GS_TIMEATTACK)
return; return;
M_SetMenuCurFadeValue(16); M_SetMenuCurFadeValue(16);
M_SetMenuCurHideTitlePics(); M_SetMenuCurTitlePics();
// Loop through both menu IDs in parallel and look for type changes // Loop through both menu IDs in parallel and look for type changes
// The youngest child in activeMenuId is the entered menu // The youngest child in activeMenuId is the entered menu

View File

@ -18,6 +18,7 @@
#include "d_event.h" #include "d_event.h"
#include "command.h" #include "command.h"
#include "r_things.h" // for SKINNAMESIZE #include "r_things.h" // for SKINNAMESIZE
#include "f_finale.h" // for ttmode_enum
// //
// MENUS // MENUS
@ -128,19 +129,27 @@ typedef enum
typedef struct typedef struct
{ {
char bgname[8]; // name for background gfx lump; lays over titlemap if this is set char bgname[8]; // name for background gfx lump; lays over titlemap if this is set
SINT8 hidetitlepics; // hide title gfx per menu; -1 means undefined, inherits global setting SINT8 fadestrength; // darken background when displaying this menu, strength 0-31 or -1 for undefined
INT32 bgcolor; // fill color, overrides bg name. -1 means follow bg name rules.
INT32 titlescrollxspeed; // background gfx scroll per menu; inherits global setting INT32 titlescrollxspeed; // background gfx scroll per menu; inherits global setting
INT32 titlescrollyspeed; // y scroll INT32 titlescrollyspeed; // y scroll
INT32 bgcolor; // fill color, overrides bg name. -1 means follow bg name rules.
boolean bghide; // for titlemaps, hide the background. boolean bghide; // for titlemaps, hide the background.
SINT8 hidetitlepics; // hide title gfx per menu; -1 means undefined, inherits global setting
ttmode_enum ttmode; // title wing animation mode; default TTMODE_OLD
UINT8 ttscale; // scale of title wing gfx (FRACUNIT / ttscale); -1 means undefined, inherits global setting
char ttname[9]; // lump name of title wing gfx. If name length is <= 6, engine will attempt to load numbered frames (TTNAMExx)
INT16 ttx; // X position of title wing
INT16 tty; // Y position of title wing
INT16 ttloop; // # frame to loop; -1 means dont loop
UINT16 tttics; // # of tics per frame
char musname[7]; ///< Music track to play. "" for no music. char musname[7]; ///< Music track to play. "" for no music.
UINT16 mustrack; ///< Subsong to play. Only really relevant for music modules and specific formats supported by GME. 0 to ignore. UINT16 mustrack; ///< Subsong to play. Only really relevant for music modules and specific formats supported by GME. 0 to ignore.
boolean muslooping; ///< Loop the music boolean muslooping; ///< Loop the music
boolean musstop; ///< Don't play any music boolean musstop; ///< Don't play any music
boolean musignore; ///< Let the current music keep playing boolean musignore; ///< Let the current music keep playing
SINT8 fadestrength; // darken background when displaying this menu, strength 0-31 or -1 for undefined
boolean enterbubble; // run all entrance line execs after common ancestor and up to child. If false, only run the child's exec boolean enterbubble; // run all entrance line execs after common ancestor and up to child. If false, only run the child's exec
boolean exitbubble; // run all exit line execs from child and up to before common ancestor. If false, only run the child's exec boolean exitbubble; // run all exit line execs from child and up to before common ancestor. If false, only run the child's exec
INT32 entertag; // line exec to run on menu enter, if titlemap INT32 entertag; // line exec to run on menu enter, if titlemap
@ -158,7 +167,7 @@ UINT8 M_GetYoungestChildMenu(void);
void M_ChangeMenuMusic(const char *defaultmusname, boolean defaultmuslooping); void M_ChangeMenuMusic(const char *defaultmusname, boolean defaultmuslooping);
void M_SetMenuCurBackground(const char *defaultname); void M_SetMenuCurBackground(const char *defaultname);
void M_SetMenuCurFadeValue(UINT8 defaultvalue); void M_SetMenuCurFadeValue(UINT8 defaultvalue);
void M_SetMenuCurHideTitlePics(void); void M_SetMenuCurTitlePics(void);
// Called by main loop, // Called by main loop,
// saves config file and calls I_Quit when user exits. // saves config file and calls I_Quit when user exits.

View File

@ -129,6 +129,7 @@ void A_FishJump(mobj_t *actor);
void A_ThrownRing(mobj_t *actor); void A_ThrownRing(mobj_t *actor);
void A_SetSolidSteam(mobj_t *actor); void A_SetSolidSteam(mobj_t *actor);
void A_UnsetSolidSteam(mobj_t *actor); void A_UnsetSolidSteam(mobj_t *actor);
void A_SignSpin(mobj_t *actor);
void A_SignPlayer(mobj_t *actor); void A_SignPlayer(mobj_t *actor);
void A_OverlayThink(mobj_t *actor); void A_OverlayThink(mobj_t *actor);
void A_JetChase(mobj_t *actor); void A_JetChase(mobj_t *actor);
@ -4759,7 +4760,7 @@ void A_DropMine(mobj_t *actor)
// Description: Makes the stupid harmless fish in Greenflower Zone jump. // Description: Makes the stupid harmless fish in Greenflower Zone jump.
// //
// var1 = Jump strength (in FRACBITS), if specified. Otherwise, uses the angle value. // var1 = Jump strength (in FRACBITS), if specified. Otherwise, uses the angle value.
// var2 = unused // var2 = Trail object to spawn, if desired.
// //
void A_FishJump(mobj_t *actor) void A_FishJump(mobj_t *actor)
{ {
@ -4772,8 +4773,17 @@ void A_FishJump(mobj_t *actor)
if (locvar2) if (locvar2)
{ {
fixed_t rad = actor->radius>>FRACBITS; UINT8 i;
P_SpawnMobjFromMobj(actor, P_RandomRange(rad, -rad)<<FRACBITS, P_RandomRange(rad, -rad)<<FRACBITS, 0, (mobjtype_t)locvar2); // Don't spawn trail unless a player is nearby.
for (i = 0; i < MAXPLAYERS; ++i)
if (playeringame[i] && players[i].mo
&& P_AproxDistance(actor->x - players[i].mo->x, actor->y - players[i].mo->y) < (actor->info->speed))
break; // Stop looking.
if (i < MAXPLAYERS)
{
fixed_t rad = actor->radius>>FRACBITS;
P_SpawnMobjFromMobj(actor, P_RandomRange(rad, -rad)<<FRACBITS, P_RandomRange(rad, -rad)<<FRACBITS, 0, (mobjtype_t)locvar2);
}
} }
if ((actor->z <= actor->floorz) || (actor->z <= actor->watertop - FixedMul((64 << FRACBITS), actor->scale))) if ((actor->z <= actor->floorz) || (actor->z <= actor->watertop - FixedMul((64 << FRACBITS), actor->scale)))
@ -5006,59 +5016,186 @@ void A_UnsetSolidSteam(mobj_t *actor)
actor->flags |= MF_NOCLIP; actor->flags |= MF_NOCLIP;
} }
// Function: A_SignSpin
//
// Description: Spins a signpost until it hits the ground and reaches its mapthing's angle.
//
// var1 = degrees to rotate object (must be positive, because I'm lazy)
// var2 = unused
//
void A_SignSpin(mobj_t *actor)
{
INT32 locvar1 = var1;
INT32 locvar2 = var2;
INT16 i;
angle_t rotateangle = FixedAngle(locvar1 << FRACBITS);
#ifdef HAVE_BLUA
if (LUA_CallAction("A_SignSpin", actor))
return;
#endif
if (P_IsObjectOnGround(actor) && P_MobjFlip(actor) * actor->momz <= 0)
{
if (actor->spawnpoint)
{
angle_t mapangle = FixedAngle(actor->spawnpoint->angle << FRACBITS);
angle_t diff = mapangle - actor->angle;
if (diff < ANG2)
{
actor->angle = mapangle;
P_SetMobjState(actor, actor->info->deathstate);
return;
}
if ((statenum_t)(actor->state-states) != actor->info->painstate)
P_SetMobjState(actor, actor->info->painstate);
actor->movedir = min((mapangle - actor->angle) >> 2, actor->movedir);
}
else // no mapthing? just finish in your current angle
{
P_SetMobjState(actor, locvar2);
return;
}
}
else
{
actor->movedir = rotateangle;
}
actor->angle += actor->movedir;
if (actor->tracer == NULL || P_MobjWasRemoved(actor->tracer)) return;
for (i = -1; i < 2; i += 2)
{
P_SpawnMobjFromMobj(actor,
P_ReturnThrustX(actor, actor->tracer->angle, i * actor->radius),
P_ReturnThrustY(actor, actor->tracer->angle, i * actor->radius),
(actor->eflags & MFE_VERTICALFLIP) ? 0 : actor->height,
actor->info->painchance)->destscale >>= 1;
}
}
// Function: A_SignPlayer // Function: A_SignPlayer
// //
// Description: Changes the state of a level end sign to reflect the player that hit it. // Description: Changes the state of a level end sign to reflect the player that hit it.
// Also used to display Eggman or the skin roulette whilst spinning.
// //
// var1 = unused // var1 = number of skin to display (e.g. 2 = Knuckles; special cases: -1 = target's skin, -2 = skin roulette, -3 = Eggman)
// var2 = unused // var2 = custom sign color, if desired.
// //
void A_SignPlayer(mobj_t *actor) void A_SignPlayer(mobj_t *actor)
{ {
INT32 locvar1 = var1;
INT32 locvar2 = var2;
skin_t *skin = NULL;
mobj_t *ov; mobj_t *ov;
skin_t *skin; UINT8 facecolor, signcolor = (UINT8)locvar2;
UINT32 signframe = states[actor->info->raisestate].frame;
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
if (LUA_CallAction("A_SignPlayer", actor)) if (LUA_CallAction("A_SignPlayer", actor))
return; return;
#endif #endif
if (!actor->target)
if (actor->tracer == NULL || locvar1 < -3 || locvar1 >= numskins)
return; return;
if (!actor->target->player) // if no face overlay, spawn one
return; if (actor->tracer->tracer == NULL || P_MobjWasRemoved(actor->tracer->tracer))
skin = &skins[actor->target->player->skin];
if ((actor->target->player->skincolor == skin->prefcolor) && (skin->prefoppositecolor)) // Set it as the skin's preferred oppositecolor?
{ {
actor->color = skin->prefoppositecolor;
/*
If you're here from the comment above Color_Opposite,
the following line is the one which is dependent on the
array being symmetrical. It gets the opposite of the
opposite of your desired colour just so it can get the
brightness frame for the End Sign. It's not a great
design choice, but it's constant time array access and
the idea that the colours should be OPPOSITES is kind
of in the name. If you have a better idea, feel free
to let me know. ~toast 2016/07/20
*/
actor->frame += (15 - Color_Opposite[Color_Opposite[skin->prefoppositecolor - 1][0] - 1][1]);
}
else if (actor->target->player->skincolor) // Set the sign to be an appropriate background color for this player's skincolor.
{
actor->color = Color_Opposite[actor->target->player->skincolor - 1][0];
actor->frame += (15 - Color_Opposite[actor->target->player->skincolor - 1][1]);
}
if (skin->sprites[SPR2_SIGN].numframes)
{
// spawn an overlay of the player's face.
ov = P_SpawnMobj(actor->x, actor->y, actor->z, MT_OVERLAY); ov = P_SpawnMobj(actor->x, actor->y, actor->z, MT_OVERLAY);
P_SetTarget(&ov->target, actor); P_SetTarget(&ov->target, actor->tracer);
ov->color = actor->target->player->skincolor; P_SetTarget(&actor->tracer->tracer, ov);
}
else
ov = actor->tracer->tracer;
if (locvar1 == -1) // set to target's skin
{
if (!actor->target)
return;
if (!actor->target->player)
return;
skin = &skins[actor->target->player->skin];
facecolor = actor->target->player->skincolor;
if (signcolor)
;
else if ((actor->target->player->skincolor == skin->prefcolor) && (skin->prefoppositecolor)) // Set it as the skin's preferred oppositecolor?
{
signcolor = skin->prefoppositecolor;
/*
If you're here from the comment above Color_Opposite,
the following line is the one which is dependent on the
array being symmetrical. It gets the opposite of the
opposite of your desired colour just so it can get the
brightness frame for the End Sign. It's not a great
design choice, but it's constant time array access and
the idea that the colours should be OPPOSITES is kind
of in the name. If you have a better idea, feel free
to let me know. ~toast 2016/07/20
*/
signframe += (15 - Color_Opposite[Color_Opposite[skin->prefoppositecolor - 1][0] - 1][1]);
}
else if (actor->target->player->skincolor) // Set the sign to be an appropriate background color for this player's skincolor.
{
signcolor = Color_Opposite[actor->target->player->skincolor - 1][0];
signframe += (15 - Color_Opposite[actor->target->player->skincolor - 1][1]);
}
else
signcolor = SKINCOLOR_NONE;
}
else if (locvar1 != -3) // set to a defined skin
{
// I turned this function into a fucking mess. I'm so sorry. -Lach
if (locvar1 == -2) // next skin
{
if (ov->skin == NULL) // pick a random skin to start with!
skin = &skins[P_RandomKey(numskins)];
else // otherwise, advance 1 skin
{
UINT8 skinnum = (skin_t*)ov->skin-skins;
player_t *player = actor->target ? actor->target->player : NULL;
while ((skinnum = (skinnum + 1) % numskins) && (player ? !R_SkinUsable(player-players, skinnum) : skins[skinnum].availability > 0));
skin = &skins[skinnum];
}
}
else // specific skin
{
skin = &skins[locvar1];
}
facecolor = skin->prefcolor;
if (signcolor)
;
else if (skin->prefoppositecolor)
{
signcolor = skin->prefoppositecolor;
}
else
{
signcolor = Color_Opposite[facecolor - 1][0];
}
signframe += (15 - Color_Opposite[Color_Opposite[signcolor - 1][0] - 1][1]);
}
if (skin != NULL && skin->sprites[SPR2_SIGN].numframes) // player face
{
ov->color = facecolor;
ov->skin = skin; ov->skin = skin;
P_SetMobjState(ov, actor->info->seestate); // S_PLAY_SIGN P_SetMobjState(ov, actor->info->seestate); // S_PLAY_SIGN
actor->tracer->color = signcolor;
actor->tracer->frame = signframe;
}
else // Eggman face
{
ov->color = SKINCOLOR_NONE;
P_SetMobjState(ov, actor->info->meleestate); // S_EGGMANSIGN
if (signcolor)
actor->tracer->color = signcolor;
else
actor->tracer->color = signcolor = SKINCOLOR_CARBON;
actor->tracer->frame = signframe += (15 - Color_Opposite[Color_Opposite[signcolor - 1][0] - 1][1]);
} }
} }
@ -5106,7 +5243,7 @@ void A_OverlayThink(mobj_t *actor)
actor->z = actor->target->z + actor->target->height - mobjinfo[actor->type].height - ((var2>>16) ? -1 : 1)*(var2&0xFFFF)*FRACUNIT; actor->z = actor->target->z + actor->target->height - mobjinfo[actor->type].height - ((var2>>16) ? -1 : 1)*(var2&0xFFFF)*FRACUNIT;
else else
actor->z = actor->target->z + ((var2>>16) ? -1 : 1)*(var2&0xFFFF)*FRACUNIT; actor->z = actor->target->z + ((var2>>16) ? -1 : 1)*(var2&0xFFFF)*FRACUNIT;
actor->angle = actor->target->angle; actor->angle = actor->target->angle + actor->movedir;
actor->eflags = actor->target->eflags; actor->eflags = actor->target->eflags;
actor->momx = actor->target->momx; actor->momx = actor->target->momx;
@ -14024,7 +14161,7 @@ void A_LavafallRocks(mobj_t *actor)
// Don't spawn rocks unless a player is relatively close by. // Don't spawn rocks unless a player is relatively close by.
for (i = 0; i < MAXPLAYERS; ++i) for (i = 0; i < MAXPLAYERS; ++i)
if (playeringame[i] && players[i].mo if (playeringame[i] && players[i].mo
&& P_AproxDistance(actor->x - players[i].mo->x, actor->y - players[i].mo->y) < (1600 << FRACBITS)) && P_AproxDistance(actor->x - players[i].mo->x, actor->y - players[i].mo->y) < (actor->info->speed >> 1))
break; // Stop looking. break; // Stop looking.
if (i < MAXPLAYERS) if (i < MAXPLAYERS)
@ -14047,6 +14184,7 @@ void A_LavafallRocks(mobj_t *actor)
void A_LavafallLava(mobj_t *actor) void A_LavafallLava(mobj_t *actor)
{ {
mobj_t *lavafall; mobj_t *lavafall;
UINT8 i;
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
if (LUA_CallAction("A_LavafallLava", actor)) if (LUA_CallAction("A_LavafallLava", actor))
@ -14056,6 +14194,15 @@ void A_LavafallLava(mobj_t *actor)
if ((40 - actor->fuse) % (2*(actor->scale >> FRACBITS))) if ((40 - actor->fuse) % (2*(actor->scale >> FRACBITS)))
return; return;
// Don't spawn lava unless a player is nearby.
for (i = 0; i < MAXPLAYERS; ++i)
if (playeringame[i] && players[i].mo
&& P_AproxDistance(actor->x - players[i].mo->x, actor->y - players[i].mo->y) < (actor->info->speed))
break; // Stop looking.
if (i >= MAXPLAYERS)
return;
lavafall = P_SpawnMobjFromMobj(actor, 0, 0, -8*FRACUNIT, MT_LAVAFALL_LAVA); lavafall = P_SpawnMobjFromMobj(actor, 0, 0, -8*FRACUNIT, MT_LAVAFALL_LAVA);
lavafall->momz = -P_MobjFlip(actor)*25*FRACUNIT; lavafall->momz = -P_MobjFlip(actor)*25*FRACUNIT;
} }

View File

@ -633,7 +633,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (!(netgame || multiplayer)) if (!(netgame || multiplayer))
{ {
player->continues += 1; player->continues += 1;
players->gotcontinue = true; player->gotcontinue = true;
if (P_IsLocalPlayer(player)) if (P_IsLocalPlayer(player))
S_StartSound(NULL, sfx_s3kac); S_StartSound(NULL, sfx_s3kac);
else else
@ -2482,6 +2482,8 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
P_UnsetThingPosition(target); P_UnsetThingPosition(target);
target->flags |= MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY; target->flags |= MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY;
P_SetThingPosition(target); P_SetThingPosition(target);
target->standingslope = NULL;
target->pmomz = 0;
if (target->player->powers[pw_super]) if (target->player->powers[pw_super])
{ {

View File

@ -540,7 +540,7 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
static void P_DoPterabyteCarry(player_t *player, mobj_t *ptera) static void P_DoPterabyteCarry(player_t *player, mobj_t *ptera)
{ {
if (player->powers[pw_carry] && players->powers[pw_carry] != CR_ROLLOUT) if (player->powers[pw_carry] && player->powers[pw_carry] != CR_ROLLOUT)
return; return;
if (ptera->extravalue1 != 1) if (ptera->extravalue1 != 1)
return; // Not swooping return; // Not swooping

View File

@ -1861,6 +1861,9 @@ void P_XYMovement(mobj_t *mo)
oldy = mo->y; oldy = mo->y;
#ifdef ESLOPE #ifdef ESLOPE
if (mo->flags & MF_NOCLIPHEIGHT)
mo->standingslope = NULL;
// adjust various things based on slope // adjust various things based on slope
if (mo->standingslope && abs(mo->standingslope->zdelta) > FRACUNIT>>8) { if (mo->standingslope && abs(mo->standingslope->zdelta) > FRACUNIT>>8) {
if (!P_IsObjectOnGround(mo)) { // We fell off at some point? Do the twisty thing! if (!P_IsObjectOnGround(mo)) { // We fell off at some point? Do the twisty thing!
@ -1991,7 +1994,7 @@ void P_XYMovement(mobj_t *mo)
mo->momz = transfermomz; mo->momz = transfermomz;
mo->standingslope = NULL; mo->standingslope = NULL;
if (player->pflags & PF_SPINNING) if (player->pflags & PF_SPINNING)
player->pflags = (player->pflags & ~PF_SPINNING) | (PF_JUMPED | PF_THOKKED); player->pflags |= PF_THOKKED;
} }
} }
#endif #endif
@ -2051,7 +2054,7 @@ void P_XYMovement(mobj_t *mo)
return; return;
#ifdef ESLOPE #ifdef ESLOPE
if (moved && oldslope) { // Check to see if we ran off if (moved && oldslope && !(mo->flags & MF_NOCLIPHEIGHT)) { // Check to see if we ran off
if (oldslope != mo->standingslope) { // First, compare different slopes if (oldslope != mo->standingslope) { // First, compare different slopes
angle_t oldangle, newangle; angle_t oldangle, newangle;
@ -2459,16 +2462,6 @@ static boolean P_ZMovement(mobj_t *mo)
P_RemoveMobj(mo); P_RemoveMobj(mo);
return false; return false;
} }
if (mo->momz
&& !(mo->flags & MF_NOGRAVITY)
&& ((!(mo->eflags & MFE_VERTICALFLIP) && mo->z <= mo->floorz)
|| ((mo->eflags & MFE_VERTICALFLIP) && mo->z+mo->height >= mo->ceilingz)))
{
mo->flags |= MF_NOGRAVITY;
mo->momx = 8; // this is a hack which is used to ensure it still behaves as a missile and can damage others
mo->momy = mo->momz = 0;
mo->z = ((mo->eflags & MFE_VERTICALFLIP) ? mo->ceilingz-mo->height : mo->floorz);
}
break; break;
case MT_GOOP: case MT_GOOP:
if (P_CheckDeathPitCollide(mo)) if (P_CheckDeathPitCollide(mo))
@ -3314,7 +3307,7 @@ void P_MobjCheckWater(mobj_t *mobj)
ffloor_t *rover; ffloor_t *rover;
player_t *p = mobj->player; // Will just be null if not a player. player_t *p = mobj->player; // Will just be null if not a player.
fixed_t height = (p ? P_GetPlayerHeight(p) : mobj->height); // for players, calculation height does not necessarily match actual height for gameplay reasons (spin, etc) fixed_t height = (p ? P_GetPlayerHeight(p) : mobj->height); // for players, calculation height does not necessarily match actual height for gameplay reasons (spin, etc)
boolean wasgroundpounding = (p && (mobj->eflags & MFE_GOOWATER) && ((p->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL || (p->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP) && (p->pflags & PF_SHIELDABILITY)); boolean wasgroundpounding = (p && ((p->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL || (p->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP) && (p->pflags & PF_SHIELDABILITY));
// Default if no water exists. // Default if no water exists.
mobj->watertop = mobj->waterbottom = mobj->z - 1000*FRACUNIT; mobj->watertop = mobj->waterbottom = mobj->z - 1000*FRACUNIT;
@ -3414,7 +3407,7 @@ void P_MobjCheckWater(mobj_t *mobj)
p->powers[pw_underwater] = underwatertics + 1; p->powers[pw_underwater] = underwatertics + 1;
} }
if (wasgroundpounding) if ((wasgroundpounding = ((mobj->eflags & MFE_GOOWATER) && wasgroundpounding)))
{ {
p->pflags &= ~PF_SHIELDABILITY; p->pflags &= ~PF_SHIELDABILITY;
mobj->momz >>= 1; mobj->momz >>= 1;
@ -6914,7 +6907,7 @@ void P_RunOverlays(void)
mo->eflags = (mo->eflags & ~MFE_VERTICALFLIP) | (mo->target->eflags & MFE_VERTICALFLIP); mo->eflags = (mo->eflags & ~MFE_VERTICALFLIP) | (mo->target->eflags & MFE_VERTICALFLIP);
mo->scale = mo->destscale = mo->target->scale; mo->scale = mo->destscale = mo->target->scale;
mo->angle = mo->target->angle; mo->angle = mo->target->angle + mo->movedir;
if (!(mo->state->frame & FF_ANIMATE)) if (!(mo->state->frame & FF_ANIMATE))
zoffs = FixedMul(((signed)mo->state->var2)*FRACUNIT, mo->scale); zoffs = FixedMul(((signed)mo->state->var2)*FRACUNIT, mo->scale);
@ -9436,6 +9429,13 @@ void P_MobjThinker(mobj_t *mobj)
hdist = R_PointToDist2(mobj->x, mobj->y, mobj->target->x, mobj->target->y); hdist = R_PointToDist2(mobj->x, mobj->y, mobj->target->x, mobj->target->y);
if (hdist > 1500*FRACUNIT)
{
mobj->flags2 &= ~MF2_BOSSNOTRAP;
P_SetTarget(&mobj->target, NULL);
break;
}
if (!(mobj->flags2 & MF2_BOSSNOTRAP) && hdist <= 450*FRACUNIT) if (!(mobj->flags2 & MF2_BOSSNOTRAP) && hdist <= 450*FRACUNIT)
mobj->flags2 |= MF2_BOSSNOTRAP; mobj->flags2 |= MF2_BOSSNOTRAP;
@ -9455,11 +9455,6 @@ void P_MobjThinker(mobj_t *mobj)
mobj->momx = 0; mobj->momx = 0;
mobj->momy = 0; mobj->momy = 0;
mobj->momz = 0; mobj->momz = 0;
if (hdist >= 1500*FRACUNIT)
{
mobj->flags2 &= ~MF2_BOSSNOTRAP;
P_SetTarget(&mobj->target, NULL);
}
} }
break; break;
} }
@ -9569,6 +9564,14 @@ void P_MobjThinker(mobj_t *mobj)
else else
mobj->z = mobj->floorz; mobj->z = mobj->floorz;
} }
else if ((!(mobj->eflags & MFE_VERTICALFLIP) && mobj->z <= mobj->floorz)
|| ((mobj->eflags & MFE_VERTICALFLIP) && mobj->z+mobj->height >= mobj->ceilingz))
{
mobj->flags |= MF_NOGRAVITY;
mobj->momx = 8; // this is a hack which is used to ensure it still behaves as a missile and can damage others
mobj->momy = mobj->momz = 0;
mobj->z = ((mobj->eflags & MFE_VERTICALFLIP) ? mobj->ceilingz-mobj->height : mobj->floorz);
}
/* FALLTHRU */ /* FALLTHRU */
default: default:
// check mobj against possible water content, before movement code // check mobj against possible water content, before movement code
@ -10441,6 +10444,11 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
mobj->extravalue2 = 0; mobj->extravalue2 = 0;
mobj->fuse = 100; mobj->fuse = 100;
break; break;
case MT_SIGN:
P_SetTarget(&mobj->tracer, P_SpawnMobjFromMobj(mobj, 0, 0, 0, MT_OVERLAY));
P_SetTarget(&mobj->tracer->target, mobj);
P_SetMobjState(mobj->tracer, S_SIGNBOARD);
mobj->tracer->movedir = ANGLE_90;
default: default:
break; break;
} }

View File

@ -4054,11 +4054,15 @@ void P_SetupSignExit(player_t *player)
if (thing->type != MT_SIGN) if (thing->type != MT_SIGN)
continue; continue;
if (!player->mo->target || player->mo->target->type != MT_SIGN)
P_SetTarget(&player->mo->target, thing);
if (thing->state != &states[thing->info->spawnstate]) if (thing->state != &states[thing->info->spawnstate])
continue; continue;
P_SetTarget(&thing->target, player->mo); P_SetTarget(&thing->target, player->mo);
P_SetMobjState(thing, S_SIGN1); P_SetObjectMomZ(thing, 12*FRACUNIT, false);
P_SetMobjState(thing, S_SIGNSPIN1);
if (thing->info->seesound) if (thing->info->seesound)
S_StartSound(thing, thing->info->seesound); S_StartSound(thing, thing->info->seesound);
@ -4079,11 +4083,15 @@ void P_SetupSignExit(player_t *player)
if (thing->type != MT_SIGN) if (thing->type != MT_SIGN)
continue; continue;
if (!player->mo->target || player->mo->target->type != MT_SIGN)
P_SetTarget(&player->mo->target, thing);
if (thing->state != &states[thing->info->spawnstate]) if (thing->state != &states[thing->info->spawnstate])
continue; continue;
P_SetTarget(&thing->target, player->mo); P_SetTarget(&thing->target, player->mo);
P_SetMobjState(thing, S_SIGN1); P_SetObjectMomZ(thing, 12*FRACUNIT, false);
P_SetMobjState(thing, S_SIGNSPIN1);
if (thing->info->seesound) if (thing->info->seesound)
S_StartSound(thing, thing->info->seesound); S_StartSound(thing, thing->info->seesound);

View File

@ -1240,6 +1240,8 @@ void P_GivePlayerLives(player_t *player, INT32 numlives)
numlives = (numlives + prevlives - player->lives); numlives = (numlives + prevlives - player->lives);
} }
} }
else if (player->lives == INFLIVES)
return;
player->lives += numlives; player->lives += numlives;
@ -2225,8 +2227,8 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff)
{ {
if (dorollstuff) if (dorollstuff)
{ {
if ((player->charability2 == CA2_SPINDASH) && !(player->pflags & PF_THOKKED) && (player->cmd.buttons & BT_USE) && (FixedHypot(player->mo->momx, player->mo->momy) > (5*player->mo->scale))) if ((player->charability2 == CA2_SPINDASH) && !((player->pflags & (PF_SPINNING|PF_THOKKED)) == PF_THOKKED) && (player->cmd.buttons & BT_USE) && (FixedHypot(player->mo->momx, player->mo->momy) > (5*player->mo->scale)))
player->pflags |= PF_SPINNING; player->pflags = (player->pflags|PF_SPINNING) & ~PF_THOKKED;
else if (!(player->pflags & PF_STARTDASH)) else if (!(player->pflags & PF_STARTDASH))
player->pflags &= ~PF_SPINNING; player->pflags &= ~PF_SPINNING;
} }
@ -5767,7 +5769,7 @@ static void P_2dMovement(player_t *player)
movepushforward >>= 1; // Proper air movement movepushforward >>= 1; // Proper air movement
// Allow a bit of movement while spinning // Allow a bit of movement while spinning
if (player->pflags & PF_SPINNING) if ((player->pflags & (PF_SPINNING|PF_THOKKED)) == PF_SPINNING)
{ {
if (!(player->pflags & PF_STARTDASH)) if (!(player->pflags & PF_STARTDASH))
movepushforward = movepushforward/48; movepushforward = movepushforward/48;
@ -5794,7 +5796,7 @@ static void P_3dMovement(player_t *player)
angle_t dangle; // replaces old quadrants bits angle_t dangle; // replaces old quadrants bits
fixed_t normalspd = FixedMul(player->normalspeed, player->mo->scale); fixed_t normalspd = FixedMul(player->normalspeed, player->mo->scale);
boolean analogmove = false; boolean analogmove = false;
boolean spin = ((onground = P_IsObjectOnGround(player->mo)) && player->pflags & PF_SPINNING && (player->rmomx || player->rmomy) && !(player->pflags & PF_STARTDASH)); boolean spin = ((onground = P_IsObjectOnGround(player->mo)) && (player->pflags & (PF_SPINNING|PF_THOKKED)) == PF_SPINNING && (player->rmomx || player->rmomy) && !(player->pflags & PF_STARTDASH));
fixed_t oldMagnitude, newMagnitude; fixed_t oldMagnitude, newMagnitude;
#ifdef ESLOPE #ifdef ESLOPE
vector3_t totalthrust; vector3_t totalthrust;
@ -5979,7 +5981,7 @@ static void P_3dMovement(player_t *player)
movepushforward = cmd->forwardmove * (thrustfactor * acceleration); movepushforward = cmd->forwardmove * (thrustfactor * acceleration);
// Allow a bit of movement while spinning // Allow a bit of movement while spinning
if (player->pflags & PF_SPINNING) if ((player->pflags & (PF_SPINNING|PF_THOKKED)) == PF_SPINNING)
{ {
if ((mforward && cmd->forwardmove > 0) || (mbackward && cmd->forwardmove < 0) if ((mforward && cmd->forwardmove > 0) || (mbackward && cmd->forwardmove < 0)
|| (player->pflags & PF_STARTDASH)) || (player->pflags & PF_STARTDASH))
@ -6020,7 +6022,7 @@ static void P_3dMovement(player_t *player)
movepushforward = max(abs(cmd->sidemove), abs(cmd->forwardmove)) * (thrustfactor * acceleration); movepushforward = max(abs(cmd->sidemove), abs(cmd->forwardmove)) * (thrustfactor * acceleration);
// Allow a bit of movement while spinning // Allow a bit of movement while spinning
if (player->pflags & PF_SPINNING) if ((player->pflags & (PF_SPINNING|PF_THOKKED)) == PF_SPINNING)
{ {
if ((mforward && cmd->forwardmove > 0) || (mbackward && cmd->forwardmove < 0) if ((mforward && cmd->forwardmove > 0) || (mbackward && cmd->forwardmove < 0)
|| (player->pflags & PF_STARTDASH)) || (player->pflags & PF_STARTDASH))
@ -6055,11 +6057,11 @@ static void P_3dMovement(player_t *player)
{ {
movepushside >>= 2; // proper air movement movepushside >>= 2; // proper air movement
// Reduce movepushslide even more if over "max" flight speed // Reduce movepushslide even more if over "max" flight speed
if ((player->pflags & PF_SPINNING) || (player->powers[pw_tailsfly] && player->speed > topspeed)) if (((player->pflags & (PF_SPINNING|PF_THOKKED)) == PF_SPINNING) || (player->powers[pw_tailsfly] && player->speed > topspeed))
movepushside >>= 2; movepushside >>= 2;
} }
// Allow a bit of movement while spinning // Allow a bit of movement while spinning
else if (player->pflags & PF_SPINNING) else if ((player->pflags & (PF_SPINNING|PF_THOKKED)) == PF_SPINNING)
{ {
if (player->pflags & PF_STARTDASH) if (player->pflags & PF_STARTDASH)
movepushside = 0; movepushside = 0;
@ -8598,6 +8600,9 @@ static void P_MovePlayer(player_t *player)
// Look for Quicksand! // Look for Quicksand!
if (CheckForQuicksand) if (CheckForQuicksand)
P_CheckQuicksand(player); P_CheckQuicksand(player);
if (P_IsObjectOnGround(player->mo))
player->mo->pmomz = 0;
} }
static void P_DoZoomTube(player_t *player) static void P_DoZoomTube(player_t *player)
@ -9501,7 +9506,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
fixed_t x, y, z, dist, distxy, distz, checkdist, viewpointx, viewpointy, camspeed, camdist, camheight, pviewheight, slopez = 0; fixed_t x, y, z, dist, distxy, distz, checkdist, viewpointx, viewpointy, camspeed, camdist, camheight, pviewheight, slopez = 0;
INT32 camrotate; INT32 camrotate;
boolean camstill, cameranoclip, camorbit; boolean camstill, cameranoclip, camorbit;
mobj_t *mo; mobj_t *mo, *sign = NULL;
subsector_t *newsubsec; subsector_t *newsubsec;
fixed_t f1, f2; fixed_t f1, f2;
@ -9511,6 +9516,9 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
mo = player->mo; mo = player->mo;
if (player->exiting && mo->target && mo->target->type == MT_SIGN)
sign = mo->target;
cameranoclip = (player->powers[pw_carry] == CR_NIGHTSMODE || player->pflags & PF_NOCLIP) || (mo->flags & (MF_NOCLIP|MF_NOCLIPHEIGHT)); // Noclipping player camera noclips too!! cameranoclip = (player->powers[pw_carry] == CR_NIGHTSMODE || player->pflags & PF_NOCLIP) || (mo->flags & (MF_NOCLIP|MF_NOCLIPHEIGHT)); // Noclipping player camera noclips too!!
if (!(player->climbing || (player->powers[pw_carry] == CR_NIGHTSMODE) || player->playerstate == PST_DEAD || tutorialmode)) if (!(player->climbing || (player->powers[pw_carry] == CR_NIGHTSMODE) || player->playerstate == PST_DEAD || tutorialmode))
@ -9557,6 +9565,11 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
focusangle = mo->angle; focusangle = mo->angle;
focusaiming = 0; focusaiming = 0;
} }
else if (sign)
{
focusangle = FixedAngle(sign->spawnpoint->angle << FRACBITS) + ANGLE_180;
focusaiming = 0;
}
else if (player == &players[consoleplayer]) else if (player == &players[consoleplayer])
{ {
focusangle = localangle; focusangle = localangle;
@ -9705,6 +9718,12 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
camheight = FixedMul(camheight, 6*FRACUNIT/5); camheight = FixedMul(camheight, 6*FRACUNIT/5);
} }
if (sign)
{
camheight = mo->scale << 7;
camspeed = FRACUNIT/12;
}
if (player->climbing || player->exiting || player->playerstate == PST_DEAD || (player->powers[pw_carry] == CR_ROPEHANG || player->powers[pw_carry] == CR_GENERIC || player->powers[pw_carry] == CR_MACESPIN)) if (player->climbing || player->exiting || player->playerstate == PST_DEAD || (player->powers[pw_carry] == CR_ROPEHANG || player->powers[pw_carry] == CR_GENERIC || player->powers[pw_carry] == CR_MACESPIN))
dist <<= 1; dist <<= 1;
} }
@ -9751,8 +9770,16 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
distz = slopez; distz = slopez;
} }
x = mo->x - FixedMul(FINECOSINE((angle>>ANGLETOFINESHIFT) & FINEMASK), distxy); if (sign)
y = mo->y - FixedMul(FINESINE((angle>>ANGLETOFINESHIFT) & FINEMASK), distxy); {
x = sign->x - FixedMul(FINECOSINE((angle>>ANGLETOFINESHIFT) & FINEMASK), distxy);
y = sign->y - FixedMul(FINESINE((angle>>ANGLETOFINESHIFT) & FINEMASK), distxy);
}
else
{
x = mo->x - FixedMul(FINECOSINE((angle>>ANGLETOFINESHIFT) & FINEMASK), distxy);
y = mo->y - FixedMul(FINESINE((angle>>ANGLETOFINESHIFT) & FINEMASK), distxy);
}
#if 0 #if 0
if (twodlevel || (mo->flags2 & MF2_TWOD)) if (twodlevel || (mo->flags2 & MF2_TWOD))
@ -9997,14 +10024,30 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
// point viewed by the camera // point viewed by the camera
// this point is just 64 unit forward the player // this point is just 64 unit forward the player
dist = FixedMul(64 << FRACBITS, mo->scale); dist = FixedMul(64 << FRACBITS, mo->scale);
viewpointx = mo->x + FixedMul(FINECOSINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist); if (sign)
viewpointy = mo->y + FixedMul(FINESINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist); {
viewpointx = sign->x + FixedMul(FINECOSINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist);
viewpointy = sign->y + FixedMul(FINESINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist);
}
else
{
viewpointx = mo->x + FixedMul(FINECOSINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist);
viewpointy = mo->y + FixedMul(FINESINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist);
}
if (!camstill && !resetcalled && !paused) if (!camstill && !resetcalled && !paused)
thiscam->angle = R_PointToAngle2(thiscam->x, thiscam->y, viewpointx, viewpointy); thiscam->angle = R_PointToAngle2(thiscam->x, thiscam->y, viewpointx, viewpointy);
viewpointx = mo->x + FixedMul(FINECOSINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist); if (sign)
viewpointy = mo->y + FixedMul(FINESINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist); {
viewpointx = sign->x + FixedMul(FINECOSINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist);
viewpointy = sign->y + FixedMul(FINESINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist);
}
else
{
viewpointx = mo->x + FixedMul(FINECOSINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist);
viewpointy = mo->y + FixedMul(FINESINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist);
}
/* /*
if (twodlevel || (mo->flags2 & MF2_TWOD)) if (twodlevel || (mo->flags2 & MF2_TWOD))
@ -12385,9 +12428,6 @@ void P_PlayerAfterThink(player_t *player)
player->mo->flags |= MF_NOGRAVITY; player->mo->flags |= MF_NOGRAVITY;
} }
if (P_IsObjectOnGround(player->mo))
player->mo->pmomz = 0;
if (player->followmobj && (player->spectator || player->mo->health <= 0 || player->followmobj->type != player->followitem)) if (player->followmobj && (player->spectator || player->mo->health <= 0 || player->followmobj->type != player->followitem))
{ {
P_RemoveMobj(player->followmobj); P_RemoveMobj(player->followmobj);

View File

@ -460,7 +460,7 @@ static UINT8 *R_GenerateTexture(size_t texnum)
int x, x1, x2, i, width, height; int x, x1, x2, i, width, height;
size_t blocksize; size_t blocksize;
column_t *patchcol; column_t *patchcol;
UINT32 *colofs; UINT8 *colofs;
UINT16 wadnum; UINT16 wadnum;
lumpnum_t lumpnum; lumpnum_t lumpnum;
@ -494,10 +494,10 @@ static UINT8 *R_GenerateTexture(size_t texnum)
// Check the patch for holes. // Check the patch for holes.
if (texture->width > SHORT(realpatch->width) || texture->height > SHORT(realpatch->height)) if (texture->width > SHORT(realpatch->width) || texture->height > SHORT(realpatch->height))
holey = true; holey = true;
colofs = (UINT32 *)realpatch->columnofs; colofs = (UINT8 *)realpatch->columnofs;
for (x = 0; x < texture->width && !holey; x++) for (x = 0; x < texture->width && !holey; x++)
{ {
column_t *col = (column_t *)((UINT8 *)realpatch + LONG(colofs[x])); column_t *col = (column_t *)((UINT8 *)realpatch + LONG(*(UINT32 *)&colofs[x<<2]));
INT32 topdelta, prevdelta = -1, y = 0; INT32 topdelta, prevdelta = -1, y = 0;
while (col->topdelta != 0xff) while (col->topdelta != 0xff)
{ {
@ -526,19 +526,19 @@ static UINT8 *R_GenerateTexture(size_t texnum)
texturememory += blocksize; texturememory += blocksize;
// use the patch's column lookup // use the patch's column lookup
colofs = (UINT32 *)(void *)(block + 8); colofs = (block + 8);
texturecolumnofs[texnum] = colofs; texturecolumnofs[texnum] = (UINT32 *)colofs;
blocktex = block; blocktex = block;
if (patch->flip & 1) // flip the patch horizontally if (patch->flip & 1) // flip the patch horizontally
{ {
UINT32 *realcolofs = (UINT32 *)realpatch->columnofs; UINT8 *realcolofs = (UINT8 *)realpatch->columnofs;
for (x = 0; x < texture->width; x++) for (x = 0; x < texture->width; x++)
colofs[x] = realcolofs[texture->width-1-x]; // swap with the offset of the other side of the texture *(UINT32 *)&colofs[x<<2] = realcolofs[( texture->width-1-x )<<2]; // swap with the offset of the other side of the texture
} }
// we can't as easily flip the patch vertically sadly though, // we can't as easily flip the patch vertically sadly though,
// we have wait until the texture itself is drawn to do that // we have wait until the texture itself is drawn to do that
for (x = 0; x < texture->width; x++) for (x = 0; x < texture->width; x++)
colofs[x] = LONG(LONG(colofs[x]) + 3); *(UINT32 *)&colofs[x<<2] = LONG(LONG(*(UINT32 *)&colofs[x<<2]) + 3);
goto done; goto done;
} }
@ -558,8 +558,8 @@ static UINT8 *R_GenerateTexture(size_t texnum)
memset(block, TRANSPARENTPIXEL, blocksize+1); // Transparency hack memset(block, TRANSPARENTPIXEL, blocksize+1); // Transparency hack
// columns lookup table // columns lookup table
colofs = (UINT32 *)(void *)block; colofs = block;
texturecolumnofs[texnum] = colofs; texturecolumnofs[texnum] = (UINT32 *)colofs;
// texture data after the lookup table // texture data after the lookup table
blocktex = block + (texture->width*4); blocktex = block + (texture->width*4);
@ -619,8 +619,8 @@ static UINT8 *R_GenerateTexture(size_t texnum)
patchcol = (column_t *)((UINT8 *)realpatch + LONG(realpatch->columnofs[x-x1])); patchcol = (column_t *)((UINT8 *)realpatch + LONG(realpatch->columnofs[x-x1]));
// generate column ofset lookup // generate column ofset lookup
colofs[x] = LONG((x * texture->height) + (texture->width*4)); *(UINT32 *)&colofs[x<<2] = LONG((x * texture->height) + (texture->width*4));
ColumnDrawerPointer(patchcol, block + LONG(colofs[x]), patch, texture->height, height); ColumnDrawerPointer(patchcol, block + LONG(*(UINT32 *)&colofs[x<<2]), patch, texture->height, height);
} }
if (dealloc) if (dealloc)

View File

@ -400,10 +400,6 @@ void R_AddSpriteDefs(UINT16 wadnum)
start = W_CheckNumForNamePwad("S_START", wadnum, 0); start = W_CheckNumForNamePwad("S_START", wadnum, 0);
if (start == INT16_MAX) if (start == INT16_MAX)
start = W_CheckNumForNamePwad("SS_START", wadnum, 0); //deutex compatib. start = W_CheckNumForNamePwad("SS_START", wadnum, 0); //deutex compatib.
if (start == INT16_MAX)
start = 0; //let say S_START is lump 0
else
start++; // just after S_START
end = W_CheckNumForNamePwad("S_END",wadnum,start); end = W_CheckNumForNamePwad("S_END",wadnum,start);
if (end == INT16_MAX) if (end == INT16_MAX)
@ -417,9 +413,16 @@ void R_AddSpriteDefs(UINT16 wadnum)
return; return;
} }
// ignore skin wads (we don't want skin sprites interfering with vanilla sprites) if (start == INT16_MAX)
if (start == 0 && W_CheckNumForNamePwad("S_SKIN", wadnum, 0) != UINT16_MAX) {
return; // ignore skin wads (we don't want skin sprites interfering with vanilla sprites)
if (W_CheckNumForNamePwad("S_SKIN", wadnum, 0) != UINT16_MAX)
return;
start = 0; //let say S_START is lump 0
}
else
start++; // just after S_START
if (end == INT16_MAX) if (end == INT16_MAX)
{ {

View File

@ -1565,22 +1565,22 @@ void *W_CachePatchNumPwad(UINT16 wad, UINT16 lump, INT32 tag)
grPatch = HWR_GetCachedGLPatchPwad(wad, lump); grPatch = HWR_GetCachedGLPatchPwad(wad, lump);
if (grPatch->mipmap.grInfo.data) if (grPatch->mipmap->grInfo.data)
{ {
if (tag == PU_CACHE) if (tag == PU_CACHE)
tag = PU_HWRCACHE; tag = PU_HWRCACHE;
Z_ChangeTag(grPatch->mipmap.grInfo.data, tag); Z_ChangeTag(grPatch->mipmap->grInfo.data, tag);
} }
else else
{ {
patch_t *ptr = NULL; patch_t *ptr = NULL;
// Only load the patch if we haven't initialised the grPatch yet // Only load the patch if we haven't initialised the grPatch yet
if (grPatch->mipmap.width == 0) if (grPatch->mipmap->width == 0)
ptr = W_CacheLumpNumPwad(grPatch->wadnum, grPatch->lumpnum, PU_STATIC); ptr = W_CacheLumpNumPwad(grPatch->wadnum, grPatch->lumpnum, PU_STATIC);
// Run HWR_MakePatch in all cases, to recalculate some things // Run HWR_MakePatch in all cases, to recalculate some things
HWR_MakePatch(ptr, grPatch, &grPatch->mipmap, false); HWR_MakePatch(ptr, grPatch, grPatch->mipmap, false);
Z_Free(ptr); Z_Free(ptr);
} }

View File

@ -2131,7 +2131,7 @@ static void Y_AwardSpecialStageBonus(void)
data.spec.score = players[consoleplayer].score; data.spec.score = players[consoleplayer].score;
memset(data.spec.bonuses, 0, sizeof(data.spec.bonuses)); memset(data.spec.bonuses, 0, sizeof(data.spec.bonuses));
memset(data.spec.bonuspatches, 0, sizeof(data.coop.bonuspatches)); memset(data.spec.bonuspatches, 0, sizeof(data.spec.bonuspatches));
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
{ {

View File

@ -247,7 +247,11 @@ void Z_Free(void *ptr)
static void *xm(size_t size) static void *xm(size_t size)
{ {
const size_t padedsize = size+sizeof (size_t); const size_t padedsize = size+sizeof (size_t);
void *p = malloc(padedsize); void *p;
if (padedsize < size)/* overflow check */
I_Error("You are allocating memory too large!");
p = malloc(padedsize);
if (p == NULL) if (p == NULL)
{ {
@ -295,6 +299,9 @@ void *Z_MallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits)
CONS_Debug(DBG_MEMORY, "Z_Malloc %s:%d\n", file, line); CONS_Debug(DBG_MEMORY, "Z_Malloc %s:%d\n", file, line);
#endif #endif
if (blocksize < size)/* overflow check */
I_Error("You are allocating memory too large!");
block = xm(sizeof *block); block = xm(sizeof *block);
#ifdef HAVE_VALGRIND #ifdef HAVE_VALGRIND
padsize += (1<<sizeof(size_t))*2; padsize += (1<<sizeof(size_t))*2;