mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-13 07:57:51 +00:00
Merge branch 'master' of https://github.com/coelckers/gzdoom
This commit is contained in:
commit
86c7e87767
6 changed files with 37 additions and 13 deletions
|
@ -438,6 +438,7 @@ PClassActor *PClassActor::GetReplacement(bool lookskill)
|
||||||
}
|
}
|
||||||
// The Replacement field is temporarily NULLed to prevent
|
// The Replacement field is temporarily NULLed to prevent
|
||||||
// potential infinite recursion.
|
// potential infinite recursion.
|
||||||
|
PClassActor *oldrep = ActorInfo()->Replacement;
|
||||||
ActorInfo()->Replacement = nullptr;
|
ActorInfo()->Replacement = nullptr;
|
||||||
PClassActor *rep = Replacement;
|
PClassActor *rep = Replacement;
|
||||||
// Handle skill-based replacement here. It has precedence on DECORATE replacement
|
// Handle skill-based replacement here. It has precedence on DECORATE replacement
|
||||||
|
@ -451,7 +452,7 @@ PClassActor *PClassActor::GetReplacement(bool lookskill)
|
||||||
// Skill replacements are not recursive, contrarily to DECORATE replacements
|
// Skill replacements are not recursive, contrarily to DECORATE replacements
|
||||||
rep = rep->GetReplacement(false);
|
rep = rep->GetReplacement(false);
|
||||||
// Reset the temporarily NULLed field
|
// Reset the temporarily NULLed field
|
||||||
ActorInfo()->Replacement = Replacement;
|
ActorInfo()->Replacement = oldrep;
|
||||||
return rep;
|
return rep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1158,6 +1158,14 @@ AInventory *AActor::DropInventory (AInventory *item, int amt)
|
||||||
drop->Vel += Vel;
|
drop->Vel += Vel;
|
||||||
drop->flags &= ~MF_NOGRAVITY; // Don't float
|
drop->flags &= ~MF_NOGRAVITY; // Don't float
|
||||||
drop->ClearCounters(); // do not count for statistics again
|
drop->ClearCounters(); // do not count for statistics again
|
||||||
|
{
|
||||||
|
// [MK] call OnDrop so item can change its drop behaviour
|
||||||
|
IFVIRTUALPTR(drop, AInventory, OnDrop)
|
||||||
|
{
|
||||||
|
VMValue params[] = { drop, this };
|
||||||
|
VMCall(func, params, 2, nullptr, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
return drop;
|
return drop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,11 +123,14 @@ void FUE1Model::LoadGeometry()
|
||||||
// unpack coords
|
// unpack coords
|
||||||
for ( int j=0; j<3; j++ )
|
for ( int j=0; j<3; j++ )
|
||||||
Poly.C[j] = FVector2(dpolys[i].uv[j][0]/255.f,dpolys[i].uv[j][1]/255.f);
|
Poly.C[j] = FVector2(dpolys[i].uv[j][0]/255.f,dpolys[i].uv[j][1]/255.f);
|
||||||
// compute facet normal
|
// compute facet normals
|
||||||
FVector3 dir[2];
|
for ( int j=0; j<numFrames; j++ )
|
||||||
dir[0] = verts[Poly.V[1]].Pos-verts[Poly.V[0]].Pos;
|
{
|
||||||
dir[1] = verts[Poly.V[2]].Pos-verts[Poly.V[0]].Pos;
|
FVector3 dir[2];
|
||||||
Poly.Normal = dir[0]^dir[1];
|
dir[0] = verts[Poly.V[1]+numVerts*j].Pos-verts[Poly.V[0]+numVerts*j].Pos;
|
||||||
|
dir[1] = verts[Poly.V[2]+numVerts*j].Pos-verts[Poly.V[0]+numVerts*j].Pos;
|
||||||
|
Poly.Normals.Push(dir[0]^dir[1]);
|
||||||
|
}
|
||||||
// push
|
// push
|
||||||
polys.Push(Poly);
|
polys.Push(Poly);
|
||||||
}
|
}
|
||||||
|
@ -142,7 +145,7 @@ void FUE1Model::LoadGeometry()
|
||||||
for ( int k=0; k<numPolys; k++ )
|
for ( int k=0; k<numPolys; k++ )
|
||||||
{
|
{
|
||||||
if ( (polys[k].V[0] != j) && (polys[k].V[1] != j) && (polys[k].V[2] != j) ) continue;
|
if ( (polys[k].V[0] != j) && (polys[k].V[1] != j) && (polys[k].V[2] != j) ) continue;
|
||||||
nsum += polys[k].Normal;
|
nsum += polys[k].Normals[i];
|
||||||
}
|
}
|
||||||
verts[j+numVerts*i].Normal = nsum.Unit();
|
verts[j+numVerts*i].Normal = nsum.Unit();
|
||||||
}
|
}
|
||||||
|
@ -198,6 +201,8 @@ void FUE1Model::UnloadGeometry()
|
||||||
numPolys = 0;
|
numPolys = 0;
|
||||||
numGroups = 0;
|
numGroups = 0;
|
||||||
verts.Reset();
|
verts.Reset();
|
||||||
|
for ( int i=0; i<numPolys; i++ )
|
||||||
|
polys[i].Normals.Reset();
|
||||||
polys.Reset();
|
polys.Reset();
|
||||||
for ( int i=0; i<numGroups; i++ )
|
for ( int i=0; i<numGroups; i++ )
|
||||||
groups[i].P.Reset();
|
groups[i].P.Reset();
|
||||||
|
@ -275,9 +280,9 @@ void FUE1Model::BuildVertexBuffer( FModelRenderer *renderer )
|
||||||
vert->Set(V.Pos.X,V.Pos.Y,V.Pos.Z,C.X,C.Y);
|
vert->Set(V.Pos.X,V.Pos.Y,V.Pos.Z,C.X,C.Y);
|
||||||
if ( groups[j].type&PT_Curvy ) // use facet normal
|
if ( groups[j].type&PT_Curvy ) // use facet normal
|
||||||
{
|
{
|
||||||
vert->SetNormal(polys[groups[j].P[k]].Normal.X,
|
vert->SetNormal(polys[groups[j].P[k]].Normals[i].X,
|
||||||
polys[groups[j].P[k]].Normal.Y,
|
polys[groups[j].P[k]].Normals[i].Y,
|
||||||
polys[groups[j].P[k]].Normal.Z);
|
polys[groups[j].P[k]].Normals[i].Z);
|
||||||
}
|
}
|
||||||
else vert->SetNormal(V.Normal.X,V.Normal.Y,V.Normal.Z);
|
else vert->SetNormal(V.Normal.X,V.Normal.Y,V.Normal.Z);
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ private:
|
||||||
{
|
{
|
||||||
int V[3];
|
int V[3];
|
||||||
FVector2 C[3];
|
FVector2 C[3];
|
||||||
FVector3 Normal;
|
TArray<FVector3> Normals;
|
||||||
};
|
};
|
||||||
struct UE1Group
|
struct UE1Group
|
||||||
{
|
{
|
||||||
|
|
|
@ -147,7 +147,7 @@ float R_DoomLightingEquation(float light)
|
||||||
lightscale = shade - vis;
|
lightscale = shade - vis;
|
||||||
|
|
||||||
// Result is the normalized colormap index (0 bright .. 1 dark)
|
// Result is the normalized colormap index (0 bright .. 1 dark)
|
||||||
return clamp(lightscale, 0.0, 31.0 / 32.0);
|
return clamp(lightscale, 1.0 - light, 31.0 / 32.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
|
@ -906,7 +906,17 @@ class Inventory : Actor native
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//
|
||||||
|
// AInventory :: OnDrop
|
||||||
|
//
|
||||||
|
// Called by AActor::DropInventory. Allows items to modify how they behave
|
||||||
|
// after being dropped.
|
||||||
|
//
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
|
virtual void OnDrop (Actor dropper) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
Loading…
Reference in a new issue