From 3cabd5f0edb49b9c884cdf7e32d84cf845b8fbf5 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sat, 23 Apr 2016 20:58:09 -0500 Subject: [PATCH] Fix compilation with GCC - GCC is pickier than Visual C++. GCC requires that structs with constructors, etc that are used in a union must be defined outside the union. VC++ lets you do it inline. --- src/r_things.cpp | 8 ++++---- src/r_things.h | 17 ++++++++--------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/r_things.cpp b/src/r_things.cpp index 24a357436..b930a1e92 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -678,7 +678,7 @@ void R_DrawVisVoxel(vissprite_t *spr, int minslabz, int maxslabz, short *cliptop } // Render the voxel, either directly to the screen or offscreen. - R_DrawVoxel(spr->vpos, spr->vang, spr->gpos, spr->angle, + R_DrawVoxel(spr->pa.vpos, spr->pa.vang, spr->gpos, spr->angle, spr->xscale, FLOAT2FIXED(spr->yscale), spr->voxel, spr->Style.colormap, cliptop, clipbot, minslabz, maxslabz, flags); @@ -1033,8 +1033,8 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor vis->angle -= ang.BAMs(); } - vis->vpos = { (float)ViewPos.X, (float)ViewPos.Y, (float)ViewPos.Z }; - vis->vang = FAngle((float)ViewAngle.Degrees); + vis->pa.vpos = { (float)ViewPos.X, (float)ViewPos.Y, (float)ViewPos.Z }; + vis->pa.vang = FAngle((float)ViewAngle.Degrees); } // killough 3/27/98: save sector for special clipping later @@ -1292,7 +1292,7 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, double sx, double if (avisp[0] == NULL) { - for (int i = 0; i < countof(avis); ++i) + for (unsigned i = 0; i < countof(avis); ++i) { avisp[i] = &avis[i]; } diff --git a/src/r_things.h b/src/r_things.h index 6dd93787f..97010713a 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -31,6 +31,12 @@ struct vissprite_t { + struct posang + { + FVector3 vpos; // view origin + FAngle vang; // view angle + }; + short x1, x2; FVector3 gpos; // origin in world coordinates union @@ -61,16 +67,9 @@ struct vissprite_t fixed_t xiscale; // negative if flipped }; // Used by wall sprites - struct - { - FWallCoords wallc; - }; + FWallCoords wallc; // Used by voxels - struct - { - FVector3 vpos; // view origin - FAngle vang; // view angle - }; + posang pa; }; sector_t *heightsec; // killough 3/27/98: height sector for underwater/fake ceiling sector_t *sector; // [RH] sector this sprite is in