Skip to content

Commit 7316d34

Browse files
committed
Merge remote-tracking branch 'eduke32/master'
2 parents 40d1552 + cbd86fd commit 7316d34

File tree

15 files changed

+550
-146
lines changed

15 files changed

+550
-146
lines changed

.vscode/launch.json

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Debug EDuke32",
6+
"type": "cppdbg",
7+
"request": "launch",
8+
"linux": {
9+
"program": "${workspaceRoot}/eduke32",
10+
},
11+
"windows": {
12+
"program": "${workspaceRoot}/eduke32.exe",
13+
},
14+
"cwd": "${workspaceRoot}",
15+
},
16+
{
17+
"name": "Debug Mapster32",
18+
"type": "cppdbg",
19+
"request": "launch",
20+
"linux": {
21+
"program": "${workspaceRoot}/mapster32",
22+
},
23+
"windows": {
24+
"program": "${workspaceRoot}/mapster32.exe",
25+
},
26+
"cwd": "${workspaceRoot}",
27+
},
28+
{
29+
"name": "Debug VoidSW",
30+
"type": "cppdbg",
31+
"request": "launch",
32+
"linux": {
33+
"program": "${workspaceRoot}/voidsw",
34+
},
35+
"windows": {
36+
"program": "${workspaceRoot}/voidsw.exe",
37+
},
38+
"cwd": "${workspaceRoot}",
39+
},
40+
{
41+
"name": "Debug Wangulator",
42+
"type": "cppdbg",
43+
"request": "launch",
44+
"linux": {
45+
"program": "${workspaceRoot}/wangulator",
46+
},
47+
"windows": {
48+
"program": "${workspaceRoot}/wangulator.exe",
49+
},
50+
"cwd": "${workspaceRoot}",
51+
},
52+
{
53+
"name": "Debug EKenBuild",
54+
"type": "cppdbg",
55+
"request": "launch",
56+
"linux": {
57+
"program": "${workspaceRoot}/ekenbuild",
58+
},
59+
"windows": {
60+
"program": "${workspaceRoot}/ekenbuild.exe",
61+
},
62+
"cwd": "${workspaceRoot}",
63+
},
64+
{
65+
"name": "Debug EKenBuild-Editor",
66+
"type": "cppdbg",
67+
"request": "launch",
68+
"linux": {
69+
"program": "${workspaceRoot}/ekenbuild-editor",
70+
},
71+
"windows": {
72+
"program": "${workspaceRoot}/ekenbuild-editor.exe",
73+
},
74+
"cwd": "${workspaceRoot}",
75+
}
76+
]
77+
}

.vscode/tasks.json

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "shell",
6+
"label": "Build EDuke32 and Mapster32 Debug",
7+
"linux": {
8+
"command": "make RELEASE=0",
9+
"details": "GNU Make for Linux"
10+
},
11+
"windows": {
12+
"command": "mingw32-make.exe RELEASE=0",
13+
"detail": "GNU Make with mingw32 for Windows"
14+
},
15+
"group": "build",
16+
"problemMatcher": [],
17+
},
18+
{
19+
"type": "shell",
20+
"label": "Build VoidSW and Wangulator Debug",
21+
"linux": {
22+
"command": "make sw RELEASE=0",
23+
"details": "GNU Make for Linux"
24+
},
25+
"windows": {
26+
"command": "mingw32-make.exe sw RELEASE=0",
27+
"detail": "GNU Make with mingw32 for Windows"
28+
},
29+
"group": "build",
30+
"problemMatcher": [],
31+
},
32+
{
33+
"type": "shell",
34+
"label": "Build EKenbuild and EKenbuild-Editor Debug",
35+
"linux": {
36+
"command": "make kenbuild RELEASE=0",
37+
"details": "GNU Make for Linux"
38+
},
39+
"windows": {
40+
"command": "mingw32-make.exe kenbuild RELEASE=0",
41+
"detail": "GNU Make with mingw32 for Windows"
42+
},
43+
"group": "build",
44+
"problemMatcher": [],
45+
},
46+
{
47+
"type": "shell",
48+
"label": "Clean all",
49+
"linux": {
50+
"command": "make clean",
51+
"details": "GNU Make for Linux"
52+
},
53+
"windows": {
54+
"command": "mingw32-make.exe clean",
55+
"detail": "GNU Make with mingw32 for Windows"
56+
},
57+
"group": "build",
58+
"problemMatcher": [],
59+
}
60+
]
61+
}

source/build/include/build.h

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -327,15 +327,6 @@ static FORCE_INLINE void sprite_tracker_hook__(intptr_t address);
327327
//
328328
// x86: http://en.wikipedia.org/wiki/Data_structure_alignment#Typical_alignment_of_C_structs_on_x86
329329

330-
enum {
331-
SPR_XFLIP = 4,
332-
SPR_YFLIP = 8,
333-
334-
SPR_WALL = 16,
335-
SPR_FLOOR = 32,
336-
SPR_ALIGN_MASK = 32+16,
337-
};
338-
339330
#define UNTRACKED_STRUCTS__
340331
#include "buildtypes.h"
341332
#undef UNTRACKED_STRUCTS__
@@ -597,8 +588,7 @@ enum
597588
TSPR_FLAGS_DRAW_LAST = 1u<<1u,
598589
TSPR_FLAGS_NO_SHADOW = 1u<<2u,
599590
TSPR_FLAGS_INVISIBLE_WITH_SHADOW = 1u<<3u,
600-
TSPR_FLAGS_SLOPE_SPRITE = 1u<<4u,
601-
TSPR_FLAGS_SLAB = 1u<<5u,
591+
TSPR_FLAGS_SLAB = 1u<<4u,
602592
};
603593

604594
EXTERN int32_t guniqhudid;
@@ -731,13 +721,6 @@ static inline tspriteptr_t renderMakeTSpriteFromSprite(tspriteptr_t const tspr,
731721
tspr->clipdist = 0;
732722
tspr->owner = spritenum;
733723

734-
if ((tspr->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == CSTAT_SPRITE_ALIGNMENT_SLOPE)
735-
{
736-
tspr->cstat &= ~CSTAT_SPRITE_ALIGNMENT_MASK;
737-
tspr->cstat |= CSTAT_SPRITE_ALIGNMENT_FLOOR;
738-
tspr->clipdist |= TSPR_FLAGS_SLOPE_SPRITE;
739-
}
740-
741724
return tspr;
742725
}
743726

@@ -749,8 +732,8 @@ static inline tspriteptr_t renderAddTSpriteFromSprite(uint16_t const spritenum)
749732
static inline void spriteSetSlope(uint16_t const spritenum, int16_t const heinum)
750733
{
751734
auto const spr = &sprite[spritenum];
752-
uint16_t const cstat = spr->cstat & CSTAT_SPRITE_ALIGNMENT_MASK;
753-
if (cstat != CSTAT_SPRITE_ALIGNMENT_FLOOR && cstat != CSTAT_SPRITE_ALIGNMENT_SLOPE)
735+
uint16_t const cstat = spr->cstat;
736+
if (!(cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR))
754737
return;
755738

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

18351818
static inline int16_t tspriteGetSlope(tspriteptr_t const tspr)
18361819
{
1837-
if (!(tspr->clipdist & TSPR_FLAGS_SLOPE_SPRITE))
1820+
if ((tspr->cstat & CSTAT_SPRITE_ALIGNMENT) != CSTAT_SPRITE_ALIGNMENT_SLOPE)
18381821
return 0;
18391822
return uint8_t(tspr->xoffset) + (uint8_t(tspr->yoffset) << 8);
18401823
}

source/build/src/engine.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5513,7 +5513,7 @@ static void classicDrawSprite(int32_t snum)
55135513

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

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

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

58935894
classicDrawVoxel(x,y,z,i,daxrepeat,(int32_t)tspr->yrepeat,vtilenum,
5894-
tspr->shade,tspr->pal,lwall,swall,tspr->cstat,tsprflags,floorz,ceilingz);
5895+
tspr->shade,tspr->pal,lwall,swall,tspr->cstat,tspr->clipdist,floorz,ceilingz);
58955896
}
58965897
else if ((cstat & CSTAT_SPRITE_ALIGNMENT) == CSTAT_SPRITE_ALIGNMENT_FACING)
58975898
{
@@ -6374,7 +6375,7 @@ static void classicDrawSprite(int32_t snum)
63746375
drawing_sprite = 0;
63756376
globalht = nullptr;
63766377
}
6377-
else if ((cstat & CSTAT_SPRITE_ALIGNMENT) == CSTAT_SPRITE_ALIGNMENT_FLOOR)
6378+
else if (cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR)
63786379
{
63796380
if ((cstat&64) != 0)
63806381
if ((globalposz > tspriteGetZOfSlope(tspr, globalposx, globalposy)) == ((cstat&8)==0))
@@ -9875,7 +9876,7 @@ static void sortsprites(int const start, int const end)
98759876
auto const s = tspriteptr[k];
98769877
int32_t z = s->z;
98779878

9878-
if ((s->cstat & CSTAT_SPRITE_ALIGNMENT) != CSTAT_SPRITE_ALIGNMENT_FLOOR)
9879+
if (!(s->cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR))
98799880
{
98809881
int32_t const yoff = picanm[s->picnum].yofs + s->yoffset;
98819882
int32_t const yspan = (tilesiz[s->picnum].y * s->yrepeat << 2);

source/build/src/mdsprite.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1999,7 +1999,7 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr)
19991999
if (m->vbos == NULL)
20002000
mdloadvbos(m);
20012001

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

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

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

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

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

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

21662166
if ((sext->mdpivot_offset.z) && !(tsprflags & TSPR_FLAGS_MDHACK)) // Compare with SCREEN_FACTORS above
2167-
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));
2167+
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));
21682168

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

0 commit comments

Comments
 (0)