Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Adam Jones
EDuke32
Commits
4a151cdb
Commit
4a151cdb
authored
Mar 26, 2020
by
nukeykt
Committed by
Richard Gobeille
Apr 05, 2020
Browse files
Add slope sprites to renderer
parent
95dce4b4
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
source/build/include/build.h
View file @
4a151cdb
...
...
@@ -585,6 +585,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
,
};
EXTERN
int32_t
guniqhudid
;
...
...
@@ -715,6 +716,13 @@ 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
;
}
...
...
@@ -723,6 +731,28 @@ static inline tspriteptr_t renderAddTSpriteFromSprite(uint16_t const spritenum)
return
renderMakeTSpriteFromSprite
(
&
tsprite
[
spritesortcnt
++
],
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
)
return
;
spr
->
xoffset
=
heinum
&
255
;
spr
->
yoffset
=
(
heinum
>>
8
)
&
255
;
spr
->
cstat
&=
~
CSTAT_SPRITE_ALIGNMENT_MASK
;
spr
->
cstat
|=
heinum
!=
0
?
CSTAT_SPRITE_ALIGNMENT_SLOPE
:
CSTAT_SPRITE_ALIGNMENT_FLOOR
;
}
static
inline
int16_t
spriteGetSlope
(
uint16_t
const
spritenum
)
{
auto
const
spr
=
&
sprite
[
spritenum
];
uint16_t
const
cstat
=
spr
->
cstat
&
CSTAT_SPRITE_ALIGNMENT_MASK
;
if
(
cstat
!=
CSTAT_SPRITE_ALIGNMENT_SLOPE
)
return
0
;
return
uint8_t
(
spr
->
xoffset
)
+
(
uint8_t
(
spr
->
yoffset
)
<<
8
);
}
EXTERN
int16_t
maskwall
[
MAXWALLSB
],
maskwallcnt
;
EXTERN
int16_t
thewall
[
MAXWALLSB
];
...
...
@@ -1675,6 +1705,34 @@ extern int32_t rintersect(int32_t x1, int32_t y1, int32_t z1,
int32_t
x3
,
int32_t
y3
,
int32_t
x4
,
int32_t
y4
,
int32_t
*
intx
,
int32_t
*
inty
,
int32_t
*
intz
);
static
inline
int16_t
tspriteGetSlope
(
tspriteptr_t
const
tspr
)
{
if
(
!
(
tspr
->
clipdist
&
TSPR_FLAGS_SLOPE_SPRITE
))
return
0
;
return
uint8_t
(
tspr
->
xoffset
)
+
(
uint8_t
(
tspr
->
yoffset
)
<<
8
);
}
static
inline
int32_t
tspriteGetZOfSlope
(
tspriteptr_t
const
tspr
,
int32_t
dax
,
int32_t
day
)
{
int16_t
const
heinum
=
tspriteGetSlope
(
tspr
);
if
(
heinum
==
0
)
return
tspr
->
z
;
int
const
j
=
dmulscale4
(
sintable
[(
tspr
->
ang
+
1024
)
&
2047
],
day
-
tspr
->
y
,
-
sintable
[(
tspr
->
ang
+
512
)
&
2047
],
dax
-
tspr
->
x
);
return
tspr
->
z
+
mulscale18
(
heinum
,
j
);
}
static
inline
float
tspriteGetZOfSlopeFloat
(
tspriteptr_t
const
tspr
,
float
dax
,
float
day
)
{
int16_t
const
heinum
=
tspriteGetSlope
(
tspr
);
if
(
heinum
==
0
)
return
float
(
tspr
->
z
);
float
const
f
=
sintable
[(
tspr
->
ang
+
1024
)
&
2047
]
*
(
day
-
tspr
->
y
)
-
sintable
[(
tspr
->
ang
+
512
)
&
2047
]
*
(
dax
-
tspr
->
x
);
return
float
(
tspr
->
z
)
+
heinum
*
f
*
(
1.
f
/
4194304.
f
);
}
#ifdef __cplusplus
}
#endif
...
...
source/build/include/buildtypes.h
View file @
4a151cdb
...
...
@@ -134,6 +134,7 @@ enum
CSTAT_SPRITE_ALIGNMENT_WALL
=
1u
<<
4u
,
CSTAT_SPRITE_ALIGNMENT_FLOOR
=
1u
<<
5u
,
CSTAT_SPRITE_ALIGNMENT_SLAB
=
1u
<<
4u
|
1u
<<
5u
,
CSTAT_SPRITE_ALIGNMENT_SLOPE
=
1u
<<
4u
|
1u
<<
5u
,
CSTAT_SPRITE_ALIGNMENT_MASK
=
1u
<<
4u
|
1u
<<
5u
,
};
...
...
source/build/src/2d.cpp
View file @
4a151cdb
...
...
@@ -1097,7 +1097,7 @@ static void editorDraw2dSprite(int32_t j, int32_t posxe, int32_t posye, int32_t
auto
const
spr
=
&
sprite
[
j
];
int16_t
const
blocking
=
(
spr
->
cstat
&
1
),
hitblocking
=
(
spr
->
cstat
&
256
);
int16_t
const
flooraligned
=
(
spr
->
cstat
&
32
)
,
wallaligned
=
(
spr
->
cstat
&
16
)
;
int16_t
const
flooraligned
=
(
spr
->
cstat
&
48
)
>=
32
,
wallaligned
=
(
spr
->
cstat
&
48
)
==
16
;
int16_t
const
angofs
=
m32_sideview
?
m32_sideang
:
0
;
uint8_t
const
spritecol
=
spritecol2d
[
spr
->
picnum
][
blocking
];
...
...
@@ -1158,8 +1158,10 @@ static void editorDraw2dSprite(int32_t j, int32_t posxe, int32_t posye, int32_t
if
(
flooraligned
)
{
int32_t
heinum
=
spriteGetSlope
(
j
);
int32_t
ratio
=
ksqrt
(
heinum
*
heinum
+
16777216
);
int32_t
fx
=
mulscale10
(
mulscale6
(
tilesiz
[
spr
->
picnum
].
x
,
spr
->
xrepeat
),
zoome
)
>>
1
;
int32_t
fy
=
mulscale10
(
mulscale6
(
tilesiz
[
spr
->
picnum
].
y
,
spr
->
yrepeat
),
zoome
)
>>
1
;
int32_t
fy
=
divscale12
(
mulscale10
(
mulscale6
(
tilesiz
[
spr
->
picnum
].
y
,
spr
->
yrepeat
),
zoome
)
>>
1
,
ratio
)
;
int32_t
co
[
4
][
2
],
ii
,
in
;
int32_t
sinang
=
sintable
[(
spr
->
ang
+
angofs
+
1536
)
&
2047
];
int32_t
cosang
=
sintable
[(
spr
->
ang
+
angofs
+
1024
)
&
2047
];
...
...
source/build/src/build.cpp
View file @
4a151cdb
...
...
@@ -1016,7 +1016,7 @@ void spriteoncfz(int32_t i, int32_t *czptr, int32_t *fzptr)
int32_t
height
,
zofs
;
getzsofslope
(
sprite
[
i
].
sectnum
,
sprite
[
i
].
x
,
sprite
[
i
].
y
,
czptr
,
fzptr
);
if
((
sprite
[
i
].
cstat
&
48
)
=
=
32
)
if
((
sprite
[
i
].
cstat
&
48
)
>
=
32
)
return
;
zofs
=
spriteheightofs
(
i
,
&
height
,
0
);
...
...
@@ -2389,6 +2389,8 @@ static int32_t insert_sprite_common(int32_t sectnum, int32_t dax, int32_t day)
void
correct_sprite_yoffset
(
int32_t
i
)
{
if
((
sprite
[
i
].
cstat
&
48
)
>=
32
)
return
;
int32_t
tileyofs
=
picanm
[
sprite
[
i
].
picnum
].
yofs
;
int32_t
tileysiz
=
tilesiz
[
sprite
[
i
].
picnum
].
y
;
...
...
source/build/src/engine.cpp
View file @
4a151cdb
This diff is collapsed.
Click to expand it.
source/build/src/polymer.cpp
View file @
4a151cdb
...
...
@@ -3863,7 +3863,7 @@ static inline void polymer_scansprites(int16_t sectnum, tspriteptr_t localtspri
void
polymer_updatesprite
(
int32_t
snum
)
{
int32_t
xsize
,
ysize
,
i
,
j
;
int32_t
tilexoff
,
tileyoff
,
xoff
,
yoff
,
centeryoff
=
0
;
int32_t
tilexoff
,
tileyoff
,
xoff
,
yoff
,
centeryoff
=
0
,
heinum
;
auto
const
tspr
=
tspriteptr
[
snum
];
float
xratio
,
yratio
,
ang
;
float
spos
[
3
];
...
...
@@ -3954,10 +3954,16 @@ void polymer_updatesprite(int32_t snum)
xsize
=
(
int32_t
)(
xsize
*
xratio
);
ysize
=
(
int32_t
)(
ysize
*
yratio
);
tilexoff
=
(
int32_t
)
tspr
->
xoffset
;
tileyoff
=
(
int32_t
)
tspr
->
yoffset
;
tilexoff
+=
(
usehightile
&&
h_xsize
[
curpicnum
])
?
h_xoffs
[
curpicnum
]
:
picanm
[
curpicnum
].
xofs
;
tileyoff
+=
(
usehightile
&&
h_xsize
[
curpicnum
])
?
h_yoffs
[
curpicnum
]
:
picanm
[
curpicnum
].
yofs
;
tilexoff
=
(
usehightile
&&
h_xsize
[
curpicnum
])
?
h_xoffs
[
curpicnum
]
:
picanm
[
curpicnum
].
xofs
;
tileyoff
=
(
usehightile
&&
h_xsize
[
curpicnum
])
?
h_yoffs
[
curpicnum
]
:
picanm
[
curpicnum
].
yofs
;
heinum
=
tspriteGetSlope
(
tspr
);
if
(
heinum
==
0
)
{
tilexoff
+=
(
int32_t
)
tspr
->
xoffset
;
tileyoff
+=
(
int32_t
)
tspr
->
yoffset
;
}
xoff
=
(
int32_t
)(
tilexoff
*
xratio
);
yoff
=
(
int32_t
)(
tileyoff
*
yratio
);
...
...
@@ -4022,16 +4028,20 @@ void polymer_updatesprite(int32_t snum)
glScalef
((
float
)(
xsize
),
(
float
)(
ysize
),
1.0
f
);
break
;
case
SPR_FLOOR
:
{
float
const
sang
=
atan2f
(
float
(
heinum
),
4096.
f
)
*
(
180.
f
*
float
(
M_1_PI
));
ang
=
(
float
)((
tspr
->
ang
+
1024
)
&
2047
)
*
(
360.
f
/
2048.
f
);
glTranslatef
(
spos
[
0
],
spos
[
1
],
spos
[
2
]);
glRotatef
(
-
ang
,
0.0
f
,
1.0
f
,
0.0
f
);
glRotatef
(
-
sang
,
1.0
f
,
0.0
f
,
0.0
f
);
glTranslatef
((
float
)(
-
xoff
),
1.0
f
,
(
float
)(
yoff
));
glScalef
((
float
)(
xsize
),
1.0
f
,
(
float
)(
ysize
));
inbuffer
=
horizsprite
;
break
;
}
}
glGetFloatv
(
GL_MODELVIEW_MATRIX
,
spritemodelview
);
glPopMatrix
();
...
...
source/build/src/polymost.cpp
View file @
4a151cdb
...
...
@@ -7902,8 +7902,13 @@ void polymost_drawsprite(int32_t snum)
if
((
globalorientation
&
48
)
!=
48
)
// only non-voxel sprites should do this
{
int
const
flag
=
usehightile
&&
h_xsize
[
globalpicnum
];
off
=
{
(
int32_t
)
tspr
->
xoffset
+
(
flag
?
h_xoffs
[
globalpicnum
]
:
picanm
[
globalpicnum
].
xofs
),
(
int32_t
)
tspr
->
yoffset
+
(
flag
?
h_yoffs
[
globalpicnum
]
:
picanm
[
globalpicnum
].
yofs
)
};
off
=
{
flag
?
h_xoffs
[
globalpicnum
]
:
picanm
[
globalpicnum
].
xofs
,
flag
?
h_yoffs
[
globalpicnum
]
:
picanm
[
globalpicnum
].
yofs
};
if
(
!
(
tspr
->
clipdist
&
TSPR_FLAGS_SLOPE_SPRITE
))
{
off
.
x
+=
tspr
->
xoffset
;
off
.
y
+=
tspr
->
yoffset
;
}
}
int32_t
method
=
DAMETH_MASK
|
DAMETH_CLAMPED
;
...
...
@@ -8343,24 +8348,29 @@ void polymost_drawsprite(int32_t snum)
globvis2
=
mulscale4
(
globvis2
,
(
uint8_t
)(
sector
[
tspr
->
sectnum
].
visibility
+
16
));
polymost_setVisibility
(
globvis2
);
if
((
globalorientation
&
64
)
!=
0
&&
(
globalposz
>
pos
.
z
)
==
(
!
(
globalorientation
&
8
)))
if
((
globalorientation
&
64
)
!=
0
&&
(
globalposz
>
tspriteGetZOfSlope
(
tspr
,
globalposx
,
globalposy
))
==
(
!
(
globalorientation
&
8
)))
goto
_drawsprite_return
;
else
{
int16_t
const
heinum
=
tspriteGetSlope
(
tspr
);
float
const
fheinum
=
heinum
*
(
1.
f
/
4096.
f
);
float
ratio
=
polymost_invsqrt_approximation
(
fheinum
*
fheinum
+
1.
f
);
if
((
globalorientation
&
4
)
>
0
)
off
.
x
=
-
off
.
x
;
if
((
globalorientation
&
8
)
>
0
)
off
.
y
=
-
off
.
y
;
vec2f_t
const
p0
=
{
(
float
)(((
tsiz
.
x
+
1
)
>>
1
)
-
off
.
x
)
*
tspr
->
xrepeat
,
(
float
)(((
tsiz
.
y
+
1
)
>>
1
)
-
off
.
y
)
*
tspr
->
yrepeat
},
(
float
)(((
tsiz
.
y
+
1
)
>>
1
)
-
off
.
y
)
*
tspr
->
yrepeat
*
ratio
},
p1
=
{
(
float
)((
tsiz
.
x
>>
1
)
+
off
.
x
)
*
tspr
->
xrepeat
,
(
float
)((
tsiz
.
y
>>
1
)
+
off
.
y
)
*
tspr
->
yrepeat
};
(
float
)((
tsiz
.
y
>>
1
)
+
off
.
y
)
*
tspr
->
yrepeat
*
ratio
};
float
const
c
=
sintable
[(
tspr
->
ang
+
512
)
&
2047
]
*
(
1.0
f
/
65536.
f
);
float
const
s
=
sintable
[
tspr
->
ang
&
2047
]
*
(
1.0
f
/
65536.
f
);
vec
2
f_t
pxy
[
6
];
vec
3
f_t
pxy
[
6
];
// Project 3D to 2D
for
(
bssize_t
j
=
0
;
j
<
4
;
j
++
)
...
...
@@ -8388,20 +8398,23 @@ void polymost_drawsprite(int32_t snum)
s0
.
y
-=
c
*
p1
.
x
;
}
pxy
[
j
]
=
{
s0
.
y
*
gcosang
-
s0
.
x
*
gsinang
,
s0
.
x
*
gcosang2
+
s0
.
y
*
gsinang2
};
pxy
[
j
]
=
{
s0
.
y
*
gcosang
-
s0
.
x
*
gsinang
,
s0
.
x
*
gcosang2
+
s0
.
y
*
gsinang2
,
float
(
tspriteGetZOfSlopeFloat
(
tspr
,
s0
.
x
+
globalposx
,
s0
.
y
+
globalposy
))
};
}
if
(
pos
.
z
<
globalposz
)
// if floor sprite is above you, reverse order of points
if
(
tspriteGetZOfSlope
(
tspr
,
globalposx
,
globalposy
)
<
globalposz
)
// if floor sprite is above you, reverse order of points
{
EDUKE32_STATIC_ASSERT
(
sizeof
(
uint64_t
)
==
sizeof
(
vec2f_t
));
vec3f_t
t
=
pxy
[
0
];
pxy
[
0
]
=
pxy
[
1
];
pxy
[
1
]
=
t
;
swap64bit
(
&
pxy
[
0
],
&
pxy
[
1
]);
swap64bit
(
&
pxy
[
2
],
&
pxy
[
3
]);
t
=
pxy
[
2
];
pxy
[
2
]
=
pxy
[
3
];
pxy
[
3
]
=
t
;
}
// Clip to SCISDIST plane
int32_t
npoints
=
0
;
vec
2
f_t
p2
[
6
];
vec
3
f_t
p2
[
6
];
for
(
bssize_t
i
=
0
,
j
=
1
;
i
<
4
;
j
=
((
++
i
+
1
)
&
3
))
{
...
...
@@ -8411,8 +8424,9 @@ void polymost_drawsprite(int32_t snum)
if
((
pxy
[
i
].
y
>=
SCISDIST
)
!=
(
pxy
[
j
].
y
>=
SCISDIST
))
{
float
const
f
=
(
SCISDIST
-
pxy
[
i
].
y
)
/
(
pxy
[
j
].
y
-
pxy
[
i
].
y
);
vec2f_t
const
t
=
{
(
pxy
[
j
].
x
-
pxy
[
i
].
x
)
*
f
+
pxy
[
i
].
x
,
(
pxy
[
j
].
y
-
pxy
[
i
].
y
)
*
f
+
pxy
[
i
].
y
};
vec3f_t
const
t
=
{
(
pxy
[
j
].
x
-
pxy
[
i
].
x
)
*
f
+
pxy
[
i
].
x
,
(
pxy
[
j
].
y
-
pxy
[
i
].
y
)
*
f
+
pxy
[
i
].
y
,
(
pxy
[
j
].
z
-
pxy
[
i
].
z
)
*
f
+
pxy
[
i
].
z
};
p2
[
npoints
++
]
=
t
;
}
}
...
...
@@ -8424,32 +8438,40 @@ void polymost_drawsprite(int32_t snum)
int
fadjust
=
0
;
// unfortunately, offsetting by only 1 isn't enough on most Android devices
if
(
pos
.
z
==
sec
->
ceilingz
||
pos
.
z
==
sec
->
ceilingz
+
1
)
pos
.
z
=
sec
->
ceilingz
+
2
,
fadjust
=
(
tspr
->
owner
&
31
);
if
(
heinum
==
0
)
{
// unfortunately, offsetting by only 1 isn't enough on most Android devices
if
(
pos
.
z
==
sec
->
ceilingz
||
pos
.
z
==
sec
->
ceilingz
+
1
)
pos
.
z
=
sec
->
ceilingz
+
2
,
fadjust
=
(
tspr
->
owner
&
31
);
if
(
pos
.
z
==
sec
->
floorz
||
pos
.
z
==
sec
->
floorz
-
1
)
pos
.
z
=
sec
->
floorz
-
2
,
fadjust
=
-
((
tspr
->
owner
&
31
));
if
(
pos
.
z
==
sec
->
floorz
||
pos
.
z
==
sec
->
floorz
-
1
)
pos
.
z
=
sec
->
floorz
-
2
,
fadjust
=
-
((
tspr
->
owner
&
31
));
}
float
f
=
(
float
)(
pos
.
z
-
globalposz
+
fadjust
)
*
gyxscale
;
vec2f_t
pxy2
[
6
];
double
pfy
[
6
];
for
(
bssize_t
j
=
0
;
j
<
npoints
;
j
++
)
{
float
const
ryp0
=
1.
f
/
p2
[
j
].
y
;
pxy
[
j
]
=
{
ghalfx
*
p2
[
j
].
x
*
ryp0
+
ghalfx
,
f
*
ryp0
+
ghoriz
};
float
const
fs
=
(
float
)(
p2
[
j
].
z
-
globalposz
+
fadjust
)
*
gyxscale
;
pxy2
[
j
]
=
{
ghalfx
*
p2
[
j
].
x
*
ryp0
+
ghalfx
,
fs
*
ryp0
+
ghoriz
};
pfy
[
j
]
=
double
(
gyxscale
*
ryp0
)
+
ghoriz
;
}
// gd? Copied from floor rendering code
xtex
.
d
=
0
;
ytex
.
d
=
gxyaspect
/
(
double
)(
pos
.
z
-
globalposz
+
fadjust
);
ytex
.
d
=
gxyaspect
;
if
(
heinum
==
0
)
ytex
.
d
/=
(
double
)(
pos
.
z
-
globalposz
+
fadjust
);
otex
.
d
=
-
ghoriz
*
ytex
.
d
;
// copied&modified from relative alignment
vec2f_t
const
vv
=
{
(
float
)
tspr
->
x
+
s
*
p1
.
x
+
c
*
p1
.
y
,
(
float
)
tspr
->
y
+
s
*
p1
.
y
-
c
*
p1
.
x
};
vec2f_t
ff
=
{
-
(
p0
.
x
+
p1
.
x
)
*
s
,
(
p0
.
x
+
p1
.
x
)
*
c
};
f
=
polymost_invsqrt_approximation
(
ff
.
x
*
ff
.
x
+
ff
.
y
*
ff
.
y
);
float
f
=
polymost_invsqrt_approximation
(
ff
.
x
*
ff
.
x
+
ff
.
y
*
ff
.
y
);
ff
.
x
*=
f
;
ff
.
y
*=
f
;
...
...
@@ -8497,11 +8519,51 @@ void polymost_drawsprite(int32_t snum)
if
(
spriteext
[
spritenum
].
ypanning
)
{
float
const
f
=
((
float
)(
spriteext
[
spritenum
].
ypanning
)
*
(
1.0
f
/
255.
f
))
*
ftsiz
.
y
;
float
const
f
=
((
float
)(
spriteext
[
spritenum
].
ypanning
)
*
(
1.0
f
/
255.
f
))
*
ftsiz
.
y
*
ratio
;
ytex
.
v
-=
ytex
.
d
*
f
;
otex
.
v
-=
otex
.
d
*
f
;
drawpoly_trepeat
=
1
;
}
if
(
heinum
!=
0
)
{
double
const
px
[
3
]
=
{
pxy2
[
0
].
x
,
pxy2
[
1
].
x
,
pxy2
[
2
].
x
};
vec3d_t
const
duv
[
3
]
=
{
{
(
pxy2
[
0
].
x
*
xtex
.
d
+
pfy
[
0
]
*
ytex
.
d
+
otex
.
d
),
(
pxy2
[
0
].
x
*
xtex
.
u
+
pfy
[
0
]
*
ytex
.
u
+
otex
.
u
),
(
pxy2
[
0
].
x
*
xtex
.
v
+
pfy
[
0
]
*
ytex
.
v
+
otex
.
v
)
},
{
(
pxy2
[
1
].
x
*
xtex
.
d
+
pfy
[
1
]
*
ytex
.
d
+
otex
.
d
),
(
pxy2
[
1
].
x
*
xtex
.
u
+
pfy
[
1
]
*
ytex
.
u
+
otex
.
u
),
(
pxy2
[
1
].
x
*
xtex
.
v
+
pfy
[
1
]
*
ytex
.
v
+
otex
.
v
)
},
{
(
pxy2
[
2
].
x
*
xtex
.
d
+
pfy
[
2
]
*
ytex
.
d
+
otex
.
d
),
(
pxy2
[
2
].
x
*
xtex
.
u
+
pfy
[
2
]
*
ytex
.
u
+
otex
.
u
),
(
pxy2
[
2
].
x
*
xtex
.
v
+
pfy
[
2
]
*
ytex
.
v
+
otex
.
v
)
}
};
vec3f_t
oxyz
[
2
]
=
{
{
(
float
)(
pxy2
[
1
].
y
-
pxy2
[
2
].
y
),
(
float
)(
pxy2
[
2
].
y
-
pxy2
[
0
].
y
),
(
float
)(
pxy2
[
0
].
y
-
pxy2
[
1
].
y
)
},
{
(
float
)(
pxy2
[
2
].
x
-
pxy2
[
1
].
x
),
(
float
)(
pxy2
[
0
].
x
-
pxy2
[
2
].
x
),
(
float
)(
pxy2
[
1
].
x
-
pxy2
[
0
].
x
)
}
};
float
const
r
=
1.
f
/
(
oxyz
[
0
].
x
*
pxy2
[
0
].
x
+
oxyz
[
0
].
y
*
pxy2
[
1
].
x
+
oxyz
[
0
].
z
*
pxy2
[
2
].
x
);
xtex
.
d
=
(
oxyz
[
0
].
x
*
duv
[
0
].
d
+
oxyz
[
0
].
y
*
duv
[
1
].
d
+
oxyz
[
0
].
z
*
duv
[
2
].
d
)
*
r
;
xtex
.
u
=
(
oxyz
[
0
].
x
*
duv
[
0
].
u
+
oxyz
[
0
].
y
*
duv
[
1
].
u
+
oxyz
[
0
].
z
*
duv
[
2
].
u
)
*
r
;
xtex
.
v
=
(
oxyz
[
0
].
x
*
duv
[
0
].
v
+
oxyz
[
0
].
y
*
duv
[
1
].
v
+
oxyz
[
0
].
z
*
duv
[
2
].
v
)
*
r
;
ytex
.
d
=
(
oxyz
[
1
].
x
*
duv
[
0
].
d
+
oxyz
[
1
].
y
*
duv
[
1
].
d
+
oxyz
[
1
].
z
*
duv
[
2
].
d
)
*
r
;
ytex
.
u
=
(
oxyz
[
1
].
x
*
duv
[
0
].
u
+
oxyz
[
1
].
y
*
duv
[
1
].
u
+
oxyz
[
1
].
z
*
duv
[
2
].
u
)
*
r
;
ytex
.
v
=
(
oxyz
[
1
].
x
*
duv
[
0
].
v
+
oxyz
[
1
].
y
*
duv
[
1
].
v
+
oxyz
[
1
].
z
*
duv
[
2
].
v
)
*
r
;
otex
.
d
=
duv
[
0
].
d
-
pxy2
[
0
].
x
*
xtex
.
d
-
pxy2
[
0
].
y
*
ytex
.
d
;
otex
.
u
=
duv
[
0
].
u
-
pxy2
[
0
].
x
*
xtex
.
u
-
pxy2
[
0
].
y
*
ytex
.
u
;
otex
.
v
=
duv
[
0
].
v
-
pxy2
[
0
].
x
*
xtex
.
v
-
pxy2
[
0
].
y
*
ytex
.
v
;
float
const
rr
=
Bsqrtf
(
fheinum
*
fheinum
+
1.
f
);
xtex
.
v
*=
rr
;
ytex
.
v
*=
rr
;
otex
.
v
*=
rr
;
}
tilesiz
[
globalpicnum
]
=
{
(
int16_t
)
tsiz
.
x
,
(
int16_t
)
tsiz
.
y
};
pow2xsplit
=
0
;
...
...
@@ -8516,7 +8578,7 @@ void polymost_drawsprite(int32_t snum)
psearchstat
=
3
;
doeditorcheck
=
1
;
}
polymost_drawpoly
(
pxy
,
npoints
,
method
);
polymost_drawpoly
(
pxy
2
,
npoints
,
method
);
doeditorcheck
=
0
;
drawpoly_srepeat
=
0
;
...
...
source/duke3d/src/astub.cpp
View file @
4a151cdb
...
...
@@ -4391,13 +4391,19 @@ static void Keys3d(void)
sprite
[
searchwall
].
pal
,
sprite
[
searchwall
].
cstat
,
sprite
[
searchwall
].
lotag
,
sprite
[
searchwall
].
hitag
,
sprite
[
searchwall
].
extra
,
sprite
[
searchwall
].
blend
,
sprite
[
searchwall
].
statnum
,
0
);
Bsprintf
(
lines
[
num
++
],
"Repeat: %d,%d"
,
TrackerCast
(
sprite
[
searchwall
].
xrepeat
),
TrackerCast
(
sprite
[
searchwall
].
yrepeat
));
Bsprintf
(
lines
[
num
++
],
"PosXY: %d,%d%s"
,
TrackerCast
(
sprite
[
searchwall
].
x
),
TrackerCast
(
sprite
[
searchwall
].
y
),
sprite
[
searchwall
].
xoffset
|
sprite
[
searchwall
].
yoffset
?
" ^251*"
:
""
);
Bsprintf
(
lines
[
num
++
],
"PosZ: "" %d"
,
TrackerCast
(
sprite
[
searchwall
].
z
));
// prevents tab character
lines
[
num
++
][
0
]
=
0
;
{
int16_t
const
heinum
=
spriteGetSlope
(
searchwall
);
int32_t
const
notextended
=
heinum
==
0
;
Bsprintf
(
lines
[
num
++
],
"Repeat: %d,%d"
,
TrackerCast
(
sprite
[
searchwall
].
xrepeat
),
TrackerCast
(
sprite
[
searchwall
].
yrepeat
));
Bsprintf
(
lines
[
num
++
],
"PosXY: %d,%d%s"
,
TrackerCast
(
sprite
[
searchwall
].
x
),
TrackerCast
(
sprite
[
searchwall
].
y
),
(
sprite
[
searchwall
].
xoffset
|
sprite
[
searchwall
].
yoffset
)
&&
notextended
?
" ^251*"
:
""
);
Bsprintf
(
lines
[
num
++
],
"PosZ: "" %d"
,
TrackerCast
(
sprite
[
searchwall
].
z
));
// prevents tab character
if
(
!
notextended
)
Bsprintf
(
lines
[
num
++
],
"Slope: %d"
,
heinum
);
lines
[
num
++
][
0
]
=
0
;
}
if
(
getmessageleng
)
break
;
...
...
@@ -5970,22 +5976,35 @@ static void Keys3d(void)
else
{
if
(
AIMING_AT_CEILING_OR_FLOOR
)
{
#ifdef YAX_ENABLE
if
(
YAXCHK
((
bunchnum
=
yax_getbunch
(
searchsector
,
AIMING_AT_FLOOR
))
<
0
||
(
othersidesect
=
yax_is121
(
bunchnum
,
AIMING_AT_CEILING
))
>=
0
)
&&
(
bunchnum
<
0
||
YAXSLOPECHK
(
searchsector
,
othersidesect
)))
if
(
YAXCHK
((
bunchnum
=
yax_getbunch
(
searchsector
,
AIMING_AT_FLOOR
))
<
0
||
(
othersidesect
=
yax_is121
(
bunchnum
,
AIMING_AT_CEILING
))
>=
0
)
&&
(
bunchnum
<
0
||
YAXSLOPECHK
(
searchsector
,
othersidesect
)))
#endif
{
int32_t
oldslope
=
(
AIMED_CEILINGFLOOR
(
stat
)
&
2
)
?
AIMED_CEILINGFLOOR
(
heinum
)
:
0
;
int32_t
newslope
=
clamp
(
oldslope
+
tsign
*
i
,
-
BHEINUM_MAX
,
BHEINUM_MAX
);
{
int32_t
oldslope
=
(
AIMED_CEILINGFLOOR
(
stat
)
&
2
)
?
AIMED_CEILINGFLOOR
(
heinum
)
:
0
;
int32_t
newslope
=
clamp
(
oldslope
+
tsign
*
i
,
-
BHEINUM_MAX
,
BHEINUM_MAX
);
setslope
(
searchsector
,
AIMING_AT_FLOOR
,
newslope
);
setslope
(
searchsector
,
AIMING_AT_FLOOR
,
newslope
);
#ifdef YAX_ENABLE
if
(
bunchnum
>=
0
)
setslope
(
othersidesect
,
!
AIMING_AT_FLOOR
,
newslope
);
if
(
bunchnum
>=
0
)
setslope
(
othersidesect
,
!
AIMING_AT_FLOOR
,
newslope
);
#endif
silentmessage
(
"Sector %d %s slope = %d"
,
searchsector
,
typestr
[
searchstat
],
AIMED_CEILINGFLOOR
(
heinum
));
silentmessage
(
"Sector %d %s slope = %d"
,
searchsector
,
typestr
[
searchstat
],
AIMED_CEILINGFLOOR
(
heinum
));
}
}
else
if
(
AIMING_AT_SPRITE
)
{
auto
const
cstat
=
sprite
[
searchwall
].
cstat
&
CSTAT_SPRITE_ALIGNMENT_MASK
;
if
(
cstat
==
CSTAT_SPRITE_ALIGNMENT_FLOOR
||
cstat
==
CSTAT_SPRITE_ALIGNMENT_SLOPE
)
{
int32_t
oldslope
=
spriteGetSlope
(
searchwall
);
int32_t
newslope
=
clamp
(
oldslope
+
tsign
*
i
,
-
BHEINUM_MAX
,
BHEINUM_MAX
);
spriteSetSlope
(
searchwall
,
newslope
);
silentmessage
(
"Sprite %d slope = %d"
,
searchwall
,
newslope
);
}
}
}
...
...
source/duke3d/src/m32common.cpp
View file @
4a151cdb
...
...
@@ -554,7 +554,7 @@ int32_t map_undoredo(int dir)
// insert sprites
for
(
int
i
=
0
;
i
<
mapstate
->
num
[
UNDO_SPRITES
];
i
++
)
{
if
((
sprite
[
i
].
cstat
&
48
)
==
48
)
sprite
[
i
].
cstat
&=
~
48
;
if
((
sprite
[
i
].
cstat
&
48
)
==
48
&&
(
sprite
[
i
].
xoffset
|
sprite
[
i
].
yoffset
)
==
0
)
sprite
[
i
].
cstat
&=
~
48
;
Bassert
((
unsigned
)
sprite
[
i
].
sectnum
<
(
unsigned
)
numsectors
&&
(
unsigned
)
sprite
[
i
].
statnum
<
MAXSTATUS
);
insertsprite
(
sprite
[
i
].
sectnum
,
sprite
[
i
].
statnum
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment