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
0ddd2fea
Commit
0ddd2fea
authored
5 years ago
by
LJ Sonic
Browse files
Options
Downloads
Patches
Plain Diff
Let W_CheckNumForName(Pwad) find entries with long names
parent
29a94ee2
No related branches found
No related tags found
2 merge requests
!985
Shaders next merge
,
!885
Enable entry searching functions to retrieve entry names longer than 8 characters
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/w_wad.c
+8
-10
8 additions, 10 deletions
src/w_wad.c
with
8 additions
and
10 deletions
src/w_wad.c
+
8
−
10
View file @
0ddd2fea
...
...
@@ -92,7 +92,7 @@ typedef struct
typedef
struct
lumpnum_cache_s
{
char
lumpname
[
8
];
char
lumpname
[
32
];
lumpnum_t
lumpnum
;
}
lumpnum_cache_t
;
...
...
@@ -922,16 +922,14 @@ const char *W_CheckNameForNum(lumpnum_t lumpnum)
UINT16
W_CheckNumForNamePwad
(
const
char
*
name
,
UINT16
wad
,
UINT16
startlump
)
{
UINT16
i
;
static
char
uname
[
9
];
memset
(
uname
,
0x00
,
sizeof
uname
);
strncpy
(
uname
,
name
,
8
);
uname
[
8
]
=
0
;
strupr
(
uname
);
static
char
uname
[
256
+
1
];
if
(
!
TestValidLump
(
wad
,
0
))
return
INT16_MAX
;
strlcpy
(
uname
,
name
,
sizeof
uname
);
strupr
(
uname
);
//
// scan forward
// start at 'startlump', useful parameter when there are multiple
...
...
@@ -941,7 +939,7 @@ UINT16 W_CheckNumForNamePwad(const char *name, UINT16 wad, UINT16 startlump)
{
lumpinfo_t
*
lump_p
=
wadfiles
[
wad
]
->
lumpinfo
+
startlump
;
for
(
i
=
startlump
;
i
<
wadfiles
[
wad
]
->
numlumps
;
i
++
,
lump_p
++
)
if
(
mem
cmp
(
lump_p
->
name
,
uname
,
8
)
==
0
)
if
(
!
str
cmp
(
lump_p
->
long
name
,
uname
)
)
return
i
;
}
...
...
@@ -1027,7 +1025,7 @@ lumpnum_t W_CheckNumForName(const char *name)
// most recent entries first
for
(
i
=
lumpnumcacheindex
+
LUMPNUMCACHESIZE
;
i
>
lumpnumcacheindex
;
i
--
)
{
if
(
str
n
cmp
(
lumpnumcache
[
i
&
(
LUMPNUMCACHESIZE
-
1
)].
lumpname
,
name
,
8
)
==
0
)
if
(
strcmp
(
lumpnumcache
[
i
&
(
LUMPNUMCACHESIZE
-
1
)].
lumpname
,
name
)
==
0
)
{
lumpnumcacheindex
=
i
&
(
LUMPNUMCACHESIZE
-
1
);
return
lumpnumcache
[
lumpnumcacheindex
].
lumpnum
;
...
...
@@ -1047,7 +1045,7 @@ lumpnum_t W_CheckNumForName(const char *name)
{
// Update the cache.
lumpnumcacheindex
=
(
lumpnumcacheindex
+
1
)
&
(
LUMPNUMCACHESIZE
-
1
);
str
n
cpy
(
lumpnumcache
[
lumpnumcacheindex
].
lumpname
,
name
,
8
);
str
l
cpy
(
lumpnumcache
[
lumpnumcacheindex
].
lumpname
,
name
,
32
);
lumpnumcache
[
lumpnumcacheindex
].
lumpnum
=
(
i
<<
16
)
+
check
;
return
lumpnumcache
[
lumpnumcacheindex
].
lumpnum
;
...
...
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