This commit is contained in:
nashmuhandes 2016-08-22 15:50:52 +08:00
commit bf3f495cea
16 changed files with 36 additions and 20 deletions

View file

@ -259,7 +259,7 @@ void DBot::ThinkForMove (ticcmd_t *cmd)
r = pr_botmove(); r = pr_botmove();
if (r < 128) if (r < 128)
{ {
TThinkerIterator<AInventory> it (STAT_INVENTORY, bglobal.firstthing); TThinkerIterator<AInventory> it (MAX_STATNUM+1, bglobal.firstthing);
AInventory *item = it.Next(); AInventory *item = it.Next();
if (item != NULL || (item = it.Next()) != NULL) if (item != NULL || (item = it.Next()) != NULL)

View file

@ -1452,7 +1452,8 @@ void FParser::SF_SetCamera(void)
newcamera->specialf1 = newcamera->Angles.Yaw.Degrees; newcamera->specialf1 = newcamera->Angles.Yaw.Degrees;
newcamera->specialf2 = newcamera->Z(); newcamera->specialf2 = newcamera->Z();
newcamera->SetZ(t_argc < 3 ? newcamera->Z() + 41 : floatvalue(t_argv[2])); double z = t_argc < 3 ? newcamera->Sector->floorplane.ZatPoint(newcamera) + 41 : floatvalue(t_argv[2]);
newcamera->SetOrigin(newcamera->PosAtZ(z), false);
newcamera->Angles.Yaw = angle; newcamera->Angles.Yaw = angle;
if (t_argc < 4) newcamera->Angles.Pitch = 0.; if (t_argc < 4) newcamera->Angles.Pitch = 0.;
else newcamera->Angles.Pitch = clamp(floatvalue(t_argv[3]), -50., 50.) * (20. / 32.); else newcamera->Angles.Pitch = clamp(floatvalue(t_argv[3]), -50., 50.) * (20. / 32.);

View file

@ -1280,7 +1280,7 @@ void G_FinishTravel ()
for (inv = pawn->Inventory; inv != NULL; inv = inv->Inventory) for (inv = pawn->Inventory; inv != NULL; inv = inv->Inventory)
{ {
inv->ChangeStatNum (STAT_INVENTORY); inv->ChangeStatNum (STAT_DEFAULT);
inv->LinkToWorld (); inv->LinkToWorld ();
inv->Travelled (); inv->Travelled ();
} }

View file

@ -572,7 +572,6 @@ bool AInventory::ShouldRespawn ()
void AInventory::BeginPlay () void AInventory::BeginPlay ()
{ {
Super::BeginPlay (); Super::BeginPlay ();
ChangeStatNum (STAT_INVENTORY);
flags |= MF_DROPPED; // [RH] Items are dropped by default flags |= MF_DROPPED; // [RH] Items are dropped by default
} }

View file

@ -116,6 +116,8 @@ public:
bool mDrawingScene2D = false; bool mDrawingScene2D = false;
float mCameraExposure = 1.0f; float mCameraExposure = 1.0f;
float mSceneClearColor[3];
FGLRenderer(OpenGLFrameBuffer *fb); FGLRenderer(OpenGLFrameBuffer *fb);
~FGLRenderer() ; ~FGLRenderer() ;

View file

@ -178,7 +178,7 @@ void FGLRenderer::Set3DViewport(bool mainview)
// This is faster on newer hardware because it allows the GPU to skip // This is faster on newer hardware because it allows the GPU to skip
// reading from slower memory where the full buffers are stored. // reading from slower memory where the full buffers are stored.
glDisable(GL_SCISSOR_TEST); glDisable(GL_SCISSOR_TEST);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClearColor(mSceneClearColor[0], mSceneClearColor[1], mSceneClearColor[2], 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
const auto &bounds = mSceneViewport; const auto &bounds = mSceneViewport;
@ -775,6 +775,9 @@ void FGLRenderer::SetFixedColormap (player_t *player)
sector_t * FGLRenderer::RenderViewpoint (AActor * camera, GL_IRECT * bounds, float fov, float ratio, float fovratio, bool mainview, bool toscreen) sector_t * FGLRenderer::RenderViewpoint (AActor * camera, GL_IRECT * bounds, float fov, float ratio, float fovratio, bool mainview, bool toscreen)
{ {
sector_t * retval; sector_t * retval;
mSceneClearColor[0] = 0.0f;
mSceneClearColor[1] = 0.0f;
mSceneClearColor[2] = 0.0f;
R_SetupFrame (camera); R_SetupFrame (camera);
SetViewArea(); SetViewArea();
@ -1251,8 +1254,9 @@ int FGLInterface::GetMaxViewPitch(bool down)
void FGLInterface::ClearBuffer(int color) void FGLInterface::ClearBuffer(int color)
{ {
PalEntry pe = GPalette.BaseColors[color]; PalEntry pe = GPalette.BaseColors[color];
glClearColor(pe.r/255.f, pe.g/255.f, pe.b/255.f, 1.f); GLRenderer->mSceneClearColor[0] = pe.r / 255.f;
glClear(GL_COLOR_BUFFER_BIT); GLRenderer->mSceneClearColor[1] = pe.g / 255.f;
GLRenderer->mSceneClearColor[2] = pe.b / 255.f;
} }
//=========================================================================== //===========================================================================

View file

@ -43,6 +43,7 @@
#include "gl/system/gl_interface.h" #include "gl/system/gl_interface.h"
#include "gl/system/gl_debug.h" #include "gl/system/gl_debug.h"
#include <set> #include <set>
#include <string>
#ifndef _MSC_VER #ifndef _MSC_VER
#include <signal.h> #include <signal.h>

View file

@ -157,7 +157,7 @@ void OpenGLFrameBuffer::InitializeState()
glEnable(GL_BLEND); glEnable(GL_BLEND);
glEnable(GL_DEPTH_CLAMP); glEnable(GL_DEPTH_CLAMP);
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D); if (gl.glslversion == 0) glEnable(GL_TEXTURE_2D);
glDisable(GL_LINE_SMOOTH); glDisable(GL_LINE_SMOOTH);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

View file

@ -53,7 +53,7 @@ enum
STAT_BOSSTARGET, // A boss brain target STAT_BOSSTARGET, // A boss brain target
STAT_LIGHTNING, // The lightning thinker STAT_LIGHTNING, // The lightning thinker
STAT_DECALTHINKER, // An object that thinks for a decal STAT_DECALTHINKER, // An object that thinks for a decal
STAT_INVENTORY, // An inventory item UNUSED_STAT_INVENTORY, // An inventory item (value kept for savegame compatibility.)
STAT_LIGHT, // A sector light effect STAT_LIGHT, // A sector light effect
STAT_LIGHTTRANSFER, // A sector light transfer. These must be ticked after the light effects!!! STAT_LIGHTTRANSFER, // A sector light transfer. These must be ticked after the light effects!!!
STAT_EARTHQUAKE, // Earthquake actors STAT_EARTHQUAKE, // Earthquake actors

View file

@ -343,7 +343,7 @@ static void FinishThingdef()
if (!def) if (!def)
{ {
Printf("No ActorInfo defined for class '%s'\n", ti->TypeName.GetChars()); Printf(TEXTCOLOR_RED "No ActorInfo defined for class '%s'\n", ti->TypeName.GetChars());
errorcount++; errorcount++;
continue; continue;
} }

View file

@ -1373,8 +1373,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfArmorType)
enum enum
{ {
XF_HURTSOURCE = 1, XF_HURTSOURCE = 1,
XF_NOTMISSILE = 4, XF_NOTMISSILE = 4,
XF_NOACTORTYPE = 1 << 3,
}; };
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Explode) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Explode)
@ -1388,6 +1389,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Explode)
PARAM_INT_OPT (nails) { nails = 0; } PARAM_INT_OPT (nails) { nails = 0; }
PARAM_INT_OPT (naildamage) { naildamage = 10; } PARAM_INT_OPT (naildamage) { naildamage = 10; }
PARAM_CLASS_OPT (pufftype, AActor) { pufftype = PClass::FindActor(NAME_BulletPuff); } PARAM_CLASS_OPT (pufftype, AActor) { pufftype = PClass::FindActor(NAME_BulletPuff); }
PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; }
if (damage < 0) // get parameters from metadata if (damage < 0) // get parameters from metadata
{ {
@ -1414,7 +1416,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Explode)
} }
} }
int count = P_RadiusAttack (self, self->target, damage, distance, self->DamageType, flags, fulldmgdistance); if (!(flags & XF_NOACTORTYPE) && damagetype == NAME_None)
{
damagetype = self->DamageType;
}
int count = P_RadiusAttack (self, self->target, damage, distance, damagetype, flags, fulldmgdistance);
P_CheckSplash(self, distance); P_CheckSplash(self, distance);
if (alert && self->target != NULL && self->target->player != NULL) if (alert && self->target != NULL && self->target->player != NULL)
{ {

View file

@ -4757,6 +4757,8 @@ FxExpression *FxReturnStatement::Resolve(FCompileContext &ctx)
ExpEmit FxReturnStatement::Emit(VMFunctionBuilder *build) ExpEmit FxReturnStatement::Emit(VMFunctionBuilder *build)
{ {
ExpEmit out(0, REGT_NIL);
// If we return nothing, use a regular RET opcode. // If we return nothing, use a regular RET opcode.
// Otherwise just return the value we're given. // Otherwise just return the value we're given.
if (Value == nullptr) if (Value == nullptr)
@ -4765,11 +4767,11 @@ ExpEmit FxReturnStatement::Emit(VMFunctionBuilder *build)
} }
else else
{ {
ExpEmit ret = Value->Emit(build); out = Value->Emit(build);
// Check if it is a function call that simplified itself // Check if it is a function call that simplified itself
// into a tail call in which case we don't emit anything. // into a tail call in which case we don't emit anything.
if (!ret.Final) if (!out.Final)
{ {
if (Value->ValueType == TypeVoid) if (Value->ValueType == TypeVoid)
{ // Nothing is returned. { // Nothing is returned.
@ -4777,12 +4779,11 @@ ExpEmit FxReturnStatement::Emit(VMFunctionBuilder *build)
} }
else else
{ {
build->Emit(OP_RET, RET_FINAL, ret.RegType | (ret.Konst ? REGT_KONST : 0), ret.RegNum); build->Emit(OP_RET, RET_FINAL, out.RegType | (out.Konst ? REGT_KONST : 0), out.RegNum);
} }
} }
} }
ExpEmit out;
out.Final = true; out.Final = true;
return out; return out;
} }

View file

@ -253,7 +253,7 @@ ACTOR Actor native //: Thinker
action native A_Blast(int flags = 0, float strength = 255, float radius = 255, float speed = 20, class<Actor> blasteffect = "BlastEffect", sound blastsound = "BlastRadius"); action native A_Blast(int flags = 0, float strength = 255, float radius = 255, float speed = 20, class<Actor> blasteffect = "BlastEffect", sound blastsound = "BlastRadius");
action native A_RadiusThrust(int force = 128, int distance = -1, int flags = RTF_AFFECTSOURCE, int fullthrustdistance = 0); action native A_RadiusThrust(int force = 128, int distance = -1, int flags = RTF_AFFECTSOURCE, int fullthrustdistance = 0);
action native A_RadiusDamageSelf(int damage = 128, float distance = 128, int flags = 0, class<Actor> flashtype = "None"); action native A_RadiusDamageSelf(int damage = 128, float distance = 128, int flags = 0, class<Actor> flashtype = "None");
action native int A_Explode(int damage = -1, int distance = -1, int flags = XF_HURTSOURCE, bool alert = false, int fulldamagedistance = 0, int nails = 0, int naildamage = 10, class<Actor> pufftype = "BulletPuff"); action native int A_Explode(int damage = -1, int distance = -1, int flags = XF_HURTSOURCE, bool alert = false, int fulldamagedistance = 0, int nails = 0, int naildamage = 10, class<Actor> pufftype = "BulletPuff", name damagetype = "none");
action native A_Stop(); action native A_Stop();
action native A_Respawn(int flags = 1); action native A_Respawn(int flags = 1);
action native A_BarrelDestroy(); action native A_BarrelDestroy();

View file

@ -185,6 +185,7 @@ const int MSF_DontHurt = 2;
// Flags for A_Explode // Flags for A_Explode
const int XF_HURTSOURCE = 1; const int XF_HURTSOURCE = 1;
const int XF_NOTMISSILE = 4; const int XF_NOTMISSILE = 4;
const int XF_EXPLICITDAMAGETYPE = 1 << 3;
// Flags for A_RadiusThrust // Flags for A_RadiusThrust
const int RTF_AFFECTSOURCE = 1; const int RTF_AFFECTSOURCE = 1;

View file

@ -108,7 +108,5 @@ CMPTMNU_SECTORSOUNDS = "Sector sounds use centre as source";
OPTVAL_MAPDEFINEDCOLORSONLY = "Map defined colours only"; OPTVAL_MAPDEFINEDCOLORSONLY = "Map defined colours only";
C_GRAY = "\ccgrey"; C_GRAY = "\ccgrey";
C_DARKGRAY = "\cudark grey"; C_DARKGRAY = "\cudark grey";
DSPLYMNU_MOVEBOB = "View bob amount while moving";
DSPLYMNU_STILLBOB = "View bob amount while not moving";
OPTVAL_ANYFIXEDCOLORMAP = "Any fixed colourmap"; OPTVAL_ANYFIXEDCOLORMAP = "Any fixed colourmap";

View file

@ -1800,6 +1800,8 @@ DSPLYMNU_QUAKEINTENSITY = "Earthquake shake intensity";
DSPLYMNU_NOMONSTERINTERPOLATION = "Interpolate monster movement"; DSPLYMNU_NOMONSTERINTERPOLATION = "Interpolate monster movement";
DSPLYMNU_MENUDIM = "Menu dim"; DSPLYMNU_MENUDIM = "Menu dim";
DSPLYMNU_DIMCOLOR = "Dim color"; DSPLYMNU_DIMCOLOR = "Dim color";
DSPLYMNU_MOVEBOB = "View bob amount while moving";
DSPLYMNU_STILLBOB = "View bob amount while not moving";
// HUD Options // HUD Options
HUDMNU_TITLE = "HUD Options"; HUDMNU_TITLE = "HUD Options";