- Fixed GCC compilation again.

- PClass::StaticInit() now sorts the class metadata so that operations that
  iterate over it (such as the "give all" cheat) are compiler-independant.


SVN r340 (trunk)
This commit is contained in:
Randy Heit 2006-09-27 04:56:18 +00:00
parent a4a23d1b25
commit 6c3b569e66
4 changed files with 36 additions and 1 deletions

View file

@ -1,3 +1,7 @@
September 26, 2006
- PClass::StaticInit() now sorts the class metadata so that operations that
iterate over it (such as the "give all" cheat) are compiler-independant.
September 25, 2006 (Changes by Graf Zahl)
- Fixed: ACustomInventory::CallStateChain couldn't be called recursively
so any item that was giving another CustomInventory item didn't work

View file

@ -38,6 +38,9 @@
#include "tarray.h"
#include "doomtype.h"
#include "m_alloc.h"
#ifndef _MSC_VER
#include "autosegs.h"
#endif
struct PClass;

View file

@ -2,6 +2,7 @@
#include "i_system.h"
#include "actor.h"
#include "autosegs.h"
#include "templates.h"
TArray<PClass *> PClass::m_RuntimeActors;
TArray<PClass *> PClass::m_Types;
@ -10,10 +11,31 @@ PClass *PClass::TypeHash[PClass::HASH_SIZE];
// A harmless non_NULL FlatPointer for classes without pointers.
static const size_t TheEnd = ~0;
static int STACK_ARGS cregcmp (const void *a, const void *b)
{
// VC++ introduces NULLs in the sequence. GCC seems to work as expected and not do it.
const ClassReg *class1 = *(const ClassReg **)a;
const ClassReg *class2 = *(const ClassReg **)b;
if (class1 == NULL) return 1;
if (class2 == NULL) return -1;
return strcmp (class1->Name, class2->Name);
}
void PClass::StaticInit ()
{
atterm (StaticShutdown);
// Sort classes by name to remove dependance on how the compiler ordered them.
REGINFO *head = &CRegHead;
REGINFO *tail = &CRegTail;
// MinGW's linker is linking the object files backwards for me now...
if (head > tail)
{
swap (head, tail);
}
qsort (head + 1, tail - head - 1, sizeof(REGINFO), cregcmp);
TAutoSegIterator<ClassReg *, &CRegHead, &CRegTail> probe;
while (++probe != NULL)

View file

@ -1470,8 +1470,14 @@ void R_DrawTiltedPlane (visplane_t *pl, fixed_t alpha, bool masked)
pviewy = MulScale (pl->yoffs, pl->yscale, ds_ybits);
ang = (ANG270 - viewangle) >> ANGLETOFINESHIFT;
// Printf ("%u %d %d\n", ang, finecosine[ang], finesine[ang]);
p[0] = FIXED2FLOAT(DMulScale16 (viewx, finecosine[ang], -viewy, finesine[ang]));
p[2] = FIXED2FLOAT(DMulScale16 (viewx, finesine[ang], viewy, finecosine[ang]));
// double dang = 1.5*M_PI - double(viewangle)*M_PI/2147483648.0;
// double vx = viewx/65536.0, vy = viewy/65536.0;
// double dcos = cos(dang), dsin = sin(dang);
// p[0] = vx * dcos - vy * dsin;
// p[2] = vx * dsin + vy * dcos;
p[1] = FIXED2FLOAT(pl->height.ZatPoint (0, 0) - viewz);
// m is the v direction vector in view space
@ -1671,7 +1677,7 @@ bool R_AlignFlat (int linenum, int side, int fc)
angle_t angle = R_PointToAngle2 (x, y, line->v2->x, line->v2->y);
angle_t norm = (angle-ANGLE_90) >> ANGLETOFINESHIFT;
fixed_t dist = -FixedMul (finecosine[norm], x) - FixedMul (finesine[norm], y);
fixed_t dist = -DMulScale16 (finecosine[norm], x, finesine[norm], y);
if (side)
{