Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vincent Robinson
SRB2
Commits
2a0e47e2
Commit
2a0e47e2
authored
4 years ago
by
Lactozilla
Browse files
Options
Downloads
Patches
Plain Diff
Remove LUA_PATCH_SAFETY
parent
91ed56ef
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/doomdef.h
+0
-3
0 additions, 3 deletions
src/doomdef.h
src/lua_hudlib.c
+0
-80
0 additions, 80 deletions
src/lua_hudlib.c
src/r_defs.h
+0
-18
0 additions, 18 deletions
src/r_defs.h
with
0 additions
and
101 deletions
src/doomdef.h
+
0
−
3
View file @
2a0e47e2
...
...
@@ -629,9 +629,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// \note Required for proper collision with moving sloped surfaces that have sector specials on them.
#define SECTORSPECIALSAFTERTHINK
/// Cache patches in Lua in a way that renderer switching will work flawlessly.
//#define LUA_PATCH_SAFETY
/// Sprite rotation
#define ROTSPRITE
#define ROTANGLES 72 // Needs to be a divisor of 360 (45, 60, 90, 120...)
...
...
This diff is collapsed.
Click to expand it.
src/lua_hudlib.c
+
0
−
80
View file @
2a0e47e2
...
...
@@ -35,11 +35,6 @@ static UINT8 hud_enabled[(hud_MAX/8)+1];
static
UINT8
hudAvailable
;
// hud hooks field
#ifdef LUA_PATCH_SAFETY
static
patchinfo_t
*
patchinfo
,
*
patchinfohead
;
static
int
numluapatches
;
#endif
// must match enum hud in lua_hud.h
static
const
char
*
const
hud_disable_options
[]
=
{
"stagetitle"
,
...
...
@@ -292,11 +287,7 @@ static int colormap_get(lua_State *L)
static
int
patch_get
(
lua_State
*
L
)
{
#ifdef LUA_PATCH_SAFETY
patch_t
*
patch
=
*
((
patch_t
**
)
luaL_checkudata
(
L
,
1
,
META_PATCH
));
#else
patchinfo_t
*
patch
=
*
((
patchinfo_t
**
)
luaL_checkudata
(
L
,
1
,
META_PATCH
));
#endif
enum
patch
field
=
luaL_checkoption
(
L
,
2
,
NULL
,
patch_opt
);
// patches are invalidated when switching renderers
...
...
@@ -403,59 +394,8 @@ static int libd_patchExists(lua_State *L)
static
int
libd_cachePatch
(
lua_State
*
L
)
{
#ifdef LUA_PATCH_SAFETY
int
i
;
lumpnum_t
lumpnum
;
patchinfo_t
*
luapat
;
patch_t
*
realpatch
;
HUDONLY
luapat
=
patchinfohead
;
lumpnum
=
W_CheckNumForLongName
(
luaL_checkstring
(
L
,
1
));
if
(
lumpnum
==
LUMPERROR
)
lumpnum
=
W_GetNumForLongName
(
"MISSING"
);
for
(
i
=
0
;
i
<
numluapatches
;
i
++
)
{
// check if already cached
if
(
luapat
->
wadnum
==
WADFILENUM
(
lumpnum
)
&&
luapat
->
lumpnum
==
LUMPNUM
(
lumpnum
))
{
LUA_PushUserdata
(
L
,
luapat
,
META_PATCH
);
return
1
;
}
luapat
=
luapat
->
next
;
if
(
!
luapat
)
break
;
}
if
(
numluapatches
>
0
)
{
patchinfo
->
next
=
Z_Malloc
(
sizeof
(
patchinfo_t
),
PU_STATIC
,
NULL
);
patchinfo
=
patchinfo
->
next
;
}
else
{
patchinfo
=
Z_Malloc
(
sizeof
(
patchinfo_t
),
PU_STATIC
,
NULL
);
patchinfohead
=
patchinfo
;
}
realpatch
=
W_CachePatchNum
(
lumpnum
,
PU_PATCH
);
patchinfo
->
width
=
realpatch
->
width
;
patchinfo
->
height
=
realpatch
->
height
;
patchinfo
->
leftoffset
=
realpatch
->
leftoffset
;
patchinfo
->
topoffset
=
realpatch
->
topoffset
;
patchinfo
->
wadnum
=
WADFILENUM
(
lumpnum
);
patchinfo
->
lumpnum
=
LUMPNUM
(
lumpnum
);
LUA_PushUserdata
(
L
,
patchinfo
,
META_PATCH
);
numluapatches
++
;
#else
HUDONLY
LUA_PushUserdata
(
L
,
W_CachePatchLongName
(
luaL_checkstring
(
L
,
1
),
PU_PATCH
),
META_PATCH
);
#endif
return
1
;
}
...
...
@@ -651,22 +591,14 @@ static int libd_draw(lua_State *L)
{
INT32
x
,
y
,
flags
;
patch_t
*
patch
;
#ifdef LUA_PATCH_SAFETY
patchinfo_t
*
luapat
;
#endif
const
UINT8
*
colormap
=
NULL
;
HUDONLY
x
=
luaL_checkinteger
(
L
,
1
);
y
=
luaL_checkinteger
(
L
,
2
);
#ifdef LUA_PATCH_SAFETY
luapat
=
*
((
patchinfo_t
**
)
luaL_checkudata
(
L
,
3
,
META_PATCH
));
patch
=
W_CachePatchNum
((
luapat
->
wadnum
<<
16
)
+
luapat
->
lumpnum
,
PU_PATCH
);
#else
patch
=
*
((
patch_t
**
)
luaL_checkudata
(
L
,
3
,
META_PATCH
));
if
(
!
patch
)
return
LUA_ErrInvalid
(
L
,
"patch_t"
);
#endif
flags
=
luaL_optinteger
(
L
,
4
,
0
);
if
(
!
lua_isnoneornil
(
L
,
5
))
colormap
=
*
((
UINT8
**
)
luaL_checkudata
(
L
,
5
,
META_COLORMAP
));
...
...
@@ -682,9 +614,6 @@ static int libd_drawScaled(lua_State *L)
fixed_t
x
,
y
,
scale
;
INT32
flags
;
patch_t
*
patch
;
#ifdef LUA_PATCH_SAFETY
patchinfo_t
*
luapat
;
#endif
const
UINT8
*
colormap
=
NULL
;
HUDONLY
...
...
@@ -693,14 +622,9 @@ static int libd_drawScaled(lua_State *L)
scale
=
luaL_checkinteger
(
L
,
3
);
if
(
scale
<
0
)
return
luaL_error
(
L
,
"negative scale"
);
#ifdef LUA_PATCH_SAFETY
luapat
=
*
((
patchinfo_t
**
)
luaL_checkudata
(
L
,
4
,
META_PATCH
));
patch
=
W_CachePatchNum
((
luapat
->
wadnum
<<
16
)
+
luapat
->
lumpnum
,
PU_PATCH
);
#else
patch
=
*
((
patch_t
**
)
luaL_checkudata
(
L
,
4
,
META_PATCH
));
if
(
!
patch
)
return
LUA_ErrInvalid
(
L
,
"patch_t"
);
#endif
flags
=
luaL_optinteger
(
L
,
5
,
0
);
if
(
!
lua_isnoneornil
(
L
,
6
))
colormap
=
*
((
UINT8
**
)
luaL_checkudata
(
L
,
6
,
META_COLORMAP
));
...
...
@@ -1247,10 +1171,6 @@ int LUA_HudLib(lua_State *L)
{
memset
(
hud_enabled
,
0xff
,
(
hud_MAX
/
8
)
+
1
);
#ifdef LUA_PATCH_SAFETY
numluapatches
=
0
;
#endif
lua_newtable
(
L
);
// HUD registry table
lua_newtable
(
L
);
luaL_register
(
L
,
NULL
,
lib_draw
);
...
...
This diff is collapsed.
Click to expand it.
src/r_defs.h
+
0
−
18
View file @
2a0e47e2
...
...
@@ -727,24 +727,6 @@ typedef enum
SRF_NONE
=
0xff
// Initial value
}
spriterotateflags_t
;
// SRF's up!
// Same as a patch_t, except just the header
// and the wadnum/lumpnum combination that points
// to wherever the patch is in memory.
struct
patchinfo_s
{
INT16
width
;
// bounding box size
INT16
height
;
INT16
leftoffset
;
// pixels to the left of origin
INT16
topoffset
;
// pixels below the origin
UINT16
wadnum
;
// the software patch lump num for when the patch
UINT16
lumpnum
;
// was flushed, and we need to re-create it
// next patchinfo_t in memory
struct
patchinfo_s
*
next
;
};
typedef
struct
patchinfo_s
patchinfo_t
;
//
// Sprites are patches with a special naming convention so they can be
// recognized by R_InitSprites.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment