Merge branch 'master' of https://github.com/rheit/zdoom into zscript

This commit is contained in:
Christoph Oelckers 2016-10-11 00:57:31 +02:00
commit acec2e5b07
5 changed files with 147 additions and 39 deletions

View file

@ -5821,43 +5821,54 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
// [ZK] A_Warp in ACS
case ACSF_Warp:
{
int tid_dest = args[0];
int xofs = args[1];
int yofs = args[2];
int zofs = args[3];
int angle = args[4];
int flags = args[5];
const char *statename = argCount > 6 ? FBehavior::StaticLookupString(args[6]) : "";
bool exact = argCount > 7 ? !!args[7] : false;
int heightoffset = argCount > 8 ? args[8] : 0;
int radiusoffset = argCount > 9 ? args[9] : 0;
int pitch = argCount > 10 ? args[10] : 0;
FState *state = argCount > 6 ? activator->GetClass()->FindStateByString(statename, exact) : 0;
AActor *reference;
if((flags & WARPF_USEPTR) && tid_dest != AAPTR_DEFAULT)
if (nullptr == activator)
{
reference = COPY_AAPTR(activator, tid_dest);
}
else
{
reference = SingleActorFromTID(tid_dest, activator);
}
// If there is no activator or actor to warp to, fail.
if (activator == NULL || !reference)
return false;
}
if (P_Thing_Warp(activator, reference, ACSToDouble(xofs), ACSToDouble(yofs), ACSToDouble(zofs), ACSToAngle(angle), flags, ACSToDouble(heightoffset), ACSToDouble(radiusoffset), ACSToAngle(pitch)))
const int dest = args[0];
const int flags = args[5];
AActor* const reference = ((flags & WARPF_USEPTR) && (AAPTR_DEFAULT != dest))
? COPY_AAPTR(activator, dest)
: SingleActorFromTID(dest, activator);
if (nullptr == reference)
{
if (state && argCount > 6)
// there is no actor to warp to
return false;
}
const double xofs = ACSToDouble(args[1]);
const double yofs = ACSToDouble(args[2]);
const double zofs = ACSToDouble(args[3]);
const DAngle angle = ACSToAngle(args[4]);
const double heightoffset = argCount > 8 ? ACSToDouble(args[8]) : 0.0;
const double radiusoffset = argCount > 9 ? ACSToDouble(args[9]) : 0.0;
const DAngle pitch = ACSToAngle(argCount > 10 ? args[10] : 0);
if (!P_Thing_Warp(activator, reference, xofs, yofs, zofs, angle, flags, heightoffset, radiusoffset, pitch))
{
return false;
}
if (argCount > 6)
{
const char* const statename = FBehavior::StaticLookupString(args[6]);
if (nullptr != statename)
{
const bool exact = argCount > 7 && !!args[7];
FState* const state = activator->GetClass()->FindStateByString(statename, exact);
if (nullptr != state)
{
activator->SetState(state);
}
return true;
}
return false;
}
return true;
}
case ACSF_GetMaxInventory:
actor = SingleActorFromTID(args[0], activator);

View file

@ -1006,7 +1006,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_OverlayOffset)
PARAM_FLOAT_OPT(wx) { wx = 0.; }
PARAM_FLOAT_OPT(wy) { wy = 32.; }
PARAM_INT_OPT(flags) { flags = 0; }
A_OverlayOffset(self, layer, wx, wy, flags);
A_OverlayOffset(self, ((layer != 0) ? layer : stateinfo->mPSPIndex), wx, wy, flags);
return 0;
}
@ -1033,10 +1033,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_OverlayFlags)
PARAM_INT(flags);
PARAM_BOOL(set);
if (self->player == nullptr)
if (!ACTION_CALL_FROM_PSPRITE())
return 0;
DPSprite *pspr = self->player->FindPSprite(layer);
DPSprite *pspr = self->player->FindPSprite(((layer != 0) ? layer : stateinfo->mPSPIndex));
if (pspr == nullptr)
return 0;
@ -1049,6 +1049,52 @@ DEFINE_ACTION_FUNCTION(AActor, A_OverlayFlags)
return 0;
}
//---------------------------------------------------------------------------
//
// PROC OverlayX/Y
// Action function to return the X/Y of an overlay.
//---------------------------------------------------------------------------
static double GetOverlayPosition(AActor *self, int layer, bool gety)
{
if (layer)
{
DPSprite *pspr = self->player->FindPSprite(layer);
if (pspr != nullptr)
{
return gety ? (pspr->y) : (pspr->x);
}
}
return 0.;
}
DEFINE_ACTION_FUNCTION(AActor, OverlayX)
{
PARAM_ACTION_PROLOGUE;
PARAM_INT_OPT(layer) { layer = 0; }
if (ACTION_CALL_FROM_PSPRITE())
{
double res = GetOverlayPosition(self, ((layer != 0) ? layer : stateinfo->mPSPIndex), false);
ACTION_RETURN_FLOAT(res);
}
ACTION_RETURN_FLOAT(0.);
}
DEFINE_ACTION_FUNCTION(AActor, OverlayY)
{
PARAM_ACTION_PROLOGUE;
PARAM_INT_OPT(layer) { layer = 0; }
if (ACTION_CALL_FROM_PSPRITE())
{
double res = GetOverlayPosition(self, ((layer != 0) ? layer : stateinfo->mPSPIndex), true);
ACTION_RETURN_FLOAT(res);
}
ACTION_RETURN_FLOAT(0.);
}
//---------------------------------------------------------------------------
//
// PROC OverlayID

View file

@ -130,6 +130,53 @@ void Mac_I_FatalError(const char* const message)
}
static void I_DetectOS()
{
SInt32 majorVersion = 0;
Gestalt(gestaltSystemVersionMajor, &majorVersion);
SInt32 minorVersion = 0;
Gestalt(gestaltSystemVersionMinor, &minorVersion);
SInt32 bugFixVersion = 0;
Gestalt(gestaltSystemVersionBugFix, &bugFixVersion);
const char* name = "Unknown version";
if (10 == majorVersion) switch (minorVersion)
{
case 4: name = "Mac OS X Tiger"; break;
case 5: name = "Mac OS X Leopard"; break;
case 6: name = "Mac OS X Snow Leopard"; break;
case 7: name = "Mac OS X Lion"; break;
case 8: name = "OS X Mountain Lion"; break;
case 9: name = "OS X Mavericks"; break;
case 10: name = "OS X Yosemite"; break;
case 11: name = "OS X El Capitan"; break;
case 12: name = "macOS Sierra"; break;
}
char release[16] = {};
size_t size = sizeof release - 1;
sysctlbyname("kern.osversion", release, &size, nullptr, 0);
const char* const architecture =
#ifdef __i386__
"32-bit Intel";
#elif defined __x86_64__
"64-bit Intel";
#elif defined __ppc__
"32-bit PowerPC";
#elif defined __ppc64__
"64-bit PowerPC";
#else
"Unknown";
#endif
Printf("OS: %s %d.%d.%d (%s) %s\n", name, majorVersion, minorVersion, bugFixVersion, release, architecture);
}
DArgs* Args; // command line arguments
@ -165,6 +212,8 @@ void OriginalMainTry(int argc, char** argv)
progdir += "/";
C_InitConsole(80 * 8, 25 * 8, false);
I_DetectOS();
D_DoomMain();
}

View file

@ -1436,7 +1436,7 @@ DEFINE_PROPERTY(spriterotation, F, Actor)
//==========================================================================
//
//==========================================================================
DEFINE_PROPERTY(visibleangles, Ff, Actor)
DEFINE_PROPERTY(visibleangles, FF, Actor)
{
PROP_DOUBLE_PARM(visstart, 0);
PROP_DOUBLE_PARM(visend, 1);
@ -1447,7 +1447,7 @@ DEFINE_PROPERTY(visibleangles, Ff, Actor)
//==========================================================================
//
//==========================================================================
DEFINE_PROPERTY(visiblepitch, Ff, Actor)
DEFINE_PROPERTY(visiblepitch, FF, Actor)
{
PROP_DOUBLE_PARM(visstart, 0);
PROP_DOUBLE_PARM(visend, 1);

View file

@ -58,6 +58,8 @@ ACTOR Actor native //: Thinker
native float GetSpriteRotation(int ptr = AAPTR_DEFAULT);
native int GetMissileDamage(int mask, int add, int ptr = AAPTR_DEFAULT);
action native int OverlayID();
action native float OverlayX(int layer = 0);
action native float OverlayY(int layer = 0);
// Action functions
// Meh, MBF redundant functions. Only for DeHackEd support.