This commit is contained in:
nashmuhandes 2016-07-22 16:19:27 +08:00
commit c7ba0e0aac
9 changed files with 49 additions and 42 deletions

View file

@ -921,7 +921,7 @@ static int PatchThing (int thingy)
{
if (stricmp (Line1, "Speed") == 0)
{
info->Speed = val; // handle fixed point later.
info->Speed = (signed long)val; // handle fixed point later.
}
else if (stricmp (Line1, "Width") == 0)
{

View file

@ -270,7 +270,7 @@ void GLSprite::Draw(int pass)
const bool drawBillboardFacingCamera = gl_billboard_faces_camera;
// [Nash] has +ROLLSPRITE
const bool drawRollSpriteActor = (actor != NULL && actor->renderflags & RF_ROLLSPRITE);
const bool drawRollSpriteActor = (actor != nullptr && actor->renderflags & RF_ROLLSPRITE);
gl_RenderState.Apply();
FVector3 v1;
@ -280,10 +280,10 @@ void GLSprite::Draw(int pass)
// [fgsfds] check sprite type mask
DWORD spritetype = (DWORD)-1;
if (actor != NULL) spritetype = actor->renderflags & RF_SPRITETYPEMASK;
if (actor != nullptr) spritetype = actor->renderflags & RF_SPRITETYPEMASK;
// [Nash] is a flat sprite
const bool isFlatSprite = (actor != NULL) && (spritetype == RF_WALLSPRITE || spritetype == RF_FLATSPRITE);
const bool isFlatSprite = (actor != nullptr) && (spritetype == RF_WALLSPRITE || spritetype == RF_FLATSPRITE);
const bool dontFlip = (actor != nullptr) && (actor->renderflags & RF_DONTFLIP);
const bool useOffsets = (actor != nullptr) && !(actor->renderflags & RF_ROLLCENTER);
@ -295,8 +295,8 @@ void GLSprite::Draw(int pass)
float ycenter = (y1 + y2)*0.5;
float zcenter = (z1 + z2)*0.5;
float xx = -xcenter + x;
float yy = -zcenter + z;
float zz = -ycenter + y;
float zz = -zcenter + z;
float yy = -ycenter + y;
Matrix3x4 mat;
mat.MakeIdentity();
mat.Translate(xcenter, zcenter, ycenter); // move to sprite center
@ -336,20 +336,22 @@ void GLSprite::Draw(int pass)
// Here we need some form of priority in order to work.
if (spritetype == RF_FLATSPRITE)
{
DVector3 diff = actor->Vec3To(GLRenderer->mViewActor);
float pitchDegrees = -actor->Angles.Pitch.Degrees;
DVector3 apos = { x, y, z };
DVector3 diff = ViewPos - apos;
DAngle angto = diff.Angle();
angto = deltaangle(actor->Angles.Yaw, angto);
float pitchDegrees = -actor->Angles.Pitch.Degrees;
bool noFlipSprite = (!dontFlip || (fabs(angto) < 90.));
mat.Rotate(0, 1, 0, (noFlipSprite) ? 0 : 180);
mat.Rotate(-yawvecY, 0, yawvecX, (noFlipSprite) ? -pitchDegrees : pitchDegrees);
if (drawRollSpriteActor)
{
if (useOffsets) mat.Translate(xx, yy, zz);
if (useOffsets) mat.Translate(xx, zz, yy);
mat.Rotate(yawvecX, 0, yawvecY, (noFlipSprite) ? -rollDegrees : rollDegrees);
if (useOffsets) mat.Translate(-xx, -yy, -zz);
if (useOffsets) mat.Translate(-xx, -zz, -yy);
}
}
// [fgsfds] Rotate the sprite about the sight vector (roll)
@ -358,20 +360,20 @@ void GLSprite::Draw(int pass)
mat.Rotate(0, 1, 0, 0);
if (drawRollSpriteActor)
{
if (useOffsets) mat.Translate(xx, yy, zz);
if (useOffsets) mat.Translate(xx, zz, yy);
mat.Rotate(yawvecX, 0, yawvecY, rollDegrees);
if (useOffsets) mat.Translate(-xx, -yy, -zz);
if (useOffsets) mat.Translate(-xx, -zz, -yy);
}
}
else if (drawRollSpriteActor)
{
if (useOffsets) mat.Translate(xx, yy, zz);
if (useOffsets) mat.Translate(xx, zz, yy);
if (drawWithXYBillboard)
{
mat.Rotate(-sin(angleRad), 0, cos(angleRad), -GLRenderer->mAngles.Pitch.Degrees);
}
mat.Rotate(cos(angleRad), 0, sin(angleRad), rollDegrees);
if (useOffsets) mat.Translate(-xx, -yy, -zz);
if (useOffsets) mat.Translate(-xx, -zz, -yy);
}
// apply the transform

View file

@ -658,7 +658,7 @@ static EColorRange ParseOptionColor(FScanner &sc, FOptionMenuDescriptor *desc)
if (sc.CheckString(","))
{
sc.MustGetString();
EColorRange cr = V_FindFontColor(sc.String);
cr = V_FindFontColor(sc.String);
if (cr == CR_UNTRANSLATED && !sc.Compare("untranslated") && isdigit(sc.String[0]))
{
if (strtol(sc.String, NULL, 0)) cr = OptionSettings.mFontColorHeader;

View file

@ -3719,6 +3719,7 @@ enum
APROP_DamageMultiplier=43,
APROP_MaxStepHeight = 44,
APROP_MaxDropOffHeight= 45,
APROP_DamageType = 46,
};
// These are needed for ACS's APROP_RenderStyle
@ -3978,6 +3979,9 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value)
actor->MaxDropOffHeight = ACSToDouble(value);
break;
case APROP_DamageType:
actor->DamageType = FBehavior::StaticLookupString(value);
break;
default:
// do nothing.
@ -4081,6 +4085,7 @@ int DLevelScript::GetActorProperty (int tid, int property)
case APROP_Friction: return DoubleToACS(actor->Friction);
case APROP_MaxStepHeight: return DoubleToACS(actor->MaxStepHeight);
case APROP_MaxDropOffHeight: return DoubleToACS(actor->MaxDropOffHeight);
case APROP_DamageType: return GlobalACSStrings.AddString(actor->DamageType);
default: return 0;
}
@ -4153,6 +4158,7 @@ int DLevelScript::CheckActorProperty (int tid, int property, int value)
case APROP_ActiveSound: string = actor->ActiveSound; break;
case APROP_Species: string = actor->GetSpecies(); break;
case APROP_NameTag: string = actor->GetTag(); break;
case APROP_DamageType: string = actor->DamageType; break;
}
if (string == NULL) string = "";
return (!stricmp(string, FBehavior::StaticLookupString(value)));

View file

@ -1085,9 +1085,8 @@ DEFINE_ACTION_FUNCTION(AInventory, A_Lower)
}
if (player->playerstate == PST_DEAD)
{ // Player is dead, so don't bring up a pending weapon
psp->y = WEAPONBOTTOM;
// Player is dead, so keep the weapon off screen
P_SetPsprite(player, PSP_FLASH, nullptr);
psp->SetState(nullptr);
return 0;
}
@ -1171,50 +1170,39 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ClearOverlays)
PARAM_INT_OPT(stop) { stop = 0; }
PARAM_BOOL_OPT(safety) { safety = true; }
if (!self->player)
if (self->player == nullptr)
ACTION_RETURN_INT(0);
player_t *player = self->player;
if (!start && !stop)
{
start = INT_MIN;
stop = safety ? PSP_TARGETCENTER - 1 : INT_MAX;
}
int count = 0;
DPSprite *pspr = player->psprites;
int startID = (pspr != nullptr) ? pspr->GetID() : start;
bool first = true;
while (pspr != nullptr)
{
if (pspr->GetID() == startID)
{
if (first)
first = false;
else
break;
}
int id = pspr->GetID();
unsigned int count = 0;
int id;
//Do not wipe out layer 0. Ever.
if (!id || id < start)
for (DPSprite *pspr = self->player->psprites; pspr != nullptr; pspr = pspr->GetNext())
{
id = pspr->GetID();
if (id < start || id == 0)
continue;
if (id > stop)
else if (id > stop)
break;
if (safety)
{
if (id >= PSP_TARGETCENTER)
break;
else if ((id >= PSP_STRIFEHANDS && id <= PSP_WEAPON) || (id == PSP_FLASH))
else if (id == PSP_STRIFEHANDS || id == PSP_WEAPON || id == PSP_FLASH)
continue;
}
// [MC]Don't affect non-hardcoded layers unless it's really desired.
pspr->SetState(nullptr);
count++;
pspr = pspr->GetNext();
}
ACTION_RETURN_INT(count);
}

View file

@ -220,8 +220,8 @@ int OriginalMain(int argc, char** argv)
@interface ApplicationController : NSResponder
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
<NSFileManagerDelegate>
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
<NSApplicationDelegate>
#endif
{
}

View file

@ -1677,7 +1677,7 @@ void R_DrawTiltedPlane (visplane_t *pl, double _xscale, double _yscale, fixed_t
// the textures a constant size across the surface's plane instead.
cosine = cos(planeang), sine = sin(planeang);
m[1] = pl->height.ZatPoint(ViewPos.X + yscale * sine, ViewPos.Y + yscale * cosine) - zeroheight;
n[1] = pl->height.ZatPoint(ViewPos.X - xscale * cosine, ViewPos.Y + xscale * sine) - zeroheight;
n[1] = -(pl->height.ZatPoint(ViewPos.X - xscale * cosine, ViewPos.Y + xscale * sine) - zeroheight);
plane_su = p ^ m;
plane_sv = p ^ n;

View file

@ -6129,6 +6129,7 @@ enum DMSS
DMSS_EXFILTER = 64, //Changes filter into a blacklisted class instead of whitelisted.
DMSS_EXSPECIES = 128, // ^ but with species instead.
DMSS_EITHER = 256, //Allow either type or species to be affected.
DMSS_INFLICTORDMGTYPE = 512, //Ignore the passed damagetype and use the inflictor's instead.
};
static void DoDamage(AActor *dmgtarget, AActor *inflictor, AActor *source, int amount, FName DamageType, int flags, PClassActor *filter, FName species)
@ -6153,6 +6154,9 @@ static void DoDamage(AActor *dmgtarget, AActor *inflictor, AActor *source, int a
if (amount > 0)
{ //Should wind up passing them through just fine.
if (flags & DMSS_INFLICTORDMGTYPE)
DamageType = inflictor->DamageType;
P_DamageMobj(dmgtarget, inflictor, source, amount, DamageType, dmgFlags);
}
else if (amount < 0)

View file

@ -38,6 +38,9 @@ const int CBAF_NORANDOM = 2;
const int CBAF_EXPLICITANGLE = 4;
const int CBAF_NOPITCH = 8;
const int CBAF_NORANDOMPUFFZ = 16;
const int CBAF_PUFFTARGET = 32;
const int CBAF_PUFFMASTER = 64;
const int CBAF_PUFFTRACER = 128;
// Flags for A_GunFlash
const int GFF_NOEXTCHANGE = 1;
@ -210,6 +213,9 @@ const int CPF_STEALARMOR = 32;
const int FPF_AIMATANGLE = 1;
const int FPF_TRANSFERTRANSLATION = 2;
const int FPF_NOAUTOAIM = 4;
const int FBF_PUFFTARGET = 64;
const int FBF_PUFFMASTER = 128;
const int FBF_PUFFTRACER = 256;
// Flags for A_Teleport
enum
@ -460,6 +466,7 @@ enum
DMSS_EXFILTER = 0x00000040,
DMSS_EXSPECIES = 0x00000080,
DMSS_EITHER = 0x00000100,
DMSS_INFLICTORDMGTYPE = 0x00000200,
};
// Flags for A_AlertMonsters