Skip to content

Commit

Permalink
Merge remote-tracking branch 'eduke32/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Hendricks266 committed Aug 28, 2023
2 parents 40d1552 + cbd86fd commit 7316d34
Show file tree
Hide file tree
Showing 15 changed files with 550 additions and 146 deletions.
77 changes: 77 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug EDuke32",
"type": "cppdbg",
"request": "launch",
"linux": {
"program": "${workspaceRoot}/eduke32",
},
"windows": {
"program": "${workspaceRoot}/eduke32.exe",
},
"cwd": "${workspaceRoot}",
},
{
"name": "Debug Mapster32",
"type": "cppdbg",
"request": "launch",
"linux": {
"program": "${workspaceRoot}/mapster32",
},
"windows": {
"program": "${workspaceRoot}/mapster32.exe",
},
"cwd": "${workspaceRoot}",
},
{
"name": "Debug VoidSW",
"type": "cppdbg",
"request": "launch",
"linux": {
"program": "${workspaceRoot}/voidsw",
},
"windows": {
"program": "${workspaceRoot}/voidsw.exe",
},
"cwd": "${workspaceRoot}",
},
{
"name": "Debug Wangulator",
"type": "cppdbg",
"request": "launch",
"linux": {
"program": "${workspaceRoot}/wangulator",
},
"windows": {
"program": "${workspaceRoot}/wangulator.exe",
},
"cwd": "${workspaceRoot}",
},
{
"name": "Debug EKenBuild",
"type": "cppdbg",
"request": "launch",
"linux": {
"program": "${workspaceRoot}/ekenbuild",
},
"windows": {
"program": "${workspaceRoot}/ekenbuild.exe",
},
"cwd": "${workspaceRoot}",
},
{
"name": "Debug EKenBuild-Editor",
"type": "cppdbg",
"request": "launch",
"linux": {
"program": "${workspaceRoot}/ekenbuild-editor",
},
"windows": {
"program": "${workspaceRoot}/ekenbuild-editor.exe",
},
"cwd": "${workspaceRoot}",
}
]
}
61 changes: 61 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "Build EDuke32 and Mapster32 Debug",
"linux": {
"command": "make RELEASE=0",
"details": "GNU Make for Linux"
},
"windows": {
"command": "mingw32-make.exe RELEASE=0",
"detail": "GNU Make with mingw32 for Windows"
},
"group": "build",
"problemMatcher": [],
},
{
"type": "shell",
"label": "Build VoidSW and Wangulator Debug",
"linux": {
"command": "make sw RELEASE=0",
"details": "GNU Make for Linux"
},
"windows": {
"command": "mingw32-make.exe sw RELEASE=0",
"detail": "GNU Make with mingw32 for Windows"
},
"group": "build",
"problemMatcher": [],
},
{
"type": "shell",
"label": "Build EKenbuild and EKenbuild-Editor Debug",
"linux": {
"command": "make kenbuild RELEASE=0",
"details": "GNU Make for Linux"
},
"windows": {
"command": "mingw32-make.exe kenbuild RELEASE=0",
"detail": "GNU Make with mingw32 for Windows"
},
"group": "build",
"problemMatcher": [],
},
{
"type": "shell",
"label": "Clean all",
"linux": {
"command": "make clean",
"details": "GNU Make for Linux"
},
"windows": {
"command": "mingw32-make.exe clean",
"detail": "GNU Make with mingw32 for Windows"
},
"group": "build",
"problemMatcher": [],
}
]
}
25 changes: 4 additions & 21 deletions source/build/include/build.h
Original file line number Diff line number Diff line change
Expand Up @@ -327,15 +327,6 @@ static FORCE_INLINE void sprite_tracker_hook__(intptr_t address);
//
// x86: http://en.wikipedia.org/wiki/Data_structure_alignment#Typical_alignment_of_C_structs_on_x86

enum {
SPR_XFLIP = 4,
SPR_YFLIP = 8,

SPR_WALL = 16,
SPR_FLOOR = 32,
SPR_ALIGN_MASK = 32+16,
};

#define UNTRACKED_STRUCTS__
#include "buildtypes.h"
#undef UNTRACKED_STRUCTS__
Expand Down Expand Up @@ -597,8 +588,7 @@ enum
TSPR_FLAGS_DRAW_LAST = 1u<<1u,
TSPR_FLAGS_NO_SHADOW = 1u<<2u,
TSPR_FLAGS_INVISIBLE_WITH_SHADOW = 1u<<3u,
TSPR_FLAGS_SLOPE_SPRITE = 1u<<4u,
TSPR_FLAGS_SLAB = 1u<<5u,
TSPR_FLAGS_SLAB = 1u<<4u,
};

EXTERN int32_t guniqhudid;
Expand Down Expand Up @@ -731,13 +721,6 @@ static inline tspriteptr_t renderMakeTSpriteFromSprite(tspriteptr_t const tspr,
tspr->clipdist = 0;
tspr->owner = spritenum;

if ((tspr->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == CSTAT_SPRITE_ALIGNMENT_SLOPE)
{
tspr->cstat &= ~CSTAT_SPRITE_ALIGNMENT_MASK;
tspr->cstat |= CSTAT_SPRITE_ALIGNMENT_FLOOR;
tspr->clipdist |= TSPR_FLAGS_SLOPE_SPRITE;
}

return tspr;
}

Expand All @@ -749,8 +732,8 @@ static inline tspriteptr_t renderAddTSpriteFromSprite(uint16_t const spritenum)
static inline void spriteSetSlope(uint16_t const spritenum, int16_t const heinum)
{
auto const spr = &sprite[spritenum];
uint16_t const cstat = spr->cstat & CSTAT_SPRITE_ALIGNMENT_MASK;
if (cstat != CSTAT_SPRITE_ALIGNMENT_FLOOR && cstat != CSTAT_SPRITE_ALIGNMENT_SLOPE)
uint16_t const cstat = spr->cstat;
if (!(cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR))
return;

spr->xoffset = heinum & 255;
Expand Down Expand Up @@ -1834,7 +1817,7 @@ extern void(*PolymostProcessVoxels_Callback)(void);

static inline int16_t tspriteGetSlope(tspriteptr_t const tspr)
{
if (!(tspr->clipdist & TSPR_FLAGS_SLOPE_SPRITE))
if ((tspr->cstat & CSTAT_SPRITE_ALIGNMENT) != CSTAT_SPRITE_ALIGNMENT_SLOPE)
return 0;
return uint8_t(tspr->xoffset) + (uint8_t(tspr->yoffset) << 8);
}
Expand Down
13 changes: 7 additions & 6 deletions source/build/src/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5513,7 +5513,7 @@ static void classicDrawSprite(int32_t snum)

if (tsprflags & TSPR_FLAGS_SLAB)
vtilenum = tilenum; // if the game wants voxels, it gets voxels
else if ((cstat & CSTAT_SPRITE_ALIGNMENT) != CSTAT_SPRITE_ALIGNMENT_FLOOR && usevoxels && tiletovox[tilenum] != -1 && spritenum != -1 && !(spriteext[spritenum].flags&SPREXT_NOTMD))
else if (!(cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR) && usevoxels && tiletovox[tilenum] != -1 && spritenum != -1 && !(spriteext[spritenum].flags&SPREXT_NOTMD))
{
vtilenum = tiletovox[tilenum];
tsprflags |= TSPR_FLAGS_SLAB;
Expand Down Expand Up @@ -5811,10 +5811,11 @@ static void classicDrawSprite(int32_t snum)
off.x = tspr->xoffset;
off.y = /*picanm[sprite[tspr->owner].picnum].yofs +*/ tspr->yoffset;
if (cstat & 4) off.x = -off.x;
if ((cstat & 8) && (tspr->cstat & CSTAT_SPRITE_ALIGNMENT) != CSTAT_SPRITE_ALIGNMENT_FACING) off.y = -off.y;
if ((cstat & 8) && ((tspr->cstat & CSTAT_SPRITE_ALIGNMENT) != CSTAT_SPRITE_ALIGNMENT_FACING || (tspr->clipdist & TSPR_FLAGS_SLAB)))
off.y = -off.y;
tspr->z -= off.y * tspr->yrepeat << 2;

const float xfactor = (tspr->cstat & CSTAT_SPRITE_ALIGNMENT) != CSTAT_SPRITE_ALIGNMENT_WALL ? (256.f/320.f) : 1.f;
const float xfactor = ((tspr->cstat & CSTAT_SPRITE_ALIGNMENT) != CSTAT_SPRITE_ALIGNMENT_WALL || (tspr->clipdist & TSPR_FLAGS_SLAB)) ? (256.f/320.f) : 1.f;
const int32_t xv = (int32_t)(tspr->xrepeat*sintable[(tspr->ang+2560+1536)&2047]*xfactor);
const int32_t yv = (int32_t)(tspr->xrepeat*sintable[(tspr->ang+2048+1536)&2047]*xfactor);

Expand Down Expand Up @@ -5891,7 +5892,7 @@ static void classicDrawSprite(int32_t snum)
const int32_t floorz = (sec->floorstat&3) == 0 ? sec->floorz : INT32_MAX;

classicDrawVoxel(x,y,z,i,daxrepeat,(int32_t)tspr->yrepeat,vtilenum,
tspr->shade,tspr->pal,lwall,swall,tspr->cstat,tsprflags,floorz,ceilingz);
tspr->shade,tspr->pal,lwall,swall,tspr->cstat,tspr->clipdist,floorz,ceilingz);
}
else if ((cstat & CSTAT_SPRITE_ALIGNMENT) == CSTAT_SPRITE_ALIGNMENT_FACING)
{
Expand Down Expand Up @@ -6374,7 +6375,7 @@ static void classicDrawSprite(int32_t snum)
drawing_sprite = 0;
globalht = nullptr;
}
else if ((cstat & CSTAT_SPRITE_ALIGNMENT) == CSTAT_SPRITE_ALIGNMENT_FLOOR)
else if (cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR)
{
if ((cstat&64) != 0)
if ((globalposz > tspriteGetZOfSlope(tspr, globalposx, globalposy)) == ((cstat&8)==0))
Expand Down Expand Up @@ -9875,7 +9876,7 @@ static void sortsprites(int const start, int const end)
auto const s = tspriteptr[k];
int32_t z = s->z;

if ((s->cstat & CSTAT_SPRITE_ALIGNMENT) != CSTAT_SPRITE_ALIGNMENT_FLOOR)
if (!(s->cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR))
{
int32_t const yoff = picanm[s->picnum].yofs + s->yoffset;
int32_t const yspan = (tilesiz[s->picnum].y * s->yrepeat << 2);
Expand Down
10 changes: 5 additions & 5 deletions source/build/src/mdsprite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1999,7 +1999,7 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr)
if (m->vbos == NULL)
mdloadvbos(m);

// if ((tspr->cstat & CSTAT_SPRITE_ALIGNMENT) == CSTAT_SPRITE_ALIGNMENT_FLOOR) return 0;
// if (tspr->cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR) return 0;

updateanimation((md2model_t *)m, tspr, lpal);

Expand Down Expand Up @@ -2033,7 +2033,7 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr)
k0 = (float)tspr->z+spriteext[tspr->owner].mdposition_offset.z;
f = ((globalorientation&8) && (sprite[tspr->owner].cstat & CSTAT_SPRITE_ALIGNMENT) != CSTAT_SPRITE_ALIGNMENT_FACING) ? -4.f : 4.f;
k0 -= (tspr->yoffset*tspr->yrepeat)*f;
if ((globalorientation&128) && (globalorientation & CSTAT_SPRITE_ALIGNMENT) != CSTAT_SPRITE_ALIGNMENT_FLOOR)
if ((globalorientation&128) && !(globalorientation & CSTAT_SPRITE_ALIGNMENT_FLOOR))
k0 += (float)(sizyrep<<1);

// Parkar: Changed to use the same method as centeroriented sprites
Expand All @@ -2056,7 +2056,7 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr)

// floor aligned
k1 = (float)tspr->y+spriteext[tspr->owner].mdposition_offset.y;
if ((globalorientation & CSTAT_SPRITE_ALIGNMENT) == CSTAT_SPRITE_ALIGNMENT_FLOOR)
if (globalorientation & CSTAT_SPRITE_ALIGNMENT_FLOOR)
{
m0.z = -m0.z; m1.z = -m1.z; a0.z = -a0.z;
m0.y = -m0.y; m1.y = -m1.y; a0.y = -a0.y;
Expand All @@ -2075,7 +2075,7 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr)
md3_vox_calcmat_common(tspr, &a0, f, mat);

// floor aligned
if ((globalorientation & CSTAT_SPRITE_ALIGNMENT) == CSTAT_SPRITE_ALIGNMENT_FLOOR)
if (globalorientation & CSTAT_SPRITE_ALIGNMENT_FLOOR)
{
f = mat[4]; mat[4] = mat[8]*16.f; mat[8] = -f*(1.f/16.f);
f = mat[5]; mat[5] = mat[9]*16.f; mat[9] = -f*(1.f/16.f);
Expand Down Expand Up @@ -2164,7 +2164,7 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr)
a0.y = (float) sext->mdpivot_offset.y * f;

if ((sext->mdpivot_offset.z) && !(tsprflags & TSPR_FLAGS_MDHACK)) // Compare with SCREEN_FACTORS above
a0.z = (float)(((tspr->cstat & CSTAT_SPRITE_ALIGNMENT) == CSTAT_SPRITE_ALIGNMENT_FLOOR) ? -sext->mdpivot_offset.z : sext->mdpivot_offset.z) / (gxyaspect * fxdimen * (65536.f/128.f) * (m0.z+m1.z));
a0.z = (float)((tspr->cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR) ? -sext->mdpivot_offset.z : sext->mdpivot_offset.z) / (gxyaspect * fxdimen * (65536.f/128.f) * (m0.z+m1.z));

k0 = (float)sintable[(sext->mdpitch+512)&2047] * (1.f/16384.f);
k1 = (float)sintable[sext->mdpitch&2047] * (1.f/16384.f);
Expand Down
Loading

0 comments on commit 7316d34

Please sign in to comment.