mirror of
https://github.com/nzp-team/quakespasm.git
synced 2024-11-24 21:01:09 +00:00
Default to backup plan if loading screen doesn't exist, add logic for PNG loading in Draw_CachePic
This commit is contained in:
parent
b0fdf9436a
commit
77bbe4eddb
6 changed files with 61 additions and 26 deletions
|
@ -31,8 +31,8 @@ include $(DEVKITPRO)/libnx/switch_rules
|
|||
# - <libnx folder>/default_icon.jpg
|
||||
#---------------------------------------------------------------------------------
|
||||
APP_TITLE := NaziZombiesPortableNX
|
||||
APP_AUTHOR := naievil
|
||||
APP_VERSION := 0.1.0
|
||||
APP_AUTHOR := NZP Team
|
||||
APP_VERSION := 1.0.0
|
||||
ICON := assets/nx/icon.jpg
|
||||
|
||||
TARGET := nzportable
|
||||
|
@ -293,4 +293,4 @@ $(OFILES_SRC) : $(HFILES_BIN)
|
|||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
#---------------------------------------------------------------------------------------
|
||||
|
|
|
@ -311,8 +311,10 @@ qpic_t *Draw_CachePic (const char *path)
|
|||
if (!strcmp (path, pic->name))
|
||||
return &pic->pic;
|
||||
}
|
||||
|
||||
if (menu_numcachepics == MAX_CACHED_PICS)
|
||||
Sys_Error ("menu_numcachepics == MAX_CACHED_PICS");
|
||||
|
||||
menu_numcachepics++;
|
||||
strcpy (pic->name, path);
|
||||
|
||||
|
@ -328,14 +330,23 @@ qpic_t *Draw_CachePic (const char *path)
|
|||
src_type = SRC_TGA;
|
||||
|
||||
dat = (qpic_t *)LoadTGAPic(path_noext);
|
||||
if (!dat)
|
||||
if (!dat) {
|
||||
Host_Error ("Draw_CachePic: failed to load %s", path);
|
||||
}
|
||||
} else if (!strcmp("png", extension)) {
|
||||
src_type = SRC_RGBA;
|
||||
|
||||
dat = (qpic_t *)LoadPNGPic(path_noext);
|
||||
if (!dat) {
|
||||
Host_Error ("Draw_CachePic: failed to load %s", path);
|
||||
}
|
||||
} else {
|
||||
src_type = SRC_INDEXED;
|
||||
|
||||
dat = (qpic_t *)COM_LoadTempFile (path, NULL);
|
||||
if (!dat)
|
||||
if (!dat) {
|
||||
Host_Error ("Draw_CachePic: failed to load %s", path);
|
||||
}
|
||||
SwapPic (dat);
|
||||
}
|
||||
|
||||
|
|
|
@ -1221,6 +1221,7 @@ char *ReturnLoadingtex (void)
|
|||
return "wut wut";
|
||||
}
|
||||
qboolean load_screen_exists;
|
||||
char lpath[MAX_QPATH];
|
||||
void SCR_DrawLoadScreen (void)
|
||||
{
|
||||
int max_step = 350;
|
||||
|
@ -1231,29 +1232,31 @@ void SCR_DrawLoadScreen (void)
|
|||
if (!con_forcedup)
|
||||
return;
|
||||
|
||||
load_screen_exists = false;
|
||||
|
||||
if (loadingScreen) {
|
||||
if (!loadscreeninit) {
|
||||
load_screen_exists = false;
|
||||
|
||||
char* lpath;
|
||||
lpath = (char*)Z_Malloc(sizeof(char)*32);
|
||||
strcpy(lpath, "gfx/lscreen/");
|
||||
strcat(lpath, loadname2);
|
||||
|
||||
sprintf(lpath, "gfx/lscreen/%s.png", loadname2);
|
||||
lscreen = Draw_CachePic(lpath);
|
||||
|
||||
//awoo = Draw_CachePic("gfx/menu/awoo.png");
|
||||
|
||||
if (lscreen == NULL)
|
||||
{
|
||||
lscreen = Draw_CachePic("gfx/lscreen/lscreen");
|
||||
|
||||
// naievil -- go to default loadingscreen
|
||||
if (lscreen == NULL) {
|
||||
sprintf(lpath, "gfx/lscreen/lscreen.png", loadname2);
|
||||
lscreen = Draw_CachePic(lpath);
|
||||
}
|
||||
|
||||
// naievil -- if that fails, we need to not load anything
|
||||
if (lscreen == NULL) {
|
||||
load_screen_exists = false;
|
||||
} else {
|
||||
load_screen_exists = true;
|
||||
loadscreeninit = true;
|
||||
}
|
||||
load_screen_exists = true;
|
||||
|
||||
loadscreeninit = true;
|
||||
}
|
||||
|
||||
if (load_screen_exists == true)
|
||||
{
|
||||
if (load_screen_exists == true) {
|
||||
#ifdef VITA
|
||||
Draw_StretchPic(0, 0, lscreen, vid.width, vid.height);
|
||||
#else
|
||||
|
@ -1275,8 +1278,7 @@ void SCR_DrawLoadScreen (void)
|
|||
|
||||
}
|
||||
|
||||
if (loadingtimechange < Sys_DoubleTime ())
|
||||
{
|
||||
if (loadingtimechange < Sys_DoubleTime ()) {
|
||||
lodinglinetext = ReturnLoadingtex();
|
||||
loadingtextwidth = strlen(lodinglinetext); //strlen(lodinglinetext)*8
|
||||
loadingtimechange = Sys_DoubleTime () + 5;
|
||||
|
|
|
@ -720,7 +720,28 @@ qpic_t *LoadTGAPic (char *path)
|
|||
byte *data;
|
||||
int w;
|
||||
int h;
|
||||
char *lscreendefault;
|
||||
|
||||
data = Image_LoadImage(path, &w, &h);
|
||||
|
||||
// Build it into a qpic for easy return
|
||||
|
||||
qpic_t *pic;
|
||||
|
||||
pic = (qpic_t *) Hunk_Alloc (sizeof(qpic_t) - 4 + (4 * w * h));
|
||||
|
||||
pic->width = w;
|
||||
pic->height = h;
|
||||
memcpy(pic->data, data, (4 * w * h));
|
||||
|
||||
return pic;
|
||||
}
|
||||
|
||||
|
||||
qpic_t *LoadPNGPic (char *path)
|
||||
{
|
||||
byte *data;
|
||||
int w;
|
||||
int h;
|
||||
|
||||
data = Image_LoadImage(path, &w, &h);
|
||||
|
||||
|
|
|
@ -112,6 +112,7 @@ void GL_Bind (gltexture_t *texture);
|
|||
void GL_ClearBindings (void);
|
||||
|
||||
qpic_t *LoadTGAPic (char *path);
|
||||
qpic_t *LoadPNGPic (char *path);
|
||||
|
||||
#endif /* _GL_TEXMAN_H */
|
||||
|
||||
|
|
|
@ -831,8 +831,8 @@ void Preload (void)
|
|||
{
|
||||
Mod_ForName ("models/player.mdl", true);
|
||||
|
||||
Mod_ForName("models/ai/zb#.mdl", true);
|
||||
Mod_ForName("models/ai/zbc#.mdl", true);
|
||||
Mod_ForName("models/ai/zb%.mdl", true);
|
||||
Mod_ForName("models/ai/zbc%.mdl", true);
|
||||
Mod_ForName ("models/ai/zfull.mdl",true);
|
||||
Mod_ForName ("models/ai/zcfull.mdl",true);
|
||||
Mod_ForName ("models/ai/zh^.mdl",true);
|
||||
|
|
Loading…
Reference in a new issue