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
Package registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Shin_Kinr
SRB2
Commits
0e57d70b
Commit
0e57d70b
authored
Mar 16, 2024
by
LJ Sonic
Browse files
Options
Downloads
Patches
Plain Diff
Automatically mirror long sprites for missing rotations
parent
f6cb5d56
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/r_things.c
+35
-0
35 additions, 0 deletions
src/r_things.c
with
35 additions
and
0 deletions
src/r_things.c
+
35
−
0
View file @
0e57d70b
...
@@ -312,6 +312,38 @@ static boolean GetFramesAndRotationsFromLongLumpName(
...
@@ -312,6 +312,38 @@ static boolean GetFramesAndRotationsFromLongLumpName(
return
true
;
return
true
;
}
}
static
UINT8
GetOppositeRotation
(
UINT8
rotation
,
UINT8
flags
)
{
if
(
flags
&
~
SRF_3DMASK
)
I_Error
(
"GetOppositeRotation: rotation type not supported"
);
UINT8
numrotations
=
(
flags
==
SRF_3D
)
?
8
:
16
;
return
(
rotation
==
1
)
?
1
:
numrotations
+
2
-
rotation
;
}
static
void
MirrorMissingRotations
(
void
)
{
for
(
UINT32
framenum
=
0
;
framenum
<
maxframe
;
framenum
++
)
{
spriteframe_t
*
frame
=
&
sprtemp
[
framenum
];
if
(
!
(
frame
->
rotate
&
SRF_3DMASK
))
continue
;
UINT8
numrotations
=
frame
->
rotate
==
SRF_3D
?
8
:
16
;
for
(
UINT8
rotation
=
1
;
rotation
<=
numrotations
;
rotation
++
)
{
if
(
frame
->
lumppat
[
rotation
-
1
]
!=
LUMPERROR
)
continue
;
UINT8
baserotation
=
GetOppositeRotation
(
rotation
,
frame
->
rotate
);
UINT32
lumpnum
=
frame
->
lumppat
[
baserotation
-
1
];
R_InstallSpriteLump
(
WADFILENUM
(
lumpnum
),
LUMPNUM
(
lumpnum
),
frame
->
lumpid
[
baserotation
],
framenum
,
rotation
,
1
);
}
}
}
// Some checks to help development
// Some checks to help development
static
void
CheckFrame
(
const
char
*
sprname
)
static
void
CheckFrame
(
const
char
*
sprname
)
{
{
...
@@ -484,6 +516,9 @@ boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef, UINT16
...
@@ -484,6 +516,9 @@ boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef, UINT16
maxframe
++
;
maxframe
++
;
if
(
longname
)
MirrorMissingRotations
();
CheckFrame
(
sprname
);
CheckFrame
(
sprname
);
// allocate space for the frames present and copy sprtemp to it
// allocate space for the frames present and copy sprtemp to it
...
...
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