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
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
STJr
SRB2
Commits
dfa8ac7c
Commit
dfa8ac7c
authored
9 years ago
by
Yukita Mayako
Browse files
Options
Downloads
Patches
Plain Diff
Added sidedef texture and offset manipulation to Lua.
parent
ef0e61fc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!12
Lua changes
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lua_maplib.c
+47
-0
47 additions, 0 deletions
src/lua_maplib.c
with
47 additions
and
0 deletions
src/lua_maplib.c
+
47
−
0
View file @
dfa8ac7c
...
...
@@ -658,6 +658,50 @@ static int side_get(lua_State *L)
return
0
;
}
static
int
side_set
(
lua_State
*
L
)
{
side_t
*
side
=
*
((
side_t
**
)
luaL_checkudata
(
L
,
1
,
META_SIDE
));
enum
side_e
field
=
luaL_checkoption
(
L
,
2
,
side_opt
[
0
],
side_opt
);
if
(
!
side
)
{
if
(
field
==
side_valid
)
{
lua_pushboolean
(
L
,
0
);
return
1
;
}
return
luaL_error
(
L
,
"accessed side_t doesn't exist anymore."
);
}
switch
(
field
)
{
case
side_valid
:
// valid
case
side_sector
:
case
side_special
:
case
side_text
:
default:
return
luaL_error
(
L
,
"side_t field "
LUA_QS
" cannot be set."
,
side_opt
[
field
]);
case
side_textureoffset
:
side
->
textureoffset
=
luaL_checkfixed
(
L
,
3
);
break
;
case
side_rowoffset
:
side
->
rowoffset
=
luaL_checkfixed
(
L
,
3
);
break
;
case
side_toptexture
:
side
->
toptexture
=
luaL_checkinteger
(
L
,
3
);
break
;
case
side_bottomtexture
:
side
->
bottomtexture
=
luaL_checkinteger
(
L
,
3
);
break
;
case
side_midtexture
:
side
->
midtexture
=
luaL_checkinteger
(
L
,
3
);
break
;
case
side_repeatcnt
:
side
->
repeatcnt
=
luaL_checkinteger
(
L
,
3
);
break
;
}
return
0
;
}
static
int
side_num
(
lua_State
*
L
)
{
side_t
*
side
=
*
((
side_t
**
)
luaL_checkudata
(
L
,
1
,
META_SIDE
));
...
...
@@ -1214,6 +1258,9 @@ int LUA_MapLib(lua_State *L)
lua_pushcfunction
(
L
,
side_get
);
lua_setfield
(
L
,
-
2
,
"__index"
);
lua_pushcfunction
(
L
,
side_set
);
lua_setfield
(
L
,
-
2
,
"__newindex"
);
lua_pushcfunction
(
L
,
side_num
);
lua_setfield
(
L
,
-
2
,
"__len"
);
lua_pop
(
L
,
1
);
...
...
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