- SW's first texture flag, yay!

Removes two floorpicnum accesses
This commit is contained in:
Christoph Oelckers 2022-12-09 09:36:03 +01:00
parent 622710ede4
commit 32ad16f84d
7 changed files with 58 additions and 31 deletions

View file

@ -35,6 +35,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "sprite.h"
#include "weapon.h"
#include "misc.h"
#include "texinfo.h"
BEGIN_SW_NS
@ -1306,26 +1307,16 @@ int DoBunnyMove(DSWActor* actor)
if (RandomRange(1000) > 985 && actor->spr.pal != PALETTE_PLAYER1 && actor->user.track < 0)
{
switch (actor->sector()->floorpicnum)
if (tileflags(actor->sector()->floortexture()) & TFLAG_BUNNYFRIENDLY)
{
case 153:
case 154:
case 193:
case 219:
case 2636:
case 2689:
case 3561:
case 3562:
case 3563:
case 3564:
NewStateGroup(actor, sg_BunnyStand);
break;
default:
}
else
{
actor->spr.Angles.Yaw = RandomAngle();
actor->user.jump_speed = -350;
DoActorBeginJump(actor);
actor->user.ActorActionFunc = DoActorMoveJump;
break;
}
}
@ -1375,24 +1366,14 @@ int DoBunnyEat(DSWActor* actor)
DoActorSectorDamage(actor);
switch (actor->sector()->floorpicnum)
if (tileflags(actor->sector()->floortexture()) & TFLAG_BUNNYFRIENDLY)
{
case 153:
case 154:
case 193:
case 219:
case 2636:
case 2689:
case 3561:
case 3562:
case 3563:
case 3564:
if (RandomRange(1000) > 970)
NewStateGroup(actor, sg_BunnyRun);
break;
default:
}
else
{
NewStateGroup(actor,sg_BunnyRun);
break;
}
return 0;
}

View file

@ -227,7 +227,7 @@ void CopySectorMatch(int match)
dsectp->floorshade = ssectp->floorshade;
dsectp->ceilingshade = ssectp->ceilingshade;
dsectp->floorpicnum = ssectp->floorpicnum;
dsectp->setfloortexture(ssectp->floortexture());
dsectp->setceilingtexture(ssectp->ceilingtexture());
dsectp->floorheinum = ssectp->floorheinum;

View file

@ -882,6 +882,10 @@ enum
SPRX_BOOL10 = (BIT(15)),
};
enum ETexFlags
{
TFLAG_BUNNYFRIENDLY = 1, // bunnies like to stay in sectors with this as floor.
};
// User->Flags flags
enum

View file

@ -301,3 +301,15 @@ x(COMPASS_MID_TIC2, 2391)
x(FAF_PORTAL, 341)
x(FAF_PORTAL2, 342)
x(SYBEXSCREEN, 5261)
// stuff bunnies like
x(DARKGRASS, 153)
x(BRIGHTGRASS, 154)
x(MOSS, 193)
x(GRASSSTONE, 219)
x(GRASSQUARRY, 2636)
x(DRYGRASS, 2689)
x(LAWN, 3561)
x(SAND, 3562)
x(FLOWERLAWN, 3563)
x(THINGRASS, 3564)

View file

@ -0,0 +1,8 @@
// Global constants for SW
constants
{
// texture flags
TFLAG_BUNNYFRIENDLY = 1
}

View file

@ -0,0 +1,17 @@
include "constants.mi"
textureflags
{
TFLAG_BUNNYFRIENDLY =
DARKGRASS,
BRIGHTGRASS,
MOSS,
GRASSSTONE,
GRASSQUARRY,
DRYGRASS,
LAWN,
SAND,
FLOWERLAWN,
THINGRASS
}

View file

@ -117,6 +117,11 @@ struct SW native
INVF_COUNT = 4
}
enum ETexFlags // texture flags
{
TFLAG_BUNNYFRIENDLY = 1,
};
native static void PlaySound(int sound, int flags, int channel = CHAN_AUTO, int cflags = 0);
native static void StopSound();
native static bool IsSoundPlaying(int channel); // soundEngine.IsSourcePlayingSomething(SOURCE_None, nullptr, CHAN_VOICE))