mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-23 03:52:12 -04:00
add lump priority to determinate load order (#1956)
This commit is contained in:
parent
a55429f6b8
commit
2e5de098dd
@ -45,6 +45,8 @@ typedef enum
|
|||||||
key_mode
|
key_mode
|
||||||
} menu_input_mode_t;
|
} menu_input_mode_t;
|
||||||
|
|
||||||
|
extern int bigfont_priority;
|
||||||
|
|
||||||
extern menu_input_mode_t help_input, old_help_input; // pad_mode or key_mode.
|
extern menu_input_mode_t help_input, old_help_input; // pad_mode or key_mode.
|
||||||
extern menu_input_mode_t menu_input, old_menu_input;
|
extern menu_input_mode_t menu_input, old_menu_input;
|
||||||
void MN_ResetMouseCursor(void);
|
void MN_ResetMouseCursor(void);
|
||||||
|
@ -110,6 +110,8 @@ static boolean options_active;
|
|||||||
|
|
||||||
backdrop_t menu_backdrop;
|
backdrop_t menu_backdrop;
|
||||||
|
|
||||||
|
int bigfont_priority = -1;
|
||||||
|
|
||||||
#define SKULLXOFF -32
|
#define SKULLXOFF -32
|
||||||
#define LINEHEIGHT 16
|
#define LINEHEIGHT 16
|
||||||
|
|
||||||
@ -2277,8 +2279,9 @@ void M_Init(void)
|
|||||||
M_ResetAutoSave();
|
M_ResetAutoSave();
|
||||||
|
|
||||||
int lumpnum = W_CheckNumForName("DBIGFONT");
|
int lumpnum = W_CheckNumForName("DBIGFONT");
|
||||||
if (lumpnum > 0)
|
if (lumpnum >= 0)
|
||||||
{
|
{
|
||||||
|
bigfont_priority = lumpinfo[lumpnum].handle.priority;
|
||||||
MN_LoadFon2(W_CacheLumpNum(lumpnum, PU_CACHE), W_LumpLength(lumpnum));
|
MN_LoadFon2(W_CacheLumpNum(lumpnum, PU_CACHE), W_LumpLength(lumpnum));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3486,13 +3489,19 @@ void M_Drawer(void)
|
|||||||
{
|
{
|
||||||
const char *name = currentMenu->menuitems[i].name;
|
const char *name = currentMenu->menuitems[i].name;
|
||||||
int patch_lump = -1;
|
int patch_lump = -1;
|
||||||
|
int patch_priority = -1;
|
||||||
|
|
||||||
if (name[0])
|
if (name[0])
|
||||||
{
|
{
|
||||||
patch_lump = W_CheckNumForName(name);
|
patch_lump = W_CheckNumForName(name);
|
||||||
|
if (patch_lump >= 0)
|
||||||
|
{
|
||||||
|
patch_priority = lumpinfo[patch_lump].handle.priority;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (patch_lump < 0 && currentMenu->menuitems[i].alttext)
|
if ((patch_lump < 0 || patch_priority < bigfont_priority)
|
||||||
|
&& currentMenu->menuitems[i].alttext)
|
||||||
{
|
{
|
||||||
currentMenu->lumps_missing++;
|
currentMenu->lumps_missing++;
|
||||||
break;
|
break;
|
||||||
|
@ -4775,8 +4775,14 @@ int MN_StringHeight(const char *string)
|
|||||||
void MN_DrawTitle(int x, int y, const char *patch, const char *alttext)
|
void MN_DrawTitle(int x, int y, const char *patch, const char *alttext)
|
||||||
{
|
{
|
||||||
int patch_lump = W_CheckNumForName(patch);
|
int patch_lump = W_CheckNumForName(patch);
|
||||||
|
int patch_priority = -1;
|
||||||
|
|
||||||
if (patch_lump >= 0)
|
if (patch_lump >= 0)
|
||||||
|
{
|
||||||
|
patch_priority = lumpinfo[patch_lump].handle.priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (patch_lump >= 0 && patch_priority >= bigfont_priority)
|
||||||
{
|
{
|
||||||
patch_t *patch = V_CachePatchNum(patch_lump, PU_CACHE);
|
patch_t *patch = V_CachePatchNum(patch_lump, PU_CACHE);
|
||||||
V_DrawPatch(x == M_X_CENTER ? SCREENWIDTH / 2 - patch->width / 2 : x,
|
V_DrawPatch(x == M_X_CENTER ? SCREENWIDTH / 2 - patch->width / 2 : x,
|
||||||
|
@ -92,7 +92,8 @@ static boolean W_FILE_AddDir(w_handle_t handle, const char *path,
|
|||||||
item.size = FileLength(descriptor);
|
item.size = FileLength(descriptor);
|
||||||
|
|
||||||
item.module = &w_file_module;
|
item.module = &w_file_module;
|
||||||
w_handle_t local_handle = {.p1.descriptor = descriptor};
|
w_handle_t local_handle = {.p1.descriptor = descriptor,
|
||||||
|
.priority = handle.priority};
|
||||||
item.handle = local_handle;
|
item.handle = local_handle;
|
||||||
|
|
||||||
array_push(lumpinfo, item);
|
array_push(lumpinfo, item);
|
||||||
@ -125,7 +126,8 @@ static w_type_t W_FILE_Open(const char *path, w_handle_t *handle)
|
|||||||
|
|
||||||
I_Printf(VB_INFO, " adding %s", path); // killough 8/8/98
|
I_Printf(VB_INFO, " adding %s", path); // killough 8/8/98
|
||||||
|
|
||||||
w_handle_t local_handle = {.p1.descriptor = descriptor};
|
w_handle_t local_handle = {.p1.descriptor = descriptor,
|
||||||
|
.priority = handle->priority};
|
||||||
|
|
||||||
// open the file and add to directory
|
// open the file and add to directory
|
||||||
|
|
||||||
|
@ -152,7 +152,11 @@ static void AddDirs(w_module_t *module, w_handle_t handle, const char *base)
|
|||||||
|
|
||||||
boolean W_AddPath(const char *path)
|
boolean W_AddPath(const char *path)
|
||||||
{
|
{
|
||||||
|
static int priority;
|
||||||
|
|
||||||
w_handle_t handle = {0};
|
w_handle_t handle = {0};
|
||||||
|
handle.priority = priority++;
|
||||||
|
|
||||||
w_module_t *active_module = NULL;
|
w_module_t *active_module = NULL;
|
||||||
|
|
||||||
for (int i = 0; i < arrlen(modules); ++i)
|
for (int i = 0; i < arrlen(modules); ++i)
|
||||||
|
@ -79,6 +79,8 @@ typedef struct
|
|||||||
int position;
|
int position;
|
||||||
int index;
|
int index;
|
||||||
} p2;
|
} p2;
|
||||||
|
|
||||||
|
int priority;
|
||||||
} w_handle_t;
|
} w_handle_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
11
src/w_zip.c
11
src/w_zip.c
@ -32,11 +32,13 @@ static void ConvertSlashes(char *path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AddWadInMem(mz_zip_archive *zip, const char *name, int index,
|
static void AddWadInMem(w_handle_t handle, const char *name, int index,
|
||||||
size_t data_size)
|
size_t data_size)
|
||||||
{
|
{
|
||||||
I_Printf(VB_INFO, " - adding %s", name);
|
I_Printf(VB_INFO, " - adding %s", name);
|
||||||
|
|
||||||
|
mz_zip_archive *zip = handle.p1.zip;
|
||||||
|
|
||||||
byte *data = malloc(data_size);
|
byte *data = malloc(data_size);
|
||||||
|
|
||||||
if (!mz_zip_reader_extract_to_mem(zip, index, data, data_size, 0))
|
if (!mz_zip_reader_extract_to_mem(zip, index, data, data_size, 0))
|
||||||
@ -95,6 +97,8 @@ static void AddWadInMem(mz_zip_archive *zip, const char *name, int index,
|
|||||||
item.size = size;
|
item.size = size;
|
||||||
item.data = data + position;
|
item.data = data + position;
|
||||||
|
|
||||||
|
item.handle = handle;
|
||||||
|
|
||||||
// [FG] WAD file that contains the lump
|
// [FG] WAD file that contains the lump
|
||||||
item.wad_file = wadname;
|
item.wad_file = wadname;
|
||||||
array_push(lumpinfo, item);
|
array_push(lumpinfo, item);
|
||||||
@ -125,7 +129,7 @@ static boolean W_ZIP_AddDir(w_handle_t handle, const char *path,
|
|||||||
|
|
||||||
if (is_root && M_StringCaseEndsWith(stat.m_filename, ".wad"))
|
if (is_root && M_StringCaseEndsWith(stat.m_filename, ".wad"))
|
||||||
{
|
{
|
||||||
AddWadInMem(zip, M_BaseName(stat.m_filename), index,
|
AddWadInMem(handle, M_BaseName(stat.m_filename), index,
|
||||||
stat.m_uncomp_size);
|
stat.m_uncomp_size);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -154,7 +158,8 @@ static boolean W_ZIP_AddDir(w_handle_t handle, const char *path,
|
|||||||
item.size = stat.m_uncomp_size;
|
item.size = stat.m_uncomp_size;
|
||||||
|
|
||||||
item.module = &w_zip_module;
|
item.module = &w_zip_module;
|
||||||
w_handle_t local_handle = {.p1.zip = zip, .p2.index = index};
|
w_handle_t local_handle = {.p1.zip = zip, .p2.index = index,
|
||||||
|
.priority = handle.priority};
|
||||||
item.handle = local_handle;
|
item.handle = local_handle;
|
||||||
|
|
||||||
array_push(lumpinfo, item);
|
array_push(lumpinfo, item);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user