From c4f894e939513ea9214b405495368d7246616fe0 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 5 Apr 2022 11:54:40 -0400 Subject: [PATCH] Restore new loading screens --- README.md | 2 +- source/cl_parse.c | 4 + source/draw.h | 1 + source/host.c | 35 ++++--- source/libpspmath/libpspmath.a | Bin 53800 -> 53800 bytes source/menu.c | 62 +++++++++--- source/psp/network_infrastructure.cpp | 2 +- source/psp/video_hardware_QMB.cpp | 22 ++--- source/psp/video_hardware_draw.cpp | 31 ++++-- source/psp/video_hardware_model.cpp | 5 + source/psp/video_hardware_screen.cpp | 131 ++++++++++++++------------ 11 files changed, 184 insertions(+), 111 deletions(-) diff --git a/README.md b/README.md index 555c261..a3a908c 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This repository contains the PSP engine for NZ:P, based on dQuakePlus and containing optimizations from the NZ:P Team, adQuake, and Xash3D-PSP, as well as NZ:P-specific feature implementation. It has also been modified to build on the latest versions of the [PSPSDK](https://github.com/pspdev/pspsdk). ## Building (Advanced) -Building requires a full install of [psptoolchain](https://github.com/pspdev/psptoolchain/). You can either follow the instructions on the GitHub repository or use a Docker container (we recommend [bmaupin](https://hub.docker.com/r/bmaupin/pspdev)'s)! +Building requires a full install of [psptoolchain](https://github.com/pspdev/psptoolchain/). You can either follow the instructions on the GitHub repository or use a Docker container (we recommend [sharkwouter](https://hub.docker.com/r/sharkwouter/pspdev)'s)! With the psptoolchain installed, you now need to install `libpspmath`, which we have included in the GitHub repository: ```bash diff --git a/source/cl_parse.c b/source/cl_parse.c index 671d7ae..0ea02cd 100644 --- a/source/cl_parse.c +++ b/source/cl_parse.c @@ -403,6 +403,7 @@ void CL_ParseServerInfo (void) // loading_num_step = loading_num_step +nummodels + numsounds; + loading_step = 1; //Con_Printf("Loaded Model: "); @@ -412,6 +413,7 @@ void CL_ParseServerInfo (void) if (cl.model_precache[i] == NULL) { Con_Printf("Model %s not found\n", model_precache[i]); + loading_cur_step++; return; } CL_KeepaliveMessage (); @@ -429,6 +431,8 @@ void CL_ParseServerInfo (void) //cl.model_precache[nummodels] = Mod_ForName ("progs/flame0.mdl", false); //cl_modelindex[mi_flame0] = nummodels++; + loading_step = 4; + S_BeginPrecaching (); //Con_Printf("Loaded Sounds: "); for (i=1 ; ik~gc(_4vw?I3iptF^Jbz^!`{SwM307ehG| zfyrMC12#9AokO*{z)A^4)#goh3M?>xm;rqzIXQN|=4Kh^U(Cp&;+sv~GvOfsQYW!_ zpRWgsPKnKGK{iMt0&65E$Co&5J{tBB#VpCq*P}F%)Pd|wPIjN17sR$XFa8Re+T>(K z6txnQ7cAD=d@lVHiaLqS53(iT>dZG4*daKRfezUmUt)|T0&@PQ3WUea!5;clgDzs! z=zyY2ax&2Ai}$pm2uf_e(v5n;&nv ricqupz|JHD4=nGvuay;+3M|1QPY-v))j&l0Pq?C}k=Xp@tO*MM6chK# delta 838 zcmZ3ngn7jh<_S_9#+F7VMy3{K8*TlsuFX2)PnZ!hAhib45eT)LC&)V>cwn(~4%)olX%H5s-g0C+}$$-R$4@7|oqQlceBkO~Fp`X$HcHGy>3QN3ZK%a|metNhYt^p#_f5H_-4KOL5HDLh&{XX`9 diff --git a/source/menu.c b/source/menu.c index c19fb38..9086f9a 100644 --- a/source/menu.c +++ b/source/menu.c @@ -57,6 +57,10 @@ extern qboolean bmg_type_changed; extern int loadingScreen; extern int ShowBlslogo; +extern char* loadname2; +extern char* loadnamespec; +extern qboolean loadscreeninit; + // Backgrounds qpic_t *menu_bk; @@ -450,6 +454,7 @@ void M_Paused_Menu_f () m_state = m_paused_menu; m_entersound = true; loadingScreen = 0; + loadscreeninit = false; M_Paused_Cusor = 0; } @@ -792,6 +797,7 @@ void M_Exit_Key (int key) case 'y': case K_ENTER: Cbuf_AddText("disconnect\n"); + CL_ClearState (); M_Menu_Main_f(); break; @@ -1027,7 +1033,12 @@ void M_Map_Key (int key) Cbuf_AddText ("disconnect\n"); Cbuf_AddText ("maxplayers 1\n"); Cbuf_AddText (va("map %s\n", custom_maps[m_map_cursor + multiplier].map_name)); - //loadingScreen = 1; + loadingScreen = 1; + loadname2 = custom_maps[m_map_cursor + multiplier].map_name; + if (custom_maps[m_map_cursor + multiplier].map_name_pretty != 0) + loadnamespec = custom_maps[m_map_cursor + multiplier].map_name_pretty; + else + loadnamespec = custom_maps[m_map_cursor + multiplier].map_name; } break; } @@ -1171,6 +1182,8 @@ void M_SinglePlayer_Key (int key) Cbuf_AddText ("maxplayers 1\n"); Cbuf_AddText ("map ndu\n"); loadingScreen = 1; + loadname2 = "ndu"; + loadnamespec = "Nacht der Untoten"; break; case 1: key_dest = key_game; @@ -1178,7 +1191,9 @@ void M_SinglePlayer_Key (int key) Cbuf_AddText ("disconnect\n"); Cbuf_AddText ("maxplayers 1\n"); Cbuf_AddText ("map warehouse\n"); - loadingScreen = 2; + loadingScreen = 1; + loadname2 = "warehouse"; + loadnamespec = "Warehouse"; break; case 2: key_dest = key_game; @@ -1186,7 +1201,9 @@ void M_SinglePlayer_Key (int key) Cbuf_AddText ("disconnect\n"); Cbuf_AddText ("maxplayers 1\n"); Cbuf_AddText ("map christmas_special\n"); - loadingScreen = 3; + loadingScreen = 1; + loadname2 = "christmas_special"; + loadnamespec = "Christmas Special"; break; case 3: M_Menu_Map_f (); @@ -4857,6 +4874,21 @@ double m_serverInfoMessageTime; //==================== Map Find System By Crow_bar ============================= +// UGHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH +// fuck windows +char* remove_windows_newlines(char* line) +{ + char *p = strchr(line, '\r'); + while (p) { + *p = '\0'; + strcat(line, ++p); + p = strchr(p, '\r'); + } + + return line; +} + + void Map_Finder(void) { @@ -4938,18 +4970,18 @@ void Map_Finder(void) strtok(buffer, "\n"); while(buffer != NULL) { switch(state) { - case 0: strcpy(custom_maps[user_maps_num].map_name_pretty, buffer); break; - case 1: strcpy(custom_maps[user_maps_num].map_desc_1, buffer); break; - case 2: strcpy(custom_maps[user_maps_num].map_desc_2, buffer); break; - case 3: strcpy(custom_maps[user_maps_num].map_desc_3, buffer); break; - case 4: strcpy(custom_maps[user_maps_num].map_desc_4, buffer); break; - case 5: strcpy(custom_maps[user_maps_num].map_desc_5, buffer); break; - case 6: strcpy(custom_maps[user_maps_num].map_desc_6, buffer); break; - case 7: strcpy(custom_maps[user_maps_num].map_desc_7, buffer); break; - case 8: strcpy(custom_maps[user_maps_num].map_desc_8, buffer); break; - case 9: strcpy(custom_maps[user_maps_num].map_author, buffer); break; - case 10: value = 0; sscanf(buffer, "%d", &value); custom_maps[user_maps_num].map_use_thumbnail = value; break; - case 11: value = 0; sscanf(buffer, "%d", &value); custom_maps[user_maps_num].map_allow_game_settings = value; break; + case 0: strcpy(custom_maps[user_maps_num].map_name_pretty, remove_windows_newlines(buffer)); break; + case 1: strcpy(custom_maps[user_maps_num].map_desc_1, remove_windows_newlines(buffer)); break; + case 2: strcpy(custom_maps[user_maps_num].map_desc_2, remove_windows_newlines(buffer)); break; + case 3: strcpy(custom_maps[user_maps_num].map_desc_3, remove_windows_newlines(buffer)); break; + case 4: strcpy(custom_maps[user_maps_num].map_desc_4, remove_windows_newlines(buffer)); break; + case 5: strcpy(custom_maps[user_maps_num].map_desc_5, remove_windows_newlines(buffer)); break; + case 6: strcpy(custom_maps[user_maps_num].map_desc_6, remove_windows_newlines(buffer)); break; + case 7: strcpy(custom_maps[user_maps_num].map_desc_7, remove_windows_newlines(buffer)); break; + case 8: strcpy(custom_maps[user_maps_num].map_desc_8, remove_windows_newlines(buffer)); break; + case 9: strcpy(custom_maps[user_maps_num].map_author, remove_windows_newlines(buffer)); break; + case 10: value = 0; sscanf(remove_windows_newlines(buffer), "%d", &value); custom_maps[user_maps_num].map_use_thumbnail = value; break; + case 11: value = 0; sscanf(remove_windows_newlines(buffer), "%d", &value); custom_maps[user_maps_num].map_allow_game_settings = value; break; default: break; } state++; diff --git a/source/psp/network_infrastructure.cpp b/source/psp/network_infrastructure.cpp index e6c5b87..c971c89 100644 --- a/source/psp/network_infrastructure.cpp +++ b/source/psp/network_infrastructure.cpp @@ -35,7 +35,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include -#include "gethost.hpp" +#include #include diff --git a/source/psp/video_hardware_QMB.cpp b/source/psp/video_hardware_QMB.cpp index 90cd8d4..8a1fbe7 100644 --- a/source/psp/video_hardware_QMB.cpp +++ b/source/psp/video_hardware_QMB.cpp @@ -442,7 +442,7 @@ void QMB_InitParticles (void) if (!(particleimage = loadtextureimage("textures/particles/particlefont", 0, 0, qfalse, GU_LINEAR))) { - Clear_LoadingFill (); + //Clear_LoadingFill (); return; } @@ -470,7 +470,7 @@ void QMB_InitParticles (void) // load the rest of the images if(!(particleimage = loadtextureimage("textures/particles/q3particlefont", 0, 0, qfalse, GU_LINEAR))) { - Clear_LoadingFill (); + //Clear_LoadingFill (); return; } @@ -495,7 +495,7 @@ void QMB_InitParticles (void) if (!(particleimage = loadtextureimage("textures/particles/flame", 0, 0, qfalse, GU_LINEAR))) { - Clear_LoadingFill (); + //Clear_LoadingFill (); return; } @@ -510,7 +510,7 @@ void QMB_InitParticles (void) if (!(particleimage = loadtextureimage("textures/particles/inferno", 0, 0, qfalse, GU_LINEAR))) { - Clear_LoadingFill (); + //Clear_LoadingFill (); return; } max_s = max_t = 256.0; @@ -521,7 +521,7 @@ void QMB_InitParticles (void) if (!(particleimage = loadtextureimage("textures/particles/zing1", 0, 0, qfalse, GU_LINEAR))) { - Clear_LoadingFill (); + //Clear_LoadingFill (); return; } @@ -534,7 +534,7 @@ void QMB_InitParticles (void) if (!(particleimage = loadtextureimage("textures/mzfl/mzfl0", 0, 0, qfalse, GU_LINEAR))) { - Clear_LoadingFill (); + //Clear_LoadingFill (); return; } //max_s = max_t = 256.0; @@ -545,7 +545,7 @@ void QMB_InitParticles (void) if (!(particleimage = loadtextureimage("textures/mzfl/mzfl1", 0, 0, qfalse, GU_LINEAR))) { - Clear_LoadingFill (); + //Clear_LoadingFill (); return; } //max_s = max_t = 256.0; @@ -555,7 +555,7 @@ void QMB_InitParticles (void) SCR_UpdateScreen (); if (!(particleimage = loadtextureimage("textures/mzfl/mzfl2", 0, 0, qfalse, GU_LINEAR))) { - Clear_LoadingFill (); + //Clear_LoadingFill (); return; } //max_s = max_t = 256.0; @@ -566,7 +566,7 @@ void QMB_InitParticles (void) if (!(particleimage = loadtextureimage("textures/mzfl/muzzleflash8", 0, 0, qfalse, GU_LINEAR))) { - Clear_LoadingFill (); + //Clear_LoadingFill (); return; } //max_s = max_t = 256.0; @@ -578,7 +578,7 @@ void QMB_InitParticles (void) max_s = max_t = 64.0; if (!(particleimage = loadtextureimage("textures/particles/bloodcloud", 0, 0, qfalse, GU_LINEAR))) { - Clear_LoadingFill (); + //Clear_LoadingFill (); return; } //max_s = max_t = 256.0; @@ -613,7 +613,7 @@ void QMB_InitParticles (void) */ if (!(particleimage = loadtextureimage("textures/particles/fly", 0, 0, qfalse, GU_LINEAR))) { - Clear_LoadingFill (); + //Clear_LoadingFill (); return; } max_s = max_t = 256.0; diff --git a/source/psp/video_hardware_draw.cpp b/source/psp/video_hardware_draw.cpp index 8cba139..19d1094 100644 --- a/source/psp/video_hardware_draw.cpp +++ b/source/psp/video_hardware_draw.cpp @@ -60,6 +60,8 @@ bool tex_scale_down = true; float loading_cur_step; char loading_name[32]; float loading_num_step; +int loading_step; +float loading_cur_step_bk; #define CLUT4 @@ -1024,29 +1026,46 @@ void Draw_LoadingFill(void) int size = 8; int max_step = 350; int x = (vid.width / 2) - (max_step / 2); - int y = vid.height - (size/ 2) - 10; + int y = vid.height - (size/ 2) - 25; int l; char str[64]; + char* text; if(loading_cur_step > loading_num_step) loading_cur_step = loading_num_step; + if (loading_cur_step < loading_cur_step_bk) + loading_cur_step = loading_cur_step_bk; + + if (loading_cur_step == loading_num_step && loading_cur_step_bk != loading_num_step) + loading_cur_step = loading_cur_step_bk; + float loadsize = loading_cur_step * (max_step / loading_num_step); - Draw_FillByColor (x - 2, y - 2, max_step + 4, size + 4, GU_RGBA(255, 255, 255, 200)); + Draw_FillByColor (x - 2, y - 2, max_step + 4, size + 4, GU_RGBA(69, 69, 69, 255)); Draw_FillByColor (x, y, loadsize, size, GU_RGBA(0, 0, 0, 200)); - strcpy (str, "Loading: "); - strcat (str, loading_name); - l = strlen (str); - Draw_String((vid.width - l*8)/2, y, str); + switch(loading_step) { + case 1: text = "Loading Models.."; break; + case 2: text = "Loading World.."; break; + case 3: text = "Running Test Frame.."; break; + case 4: text = "Loading Sounds.."; break; + default: text = "Initializing.."; break; + } + + l = strlen (text); + Draw_String((vid.width - l*8)/2, y, text); + + loading_cur_step_bk = loading_cur_step; } void Clear_LoadingFill (void) { //it is end loading loading_cur_step = 0; + loading_cur_step_bk = 0; loading_num_step = 0; + loading_step = -1; memset(loading_name, 0, sizeof(loading_name)); } diff --git a/source/psp/video_hardware_model.cpp b/source/psp/video_hardware_model.cpp index 175cc7a..6e0384b 100644 --- a/source/psp/video_hardware_model.cpp +++ b/source/psp/video_hardware_model.cpp @@ -1675,6 +1675,8 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer) loading_num_step = loading_num_step + 16; + loading_step = 2; + strcpy(loading_name, "Vertexes"); SCR_UpdateScreen (); @@ -1772,6 +1774,9 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer) SCR_UpdateScreen (); Mod_MakeHull0 (); + loading_cur_step++; + + loading_step = 3; strcpy(loading_name, "Screen"); loading_cur_step++; diff --git a/source/psp/video_hardware_screen.cpp b/source/psp/video_hardware_screen.cpp index a3a2335..6cd1f7f 100644 --- a/source/psp/video_hardware_screen.cpp +++ b/source/psp/video_hardware_screen.cpp @@ -26,6 +26,10 @@ extern "C" #include "../quakedef.h" } +#include +#include +#include + /* background clear @@ -102,15 +106,21 @@ extern "C" cvar_t crosshair; qboolean scr_initialized; // ready to draw qpic_t *hitmark; -qpic_t *ls_ndu; +/*qpic_t *ls_ndu; qpic_t *ls_warehouse; -qpic_t *ls_xmas; +qpic_t *ls_xmas;*/ +qpic_t *lscreen; int scr_fullupdate; int loadingScreen; int ShowBlslogo; +qboolean loadscreeninit; + +char* loadname2; +char* loadnamespec; + int clearconsole; int clearnotify; @@ -605,10 +615,6 @@ void SCR_Init (void) Cmd_AddCommand ("screenshot",SCR_ScreenShot_f); hitmark = Draw_CachePic("gfx/hud/hit_marker"); - //ls_wahnsinn = Draw_CachePic("gfx/lscreen/wahnsinn.lmp"); - //ls_xmas = Draw_CachePic("gfx/lscreen/christmas_special.lmp"); - //ls_warehouse = Draw_CacheImg("gfx/lscreen/warehouse"); - //ls_ndu = Draw_CacheImg("gfx/lscreen/ndu"); scr_initialized = qtrue; } @@ -811,18 +817,24 @@ SCR_DrawLoadScreen * Derped_Crusader * Aidan * yasen + * greg + * Asher + * Bernerd + * Omar Alejandro + * TheSmashers */ double loadingtimechange; int loadingdot; +int loadingtextwidth; char *lodinglinetext; qpic_t *awoo; char *ReturnLoadingtex (void) { - int StringNum = Random_Int(48); + int StringNum = Random_Int(55); switch(StringNum) { case 1: - return "The original Quake came out in 1996 (24 years ago as of 2020!)"; + return "Released in 1996, Quake is now over 25 years old!"; break; case 2: return "Use the Kar98-k to be the hero we want you to be!"; @@ -831,16 +843,16 @@ char *ReturnLoadingtex (void) return "There is a huge number of modern engines based on Quake!"; break; case 4: - return "Development for NZ:P officially started on September 27, 2009"; + return "Development for NZ:P officially began on September 27, 2009"; break; case 5: - return "NZ:P was first released on December 25, 2010"; + return "NZ:P was first released on December 25, 2010!"; break; case 6: return "The 1.1 release of NZ:P has over 90,000 downloads!"; break; case 7: - return "NZ:P has been downloaded over 400,00 times!"; + return "NZ:P has been downloaded over 400,000 times!"; break; case 8: return "The original NZP was made mainly by 3 guys around the world."; @@ -867,7 +879,7 @@ char *ReturnLoadingtex (void) return "Try Retro Mode, it's in the Graphics Settings!"; break; case 16: - return "Tired of Nacht der Untoten? Make your own map!"; + return "Tired of the base maps? Make your own or try some online!"; break; case 17: return "Slay zombies & be grateful."; @@ -951,10 +963,10 @@ char *ReturnLoadingtex (void) return "Please help me find the meaning of . Thanks."; break; case 44: - return "Loading..."; // "ripperoni" made me think the game crashed while loading + return "NZ:P Discord is ONLY for Thomas the Tank Engine Roleplay!"; break; case 45: - return "Get rid of the 21% cooler tip, it's an MLP reference"; + return "Get rid of the 21% cooler tip, it's an MLP reference."; break; case 46: return "You're playing on a PSP!"; @@ -962,9 +974,31 @@ char *ReturnLoadingtex (void) case 47: return "Don't leak the beta!"; break; + case 48: + return "Jugger-Nog increases your health!"; + break; + case 49: + return "greg was here"; + break; + case 50: + return "Where the hell is the Mystery Box?!"; + break; + case 51: + return "Zombies like getting shot.. I think."; + break; + case 52: + return "pro tip: aiming helps"; + break; + case 53: + return "If a Nazi Zombie bites you, are you a Nazi, or a Zombie?"; + break; + case 54: + return "Play some Custom Maps!"; + break; } return "wut wut"; } +qboolean load_screen_exists; void SCR_DrawLoadScreen (void) { @@ -972,67 +1006,46 @@ void SCR_DrawLoadScreen (void) return; if (!con_forcedup) return; -/* - static int count; - if (host_frametime < 0.01) - { - count = 0; - return; - } + if (loadingScreen) { + if (!loadscreeninit) { + load_screen_exists = qfalse; - count++; - if (count < 3) - return; -*/ + char* lpath; + lpath = (char*)Z_Malloc(sizeof(char)*32); + strcpy(lpath, "gfx/lscreen/"); + strcat(lpath, loadname2); - /*if(cl.worldmodel) - { - loadingScreen = 0; - ShowBlslogo = 1; - return; - }*/ + lscreen = Draw_CachePic(lpath); + awoo = Draw_CacheImg("gfx/menu/awoo"); + if (lscreen != NULL) + load_screen_exists = qtrue; - /*if (!ShowBlslogo) - { - pic = Draw_CachePic ("gfx/lscreen/blstrans"); - Draw_Pic (scr_vrect.x, scr_vrect.y, pic); - }*/ - /*if (loadingScreen == 1) - Draw_Pic (scr_vrect.x, scr_vrect.y, ls_wahnsinn);*/ - //else if (loadingScreen == 2) - /*Draw_Pic (scr_vrect.x, scr_vrect.y, ls_anstieg);*//* - else if (loadingScreen == 3) - { - pic = Draw_CachePic ("gfx/lscreen/psp_ch"); - Draw_Pic (scr_vrect.x, scr_vrect.y, pic); - } - else if (loadingScreen == 4) - { - pic = Draw_CachePic ("gfx/lscreen/psp_warehouse"); - Draw_Pic (scr_vrect.x, scr_vrect.y, pic); - }*/ + loadscreeninit = qtrue; + } - // loading screens - switch(loadingScreen) { - //case 1: Draw_Pic(scr_vrect.x, scr_vrect.y, ls_ndu); break; - //case 2: Draw_Pic(scr_vrect.x, scr_vrect.y, ls_warehouse); break; - //case 3: Draw_Pic(scr_vrect.x, scr_vrect.y, ls_xmas); break; + if (load_screen_exists == qtrue) + Draw_Pic(scr_vrect.x, scr_vrect.y, lscreen); + + Draw_FillByColor(0, 0, 480, 24, GU_RGBA(0, 0, 0, 150)); + Draw_FillByColor(0, 248, 480, 24, GU_RGBA(0, 0, 0, 150)); + + Draw_ColoredString(2, 4, loadnamespec, 255, 255, 0, 255, 2); } if (loadingtimechange < Sys_FloatTime ()) { lodinglinetext = ReturnLoadingtex(); + loadingtextwidth = strlen(lodinglinetext)*8; loadingtimechange = Sys_FloatTime () + 5; } if (key_dest == key_game) { - Draw_String (0, 0, lodinglinetext); + Draw_ColoredString(240 - loadingtextwidth/2, 256, lodinglinetext, 255, 255, 255, 255, 1); - if (lodinglinetext == "Please help me find the meaning of . Thanks.") { - awoo = Draw_CacheImg("gfx/menu/awoo"); - Draw_Pic(284, 0, awoo); + if (strcmp(lodinglinetext, "Please help me find the meaning of . Thanks.") == 0) { + Draw_Pic(335, 255, awoo); } }