Merge branch 'master' into opengl-improvements

This commit is contained in:
Monster Iestyn 2017-07-02 16:42:40 +01:00
commit 100422e1ce
9 changed files with 169 additions and 378 deletions

View file

@ -107,8 +107,6 @@ UINT8 window_notinfocus = false;
//
// DEMO LOOP
//
//static INT32 demosequence;
static const char *pagename = "MAP1PIC";
static char *startupwadfiles[MAX_WADFILES];
boolean devparm = false; // started game with -devparm
@ -724,7 +722,6 @@ void D_StartTitle(void)
gameaction = ga_nothing;
displayplayer = consoleplayer = 0;
//demosequence = -1;
gametype = GT_COOP;
paused = false;
advancedemo = false;
@ -889,27 +886,10 @@ static void IdentifyVersion(void)
#endif
}
/* ======================================================================== */
// Just print the nice red titlebar like the original SRB2 for DOS.
/* ======================================================================== */
#ifdef PC_DOS
static inline void D_Titlebar(char *title1, char *title2)
{
// SRB2 banner
clrscr();
textattr((BLUE<<4)+WHITE);
clreol();
cputs(title1);
// standard srb2 banner
textattr((RED<<4)+WHITE);
clreol();
gotoxy((80-strlen(title2))/2, 2);
cputs(title2);
normvideo();
gotoxy(1,3);
}
#endif
/* ======================================================================== */
// Code for printing SRB2's title bar in DOS
/* ======================================================================== */
//
// Center the title string, then add the date and time of compilation.
@ -938,6 +918,31 @@ static inline void D_MakeTitleString(char *s)
strcpy(s, temp);
}
static inline void D_Titlebar(void)
{
char title1[82]; // srb2 title banner
char title2[82];
strcpy(title1, "Sonic Robo Blast 2");
strcpy(title2, "Sonic Robo Blast 2");
D_MakeTitleString(title1);
// SRB2 banner
clrscr();
textattr((BLUE<<4)+WHITE);
clreol();
cputs(title1);
// standard srb2 banner
textattr((RED<<4)+WHITE);
clreol();
gotoxy((80-strlen(title2))/2, 2);
cputs(title2);
normvideo();
gotoxy(1,3);
}
#endif
//
// D_SRB2Main
@ -945,8 +950,6 @@ static inline void D_MakeTitleString(char *s)
void D_SRB2Main(void)
{
INT32 p;
char srb2[82]; // srb2 title banner
char title[82];
INT32 pstartmap = 1;
boolean autostart = false;
@ -989,20 +992,8 @@ void D_SRB2Main(void)
dedicated = M_CheckParm("-dedicated") != 0;
#endif
strcpy(title, "Sonic Robo Blast 2");
strcpy(srb2, "Sonic Robo Blast 2");
D_MakeTitleString(srb2);
#ifdef PC_DOS
D_Titlebar(srb2, title);
#endif
#if defined (__OS2__) && !defined (HAVE_SDL)
// set PM window title
snprintf(pmData->title, sizeof (pmData->title),
"Sonic Robo Blast 2" VERSIONSTRING ": %s",
title);
pmData->title[sizeof (pmData->title) - 1] = '\0';
D_Titlebar();
#endif
if (devparm)
@ -1402,7 +1393,6 @@ void D_SRB2Main(void)
if (dedicated && server)
{
pagename = "TITLESKY";
levelstarttic = gametic;
G_SetGamestate(GS_LEVEL);
if (!P_SetupLevel(false))

View file

@ -382,56 +382,6 @@ static void clear_levels(void)
P_AllocMapHeader(gamemap-1);
}
/*
// Edits an animated texture slot on the array
// Tails 12-27-2003
static void readAnimTex(MYFILE *f, INT32 num)
{
char s[MAXLINELEN];
char *word;
char *word2;
INT32 i;
do {
if (myfgets(s, sizeof s, f) != NULL)
{
if (s[0] == '\n') break;
tmp = strchr(s, '#');
if (tmp)
*tmp = '\0';
// set the value in the appropriate field
word = strtok(s, " ");
if (word)
strupr(word);
else
break;
word2 = strtok(NULL, " = ");
if (word2)
strupr(word2);
else
break;
if (word2[strlen(word2)-1] == '\n')
word2[strlen(word2)-1] = '\0';
i = atoi(word2);
if (fastcmp(word, "START"))
strncpy(harddefs[num].startname, word2, 8);
if (fastcmp(word, "END"))
strncpy(harddefs[num].endname, word2, 8);
else if (fastcmp(word, "SPEED")) harddefs[num].speed = i;
else if (fastcmp(word, "ISTEXTURE")) harddefs[num].istexture = i;
else deh_warning("readAnimTex %d: unknown word '%s'", num, word);
}
} while (s[0] != '\n' && !myfeof(f)); //finish when the line is empty
}
*/
static boolean findFreeSlot(INT32 *num)
{
// Send the character select entry to a free slot.
@ -2106,7 +2056,7 @@ static void readframe(MYFILE *f, INT32 num)
Z_Free(s);
}
static void readsound(MYFILE *f, INT32 num, const char *savesfxnames[])
static void readsound(MYFILE *f, INT32 num)
{
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
char *word;
@ -2142,21 +2092,7 @@ static void readsound(MYFILE *f, INT32 num, const char *savesfxnames[])
continue;
}
/* if (fastcmp(word, "OFFSET"))
{
value -= 150360;
if (value <= 64)
value /= 8;
else if (value <= 260)
value = (value+4)/8;
else
value = (value+8)/8;
if (value >= -1 && value < sfx_freeslot0 - 1)
S_sfx[num].name = savesfxnames[value+1];
else
deh_warning("Sound %d: offset out of bounds", num);
}
else */if (fastcmp(word, "SINGULAR"))
if (fastcmp(word, "SINGULAR"))
{
DEH_WriteUndoline(word, va("%d", S_sfx[num].singularity), UNDO_NONE);
S_sfx[num].singularity = value;
@ -2182,8 +2118,6 @@ static void readsound(MYFILE *f, INT32 num, const char *savesfxnames[])
} while (!myfeof(f));
Z_Free(s);
(void)savesfxnames;
}
/** Checks if a game data file name for a mod is good.
@ -2811,190 +2745,6 @@ static void readconditionset(MYFILE *f, UINT8 setnum)
Z_Free(s);
}
static void readtexture(MYFILE *f, const char *name)
{
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
char *word;
char *word2;
char *tmp;
INT32 i, j, value;
UINT16 width = 0, height = 0;
INT16 patchcount = 0;
texture_t *texture;
do
{
if (myfgets(s, MAXLINELEN, f))
{
if (s[0] == '\n')
break;
tmp = strchr(s, '#');
if (tmp)
*tmp = '\0';
value = searchvalue(s);
word = strtok(s, " ");
if (word)
strupr(word);
else
break;
word2 = strtok(NULL, " ");
if (word2)
strupr(word2);
else
break;
// Width of the texture.
if (fastcmp(word, "WIDTH"))
{
DEH_WriteUndoline(word, va("%d", width), UNDO_NONE);
width = SHORT((UINT16)value);
}
// Height of the texture.
else if (fastcmp(word, "HEIGHT"))
{
DEH_WriteUndoline(word, va("%d", height), UNDO_NONE);
height = SHORT((UINT16)value);
}
// Number of patches the texture has.
else if (fastcmp(word, "NUMPATCHES"))
{
DEH_WriteUndoline(word, va("%d", patchcount), UNDO_NONE);
patchcount = SHORT((UINT16)value);
}
else
deh_warning("readtexture: unknown word '%s'", word);
}
} while (!myfeof(f));
// Error checking.
if (!width)
I_Error("Texture %s has no width!\n", name);
if (!height)
I_Error("Texture %s has no height!\n", name);
if (!patchcount)
I_Error("Texture %s has no patches!\n", name);
// Allocate memory for the texture, and fill in information.
texture = Z_Calloc(sizeof(texture_t) + (sizeof(texpatch_t) * SHORT(patchcount)), PU_STATIC, NULL);
M_Memcpy(texture->name, name, sizeof(texture->name));
texture->width = width;
texture->height = height;
texture->patchcount = patchcount;
texture->holes = false;
// Fill out the texture patches, to allow them to be detected
// accurately by readpatch.
for (i = 0; i < patchcount; i++)
{
texture->patches[i].originx = 0;
texture->patches[i].originy = 0;
texture->patches[i].wad = UINT16_MAX;
texture->patches[i].lump = UINT16_MAX;
}
// Jump to the next empty texture entry.
i = 0;
while (textures[i])
i++;
// Fill the global texture buffer entries.
j = 1;
while (j << 1 <= texture->width)
j <<= 1;
textures[i] = texture;
texturewidthmask[i] = j - 1;
textureheight[i] = texture->height << FRACBITS;
// Clean up.
Z_Free(s);
}
static void readpatch(MYFILE *f, const char *name, UINT16 wad)
{
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
char *word;
char *word2;
char *tmp;
INT32 i = 0, j = 0, value;
texpatch_t patch = {0, 0, UINT16_MAX, UINT16_MAX, 0, 255, AST_COPY};
// Jump to the texture this patch belongs to, which,
// coincidentally, is always the last one on the buffer cache.
while (textures[i+1])
i++;
// Jump to the next empty patch entry.
while (memcmp(&(textures[i]->patches[j]), &patch, sizeof(patch)))
j++;
patch.wad = wad;
// Set the texture number, but only if the lump exists.
if ((patch.lump = W_CheckNumForNamePwad(name, wad, 0)) == INT16_MAX)
I_Error("readpatch: Missing patch in texture %s", textures[i]->name);
// note: undoing this patch will be done by other means
do
{
if (myfgets(s, MAXLINELEN, f))
{
if (s[0] == '\n')
break;
tmp = strchr(s, '#');
if (tmp)
*tmp = '\0';
value = searchvalue(s);
word = strtok(s, " ");
if (word)
strupr(word);
else
break;
word2 = strtok(NULL, " ");
if (word2)
strupr(word2);
else
break;
// X position of the patch in the texture.
if (fastcmp(word, "X"))
{
//DEH_WriteUndoline(word, va("%d", patch->originx), UNDO_NONE);
patch.originx = (INT16)value;
}
// Y position of the patch in the texture.
else if (fastcmp(word, "Y"))
{
//DEH_WriteUndoline(word, va("%d", patch->originy), UNDO_NONE);
patch.originy = (INT16)value;
}
else
deh_warning("readpatch: unknown word '%s'", word);
}
} while (!myfeof(f));
// Error checking.
/* // Irrelevant. Origins cannot be unsigned.
if (patch.originx == UINT16_MAX)
I_Error("Patch %s on texture %s has no X position!\n", name, textures[i]->name);
if (patch.originy == UINT16_MAX)
I_Error("Patch %s on texture %s has no Y position!\n", name, textures[i]->name);
*/
// Set the patch as that patch number.
textures[i]->patches[j] = patch;
// Clean up.
Z_Free(s);
}
static void readmaincfg(MYFILE *f)
{
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
@ -3405,30 +3155,17 @@ static void ignorelines(MYFILE *f)
Z_Free(s);
}
static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
static void DEH_LoadDehackedFile(MYFILE *f)
{
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
char *word;
char *word2;
INT32 i;
// do a copy of this for cross references probleme
//XBOXSTATIC actionf_t saveactions[NUMSTATES];
//XBOXSTATIC const char *savesprnames[NUMSPRITES];
XBOXSTATIC const char *savesfxnames[NUMSFX];
if (!deh_loaded)
initfreeslots();
deh_num_warning = 0;
// save values for cross reference
/*
for (i = 0; i < NUMSTATES; i++)
saveactions[i] = states[i].action;
for (i = 0; i < NUMSPRITES; i++)
savesprnames[i] = sprnames[i];
*/
for (i = 0; i < NUMSFX; i++)
savesfxnames[i] = S_sfx[i].name;
gamedataadded = false;
@ -3505,19 +3242,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
if (word2[strlen(word2)-1] == '\n')
word2[strlen(word2)-1] = '\0';
i = atoi(word2);
if (fastcmp(word, "TEXTURE"))
{
// Read texture from spec file.
readtexture(f, word2);
DEH_WriteUndoline(word, word2, UNDO_HEADER);
}
else if (fastcmp(word, "PATCH"))
{
// Read patch from spec file.
readpatch(f, word2, wad);
DEH_WriteUndoline(word, word2, UNDO_HEADER);
}
else if (fastcmp(word, "THING") || fastcmp(word, "MOBJ") || fastcmp(word, "OBJECT"))
if (fastcmp(word, "THING") || fastcmp(word, "MOBJ") || fastcmp(word, "OBJECT"))
{
if (i == 0 && word2[0] != '0') // If word2 isn't a number
i = get_mobjtype(word2); // find a thing by name
@ -3530,10 +3255,6 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
}
DEH_WriteUndoline(word, word2, UNDO_HEADER);
}
/* else if (fastcmp(word, "ANIMTEX"))
{
readAnimTex(f, i);
}*/
else if (fastcmp(word, "LIGHT"))
{
#ifdef HWRENDER
@ -3605,34 +3326,12 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
}
DEH_WriteUndoline(word, word2, UNDO_HEADER);
}
// <Callum> Added translations to this just in case its re-enabled
/* else if (fastcmp(word, "POINTER"))
{
word = strtok(NULL, " "); // get frame
word = strtok(NULL, ")");
if (word)
{
i = atoi(word);
if (i < NUMSTATES && i >= 0)
{
if (myfgets(s, MAXLINELEN, f))
states[i].action = saveactions[searchvalue(s)];
}
else
{
deh_warning("Pointer: Frame %d doesn't exist", i);
ignorelines(f);
}
}
else
deh_warning("pointer (Frame %d) : missing ')'", i);
}*/
else if (fastcmp(word, "SOUND"))
{
if (i == 0 && word2[0] != '0') // If word2 isn't a number
i = get_sfx(word2); // find a sound by name
if (i < NUMSFX && i > 0)
readsound(f, i, savesfxnames);
readsound(f, i);
else
{
deh_warning("Sound %d out of range (1 - %d)", i, NUMSFX-1);
@ -3640,26 +3339,6 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
}
DEH_WriteUndoline(word, word2, UNDO_HEADER);
}
/* else if (fastcmp(word, "SPRITE"))
{
if (i < NUMSPRITES && i >= 0)
{
if (myfgets(s, MAXLINELEN, f))
{
INT32 k;
k = (searchvalue(s) - 151328)/8;
if (k >= 0 && k < NUMSPRITES)
sprnames[i] = savesprnames[k];
else
{
deh_warning("Sprite %d: offset out of bounds", i);
ignorelines(f);
}
}
}
else
deh_warning("Sprite %d doesn't exist",i);
}*/
else if (fastcmp(word, "HUDITEM"))
{
if (i == 0 && word2[0] != '0') // If word2 isn't a number
@ -3746,7 +3425,10 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
// no undo support for this insanity yet
//DEH_WriteUndoline(word, word2, UNDO_HEADER);
}
else if (fastcmp(word, "SRB2"))
// Last I heard this crashes the game if you try to use it
// so this is disabled for now
// -- Monster Iestyn
/* else if (fastcmp(word, "SRB2"))
{
INT32 ver = searchvalue(strtok(NULL, "\n"));
if (ver != PATCHVERSION)
@ -3757,6 +3439,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
// Unless you REALLY want to piss people off,
// define a custom gamedata /before/ doing this!!
// (then again, modifiedgame will prevent game data saving anyway)
*/
else if (fastcmp(word, "CLEAR"))
{
boolean clearall = (fastcmp(word2, "ALL"));
@ -3830,7 +3513,7 @@ void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump)
W_ReadLumpPwad(wad, lump, f.data);
f.curpos = f.data;
f.data[f.size] = 0;
DEH_LoadDehackedFile(&f, wad);
DEH_LoadDehackedFile(&f);
DEH_WriteUndoline(va("# uload for wad: %u, lump: %u", wad, lump), NULL, UNDO_DONE);
Z_Free(f.data);
}

View file

@ -78,6 +78,7 @@ typedef struct gr_vissprite_s
//Hurdler: 25/04/2000: now support colormap in hardware mode
UINT8 *colormap;
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
float z1, z2;
} gr_vissprite_t;
// --------

View file

@ -4342,6 +4342,7 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
GLPatch_t *gpatch; // sprite patch converted to hardware
FSurfaceInfo Surf;
const boolean hires = (spr->mobj && spr->mobj->skin && ((skin_t *)spr->mobj->skin)->flags & SF_HIRES);
//const boolean papersprite = (spr->mobj && (spr->mobj->frame & FF_PAPERSPRITE));
if (spr->mobj)
this_scale = FIXED_TO_FLOAT(spr->mobj->scale);
if (hires)
@ -4385,7 +4386,8 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
// make a wall polygon (with 2 triangles), using the floor/ceiling heights,
// and the 2d map coords of start/end vertices
wallVerts[0].z = wallVerts[1].z = wallVerts[2].z = wallVerts[3].z = spr->tz;
wallVerts[0].z = wallVerts[3].z = spr->z1;
wallVerts[2].z = wallVerts[1].z = spr->z2;
// transform
wv = wallVerts;
@ -5181,6 +5183,10 @@ static void HWR_ProjectSprite(mobj_t *thing)
angle_t ang;
INT32 heightsec, phs;
const boolean papersprite = (thing->frame & FF_PAPERSPRITE);
float offset;
float ang_scale = 1.0f, ang_scalez = 0.0f;
float z1, z2;
if (!thing)
return;
@ -5195,7 +5201,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
tz = (tr_x * gr_viewcos) + (tr_y * gr_viewsin);
// thing is behind view plane?
if (tz < ZCLIP_PLANE && (!cv_grmd2.value || md2_models[thing->sprite].notfound == true)) //Yellow: Only MD2's dont disappear
if (tz < ZCLIP_PLANE && !papersprite && (!cv_grmd2.value || md2_models[thing->sprite].notfound == true)) //Yellow: Only MD2's dont disappear
return;
tx = (tr_x * gr_viewsin) - (tr_y * gr_viewcos);
@ -5233,6 +5239,27 @@ static void HWR_ProjectSprite(mobj_t *thing)
I_Error("sprframes NULL for sprite %d\n", thing->sprite);
#endif
if (papersprite)
{
// Use the actual view angle, rather than the angle formed
// between the view point and the thing
// this makes sure paper sprites always appear at the right angle!
// Note: DO NOT do this in software mode version, it actually
// makes papersprites look WORSE there (I know, I've tried)
// Monster Iestyn - 13/05/17
ang = dup_viewangle - thing->angle;
ang_scale = FIXED_TO_FLOAT(FINESINE(ang>>ANGLETOFINESHIFT));
ang_scalez = FIXED_TO_FLOAT(FINECOSINE(ang>>ANGLETOFINESHIFT));
if (ang_scale < 0)
{
ang_scale = -ang_scale;
ang_scalez = -ang_scalez;
}
}
else if (sprframe->rotate != SRF_SINGLE)
ang = R_PointToAngle (thing->x, thing->y) - thing->angle;
if (sprframe->rotate == SRF_SINGLE)
{
// use single rotation for all views
@ -5243,8 +5270,6 @@ static void HWR_ProjectSprite(mobj_t *thing)
else
{
// choose a different rotation based on player view
ang = R_PointToAngle (thing->x, thing->y) - thing->angle;
if ((sprframe->rotate & SRF_RIGHT) && (ang < ANGLE_180)) // See from right
rot = 6; // F7 slot
else if ((sprframe->rotate & SRF_LEFT) && (ang >= ANGLE_180)) // See from left
@ -5262,9 +5287,12 @@ static void HWR_ProjectSprite(mobj_t *thing)
// calculate edges of the shape
if (flip)
tx -= FIXED_TO_FLOAT(spritecachedinfo[lumpoff].width - spritecachedinfo[lumpoff].offset) * this_scale;
offset = FIXED_TO_FLOAT(spritecachedinfo[lumpoff].width - spritecachedinfo[lumpoff].offset) * this_scale;
else
tx -= FIXED_TO_FLOAT(spritecachedinfo[lumpoff].offset) * this_scale;
offset = FIXED_TO_FLOAT(spritecachedinfo[lumpoff].offset) * this_scale;
z1 = tz - (offset * ang_scalez);
tx -= offset * ang_scale;
// project x
x1 = gr_windowcenterx + (tx * gr_centerx / tz);
@ -5275,7 +5303,14 @@ static void HWR_ProjectSprite(mobj_t *thing)
x1 = tx;
tx += FIXED_TO_FLOAT(spritecachedinfo[lumpoff].width) * this_scale;
offset = FIXED_TO_FLOAT(spritecachedinfo[lumpoff].width) * this_scale;
z2 = z1 + (offset * ang_scalez);
tx += offset * ang_scale;
if (papersprite && max(z1, z2) < ZCLIP_PLANE)
return;
x2 = gr_windowcenterx + (tx * gr_centerx / tz);
if (vflip)
@ -5324,6 +5359,8 @@ static void HWR_ProjectSprite(mobj_t *thing)
vis->patchlumpnum = sprframe->lumppat[rot];
vis->flip = flip;
vis->mobj = thing;
vis->z1 = z1;
vis->z2 = z2;
//Hurdler: 25/04/2000: now support colormap in hardware mode
if ((vis->mobj->flags & MF_BOSS) && (vis->mobj->flags2 & MF2_FRET) && (leveltime & 1)) // Bosses "flash"

View file

@ -46,6 +46,7 @@ enum hook {
hook_ShieldSpawn,
hook_ShieldSpecial,
hook_MobjMoveBlocked,
hook_MapThingSpawn,
hook_MAX // last hook
};
@ -83,5 +84,6 @@ boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source, UINT8
#define LUAh_ShieldSpawn(player) LUAh_PlayerHook(player, hook_ShieldSpawn) // Hook for P_SpawnShieldOrb
#define LUAh_ShieldSpecial(player) LUAh_PlayerHook(player, hook_ShieldSpecial) // Hook for shield abilities
#define LUAh_MobjMoveBlocked(mo) LUAh_MobjHook(mo, hook_MobjMoveBlocked) // Hook for P_XYMovement (when movement is blocked)
boolean LUAh_MapThingSpawn(mobj_t *mo, mapthing_t *mthing); // Hook for P_SpawnMapThing by mobj type
#endif

View file

@ -57,6 +57,7 @@ const char *const hookNames[hook_MAX+1] = {
"ShieldSpawn",
"ShieldSpecial",
"MobjMoveBlocked",
"MapThingSpawn",
NULL
};
@ -128,6 +129,7 @@ static int lib_addHook(lua_State *L)
case hook_MobjRemoved:
case hook_HurtMsg:
case hook_MobjMoveBlocked:
case hook_MapThingSpawn:
hook.s.mt = MT_NULL;
if (lua_isnumber(L, 2))
hook.s.mt = lua_tonumber(L, 2);
@ -187,6 +189,7 @@ static int lib_addHook(lua_State *L)
case hook_BossDeath:
case hook_MobjRemoved:
case hook_MobjMoveBlocked:
case hook_MapThingSpawn:
lastp = &mobjhooks[hook.s.mt];
break;
case hook_JumpSpecial:
@ -1073,4 +1076,66 @@ void LUAh_NetArchiveHook(lua_CFunction archFunc)
// stack: tables
}
boolean LUAh_MapThingSpawn(mobj_t *mo, mapthing_t *mthing)
{
hook_p hookp;
boolean hooked = false;
if (!gL || !(hooksAvailable[hook_MapThingSpawn/8] & (1<<(hook_MapThingSpawn%8))))
return false;
lua_settop(gL, 0);
// Look for all generic mobj map thing spawn hooks
for (hookp = mobjhooks[MT_NULL]; hookp; hookp = hookp->next)
if (hookp->type == hook_MapThingSpawn)
{
if (lua_gettop(gL) == 0)
{
LUA_PushUserdata(gL, mo, META_MOBJ);
LUA_PushUserdata(gL, mthing, META_MAPTHING);
}
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
lua_gettable(gL, LUA_REGISTRYINDEX);
lua_pushvalue(gL, -3);
lua_pushvalue(gL, -3);
if (lua_pcall(gL, 2, 1, 0)) {
if (!hookp->error || cv_debug & DBG_LUA)
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
lua_pop(gL, 1);
hookp->error = true;
continue;
}
if (lua_toboolean(gL, -1))
hooked = true;
lua_pop(gL, 1);
}
for (hookp = mobjhooks[mo->type]; hookp; hookp = hookp->next)
if (hookp->type == hook_MapThingSpawn)
{
if (lua_gettop(gL) == 0)
{
LUA_PushUserdata(gL, mo, META_MOBJ);
LUA_PushUserdata(gL, mthing, META_MAPTHING);
}
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
lua_gettable(gL, LUA_REGISTRYINDEX);
lua_pushvalue(gL, -3);
lua_pushvalue(gL, -3);
if (lua_pcall(gL, 2, 1, 0)) {
if (!hookp->error || cv_debug & DBG_LUA)
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
lua_pop(gL, 1);
hookp->error = true;
continue;
}
if (lua_toboolean(gL, -1))
hooked = true;
lua_pop(gL, 1);
}
lua_settop(gL, 0);
return hooked;
}
#endif

View file

@ -9729,6 +9729,16 @@ void P_SpawnMapThing(mapthing_t *mthing)
mobj = P_SpawnMobj(x, y, z, i);
mobj->spawnpoint = mthing;
#ifdef HAVE_BLUA
if (LUAh_MapThingSpawn(mobj, mthing))
{
if (P_MobjWasRemoved(mobj))
return;
}
else if (P_MobjWasRemoved(mobj))
return;
else
#endif
switch(mobj->type)
{
case MT_SKYBOX:

View file

@ -456,7 +456,8 @@ void P_ParseAnimationDefintion(SINT8 istexture)
// Search for existing animdef
for (i = 0; i < maxanims; i++)
if (stricmp(animdefsToken, animdefs[i].startname) == 0)
if (animdefs[i].istexture == istexture // Check if it's the same type!
&& stricmp(animdefsToken, animdefs[i].startname) == 0)
{
//CONS_Alert(CONS_NOTICE, "Duplicate animation: %s\n", animdefsToken);

View file

@ -158,7 +158,7 @@ static INT32 windowedModes[MAXWINMODES][2] =
static void Impl_VideoSetupSDLBuffer(void);
static void Impl_VideoSetupBuffer(void);
static SDL_bool Impl_CreateWindow(SDL_bool fullscreen);
static void Impl_SetWindowName(const char *title);
//static void Impl_SetWindowName(const char *title);
static void Impl_SetWindowIcon(void);
static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
@ -1188,7 +1188,7 @@ INT32 VID_SetMode(INT32 modeNum)
}
vid.modenum = -1;
}
Impl_SetWindowName("SRB2 "VERSIONSTRING);
//Impl_SetWindowName("SRB2 "VERSIONSTRING);
SDLSetMode(vid.width, vid.height, USE_FULLSCREEN);
@ -1271,14 +1271,16 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen)
return SDL_TRUE;
}
/*
static void Impl_SetWindowName(const char *title)
{
if (window != NULL)
if (window == NULL)
{
return;
}
SDL_SetWindowTitle(window, title);
}
*/
static void Impl_SetWindowIcon(void)
{