diff --git a/source/draw.h b/source/draw.h index fce5a6b..27d527d 100644 --- a/source/draw.h +++ b/source/draw.h @@ -25,6 +25,7 @@ void Draw_Init (void); void Draw_Character (int x, int y, int num); void Draw_DebugChar (char num); void Draw_Pic (int x, int y, qpic_t *pic); +void Draw_PicIndex (int x, int y, int width, int height, int texture_index); void Draw_StretchPic (int x, int y, qpic_t *pic, int x_value, int y_value); void Draw_ColorPic (int x, int y, qpic_t *pic, float r, float g , float b, float a); void Draw_ColoredString (int x, int y, char *text, float r, float g, float b, float a, int scale); @@ -47,6 +48,5 @@ extern int loading_step; extern char loading_name[32]; extern float loading_num_step; -qpic_t *Draw_PicFromWad (char *name); qpic_t *Draw_CachePic (char *path); qpic_t *Draw_CacheImg (char *path); diff --git a/source/host.c b/source/host.c index 9408396..66112c8 100644 --- a/source/host.c +++ b/source/host.c @@ -498,8 +498,6 @@ void Host_ClearMemory (void) { Con_DPrintf ("Clearing memory\n"); - D_FlushCaches (); - Mod_ClearAll (); if (host_hunklevel) @@ -706,7 +704,8 @@ void _Host_Frame (float time) pass1+pass2+pass3, pass1, pass2, pass3); } - //Con_Printf ("%dkB free \n", pspSdkTotalFreeUserMemSize()/1024); + // Debug log free memory + // if ((host_framecount % 120) == 0) Con_Printf ("%.2fkB free \n", pspSdkTotalFreeUserMemSize()/1024.f); //frame speed counter fps_count++;//muff diff --git a/source/menu.c b/source/menu.c index 0201dc5..a916b24 100644 --- a/source/menu.c +++ b/source/menu.c @@ -62,16 +62,16 @@ extern char* loadnamespec; extern qboolean loadscreeninit; // Backgrounds -qpic_t *menu_bk; +int menu_bk; // Map screens -qpic_t *menu_ndu; -qpic_t *menu_wh; +int menu_ndu; +int menu_wh; //qpic_t *menu_kn; -qpic_t *menu_ch; +int menu_ch; //qpic_t *menu_wn; -qpic_t *menu_custom; -qpic_t *menu_cuthum; +int menu_custom; +int menu_cuthum; typedef struct @@ -79,6 +79,7 @@ typedef struct int occupied; int map_allow_game_settings; int map_use_thumbnail; + int thumbnail_index; char* map_name; char* map_name_pretty; char* map_desc_1; @@ -94,7 +95,8 @@ typedef struct } usermap_t; SceIoStat custom_thumbnail_size; -usermap_t custom_maps[50]; +#define MAX_CUSTOM_MAPS 50 +usermap_t custom_maps[MAX_CUSTOM_MAPS]; enum { @@ -414,18 +416,18 @@ int M_Start_Cusor; void M_Start_Menu_f () { + Load_Achivements(); + M_Load_Menu_Pics(); key_dest = key_menu; m_state = m_start; m_entersound = true; //loadingScreen = 0; - Load_Achivements(); } static void M_Start_Menu_Draw () { // Background - menu_bk = Draw_CacheImg("gfx/menu/menu_background"); - Draw_Pic (0, 0, menu_bk); + Draw_PicIndex (0, 0, 480, 272, menu_bk); // Fill black to make everything easier to see Draw_FillByColor(0, 0, 480, 272, GU_RGBA(0, 0, 0, 102)); @@ -444,6 +446,23 @@ void M_Start_Key (int key) break; } } + +void M_Load_Menu_Pics () +{ + menu_bk = loadtextureimage("gfx/menu/menu_background", 0, 0, false, GU_LINEAR); + menu_ndu = loadtextureimage("gfx/menu/nacht_der_untoten", 0, 0, false, GU_LINEAR); + //menu_kn = Draw_CacheImg("gfx/menu/kino_der_toten"); + menu_wh = loadtextureimage("gfx/menu/warehouse", 0, 0, false, GU_LINEAR); + //menu_wn = Draw_CacheImg("gfx/menu/wahnsinn"); + menu_ch = loadtextureimage("gfx/menu/christmas_special", 0, 0, false, GU_LINEAR); + menu_custom = loadtextureimage("gfx/menu/custom", 0, 0, false, GU_LINEAR); + for (int i = 0; i < MAX_CUSTOM_MAPS; i++) { + if (custom_maps[i].occupied == false) continue; + if (custom_maps[i].map_use_thumbnail == false) continue; + custom_maps[i].thumbnail_index = loadtextureimage(custom_maps[i].map_thumbnail_path, 0, 0, false, GU_LINEAR); + } +} + //============================================================================= int M_Paused_Cusor; @@ -568,7 +587,7 @@ void M_Menu_Main_f (void) void M_Main_Draw (void) { // Background - Draw_Pic (0, 0, menu_bk); + Draw_PicIndex (0, 0, 480, 272, menu_bk); // Fill black to make everything easier to see Draw_FillByColor(0, 0, 480, 272, GU_RGBA(0, 0, 0, 102)); @@ -800,6 +819,7 @@ void M_Exit_Key (int key) case K_ENTER: Cbuf_AddText("disconnect\n"); CL_ClearState (); + M_Load_Menu_Pics(); M_Menu_Main_f(); break; @@ -848,7 +868,7 @@ void M_Menu_Map_f (void) void M_Map_Draw (void) { // Background - Draw_Pic(0, 0, menu_bk); + Draw_PicIndex(0, 0, 480, 272, menu_bk); // Fill black to make everything easier to see Draw_FillByColor(0, 0, 480, 272, GU_RGBA(0, 0, 0, 102)); @@ -875,8 +895,7 @@ void M_Map_Draw (void) if (m_map_cursor == i) { if (custom_maps[i + multiplier].map_use_thumbnail == 1) { - menu_cuthum = Draw_CacheImg(custom_maps[i + multiplier].map_thumbnail_path); - Draw_StretchPic(256, 45, menu_cuthum, 175, 100); + Draw_PicIndex(256, 45, 175, 100, custom_maps[i].thumbnail_index); } if (custom_maps[i + multiplier].map_name_pretty != 0) @@ -1036,6 +1055,7 @@ void M_Map_Key (int key) Cbuf_AddText ("maxplayers 1\n"); Cbuf_AddText ("cd stop\n"); Cbuf_AddText (va("map %s\n", custom_maps[m_map_cursor + multiplier].map_name)); + Cbuf_Execute (); loadingScreen = 1; loadname2 = custom_maps[m_map_cursor + multiplier].map_name; if (custom_maps[m_map_cursor + multiplier].map_name_pretty != 0) @@ -1065,15 +1085,8 @@ void M_Menu_SinglePlayer_f (void) void M_SinglePlayer_Draw (void) { - menu_ndu = Draw_CacheImg("gfx/menu/nacht_der_untoten"); - //menu_kn = Draw_CacheImg("gfx/menu/kino_der_toten"); - menu_wh = Draw_CacheImg("gfx/menu/warehouse"); - //menu_wn = Draw_CacheImg("gfx/menu/wahnsinn"); - menu_ch = Draw_CacheImg("gfx/menu/christmas_special"); - menu_custom = Draw_CacheImg("gfx/menu/custom"); - // Background - Draw_Pic(0, 0, menu_bk); + Draw_PicIndex(0, 0, 480, 272, menu_bk); // Fill black to make everything easier to see Draw_FillByColor(0, 0, 480, 272, GU_RGBA(0, 0, 0, 102)); @@ -1126,7 +1139,7 @@ void M_SinglePlayer_Draw (void) // Map description & pic switch(m_singleplayer_cursor) { case 0: - Draw_StretchPic(256, 45, menu_ndu, 175, 100); + Draw_PicIndex(256, 45, 175, 100, menu_ndu); Draw_ColoredString(215, 155, "Desolate bunker located on a Ge-", 255, 255, 255, 255, 1); Draw_ColoredString(215, 165, "rman airfield, stranded after a", 255, 255, 255, 255, 1); Draw_ColoredString(215, 175, "brutal plane crash surrounded by", 255, 255, 255, 255, 1); @@ -1137,19 +1150,19 @@ void M_SinglePlayer_Draw (void) Draw_ColoredString(215, 225, "to the overwhelming onslaught?", 255, 255, 255, 255, 1); break; case 1: - Draw_StretchPic(256, 45, menu_wh, 175, 100); + Draw_PicIndex(256, 45, 175, 100, menu_wh); Draw_ColoredString(215, 155, "Old Warehouse full of Zombies!", 255, 255, 255, 255, 1); Draw_ColoredString(215, 165, "Fight your way to the Power", 255, 255, 255, 255, 1); Draw_ColoredString(215, 175, "Switch through the Hordes!", 255, 255, 255, 255, 1); break; case 2: - Draw_StretchPic(256, 45, menu_ch, 175, 100); + Draw_PicIndex(256, 45, 175, 100, menu_ch); Draw_ColoredString(215, 155, "No Santa this year. Though we're", 255, 255, 255, 255, 1); Draw_ColoredString(215, 165, "sure you will get presents from", 255, 255, 255, 255, 1); Draw_ColoredString(215, 175, "the undead! Will you accept them?", 255, 255, 255, 255, 1); break; case 3: - Draw_StretchPic(256, 45, menu_custom, 175, 100); + Draw_PicIndex(256, 45, 175, 100, menu_custom); Draw_ColoredString(215, 155, "Custom Maps made by Community", 255, 255, 255, 255, 1); Draw_ColoredString(215, 165, "Members on the Fourm and on", 255, 255, 255, 255, 1); Draw_ColoredString(215, 175, "Discord!", 255, 255, 255, 255, 1); @@ -1190,6 +1203,7 @@ void M_SinglePlayer_Key (int key) Cbuf_AddText ("maxplayers 1\n"); Cbuf_AddText ("cd stop\n"); Cbuf_AddText ("map ndu\n"); + Cbuf_Execute (); loadingScreen = 1; loadname2 = "ndu"; loadnamespec = "Nacht der Untoten"; @@ -1201,6 +1215,7 @@ void M_SinglePlayer_Key (int key) Cbuf_AddText ("maxplayers 1\n"); Cbuf_AddText ("cd stop\n"); Cbuf_AddText ("map warehouse\n"); + Cbuf_Execute (); loadingScreen = 1; loadname2 = "warehouse"; loadnamespec = "Warehouse"; @@ -1212,6 +1227,7 @@ void M_SinglePlayer_Key (int key) Cbuf_AddText ("maxplayers 1\n"); Cbuf_AddText ("cd stop\n"); Cbuf_AddText ("map christmas_special\n"); + Cbuf_Execute (); loadingScreen = 1; loadname2 = "christmas_special"; loadnamespec = "Christmas Special"; @@ -1481,7 +1497,7 @@ void M_Achievement_Draw (void) // Background if (key_dest != key_menu_pause) - Draw_Pic (0, 0, menu_bk); + Draw_PicIndex (0, 0, 480, 272, menu_bk); // Fill black to make everything easier to see Draw_FillByColor(0, 0, 480, 272, GU_RGBA(0, 0, 0, 102)); @@ -1647,7 +1663,7 @@ void M_MultiPlayer_Draw (void) if (key_dest != key_menu_pause) - Draw_Pic (0, 0, menu_bk); + Draw_PicIndex (0, 0, 480, 272, menu_bk); //else //Draw_AlphaPic (0, 0, pause_bk, 0.4); //f = (int)(host_time * 10)%6; @@ -1816,7 +1832,7 @@ void M_Setup_Draw (void) { if (key_dest != key_menu_pause) - Draw_Pic (0, 0, menu_bk); + Draw_PicIndex (0, 0, 480, 272, menu_bk); if (setup_cursor == 0) M_Print (64, 72, "Access Point"); @@ -2013,7 +2029,7 @@ void M_ServerList_Draw (void) int serv, line; if (key_dest != key_menu_pause) - Draw_Pic (0, 0, menu_bk); + Draw_PicIndex (0, 0, 480, 272, menu_bk); //else //Draw_AlphaPic (0, 0, pause_bk, 0.4); @@ -2203,7 +2219,7 @@ void M_SEdit_Draw (void) { if (key_dest != key_menu_pause) - Draw_Pic (0, 0, menu_bk); + Draw_PicIndex (0, 0, 480, 272, menu_bk); //else //Draw_AlphaPic (0, 0, pause_bk, 0.4); @@ -2358,7 +2374,7 @@ void M_Net_Draw (void) int f; if (key_dest != key_menu_pause) - Draw_Pic (0, 0, menu_bk); + Draw_PicIndex (0, 0, 480, 272, menu_bk); //else //Draw_AlphaPic (0, 0, pause_bk, 0.4); @@ -2691,7 +2707,7 @@ void M_Screen_Draw (void) // Background if (key_dest != key_menu_pause) - Draw_Pic (0, 0, menu_bk); + Draw_PicIndex (0, 0, 480, 272, menu_bk); // Fill black to make everything easier to see Draw_FillByColor(0, 0, 480, 272, GU_RGBA(0, 0, 0, 102)); @@ -2874,7 +2890,7 @@ void M_Audio_Draw (void) float r; if (key_dest != key_menu_pause) - Draw_Pic (0, 0, menu_bk); + Draw_PicIndex (0, 0, 480, 272, menu_bk); //else //Draw_AlphaPic (0, 0, pause_bk, 0.4); @@ -2986,7 +3002,7 @@ void M_Gameplay_Draw (void) // Background if (key_dest != key_menu_pause) - Draw_Pic (0, 0, menu_bk); + Draw_PicIndex (0, 0, 480, 272, menu_bk); // Fill black to make everything easier to see Draw_FillByColor(0, 0, 480, 272, GU_RGBA(0, 0, 0, 102)); @@ -3166,7 +3182,7 @@ void M_Options_Draw (void) { // Background if (key_dest != key_menu_pause) - Draw_Pic (0, 0, menu_bk); + Draw_PicIndex (0, 0, 480, 272, menu_bk); // Fill black to make everything easier to see Draw_FillByColor(0, 0, 480, 272, GU_RGBA(0, 0, 0, 102)); @@ -3400,7 +3416,7 @@ void M_Keys_Draw (void) // Background if (key_dest != key_menu_pause) - Draw_Pic(0, 0, menu_bk); + Draw_PicIndex(0, 0, 480, 272, menu_bk); // Fill black to make everything easier to see Draw_FillByColor(0, 0, 480, 272, GU_RGBA(0, 0, 0, 102)); @@ -3550,7 +3566,7 @@ void M_Menu_Credits_f (void) void M_Credits_Draw (void) { // Background - Draw_Pic(0, 0, menu_bk); + Draw_PicIndex(0, 0, 480, 272, menu_bk); // Fill black to make everything easier to see Draw_FillByColor(0, 0, 480, 272, GU_RGBA(0, 0, 0, 102)); @@ -3739,7 +3755,7 @@ void M_Quit_Draw (void) if (wasInMenus) { if (key_dest != key_menu_pause) - Draw_Pic (0, 0, menu_bk); + Draw_PicIndex (0, 0, 480, 272, menu_bk); //else //Draw_AlphaPic (0, 0, pause_bk, 0.4); @@ -4047,7 +4063,7 @@ void M_SerialConfig_Draw (void) char *directModem; if (key_dest != key_menu_pause) - Draw_Pic (0, 0, menu_bk); + Draw_PicIndex(0, 0, 480, 272, menu_bk); //else //Draw_AlphaPic (0, 0, pause_bk, 0.4); @@ -4301,7 +4317,7 @@ void M_ModemConfig_Draw (void) int basex; if (key_dest != key_menu_pause) - Draw_Pic (0, 0, menu_bk); + Draw_PicIndex(0, 0, 480, 272, menu_bk); //else //Draw_AlphaPic (0, 0, pause_bk, 0.4); @@ -4488,7 +4504,7 @@ void M_LanConfig_Draw (void) char *protocol; if (key_dest != key_menu_pause) - Draw_Pic (0, 0, menu_bk); + Draw_PicIndex(0, 0, 480, 272, menu_bk); //else //Draw_AlphaPic (0, 0, pause_bk, 0.4); @@ -4897,7 +4913,7 @@ void M_GameOptions_Draw (void) int x; if (key_dest != key_menu_pause) - Draw_Pic (0, 0, menu_bk); + Draw_PicIndex(0, 0, 480, 272, menu_bk); //else //Draw_AlphaPic (0, 0, pause_bk, 0.4); @@ -5162,7 +5178,7 @@ void M_Search_Draw (void) int x; if (key_dest != key_menu_pause) - Draw_Pic (0, 0, menu_bk); + Draw_PicIndex(0, 0, 480, 272, menu_bk); //else //Draw_AlphaPic (0, 0, pause_bk, 0.4); diff --git a/source/psp/video_hardware.h b/source/psp/video_hardware.h index c18e351..0bd1584 100644 --- a/source/psp/video_hardware.h +++ b/source/psp/video_hardware.h @@ -56,6 +56,8 @@ int GL_LoadPalTex (const char *identifier, int width, int height, const byte *da int GL_LoadPalletedTexture (byte *in, char *identifier, int width, int height, int mode); void GL_UnloadTexture (const int texture_index); +void GL_UnloadAllTextures (); +void GL_MarkTextureAsPermanent (const int texture_index); extern int glx, gly, glwidth, glheight; @@ -169,7 +171,6 @@ typedef struct particle2_s extern entity_t r_worldentity; -extern qboolean r_cache_thrash; // compatability extern vec3_t modelorg, r_entorigin; extern entity_t *currententity; extern int r_visframecount; // ??? what difs? diff --git a/source/psp/video_hardware_QMB.cpp b/source/psp/video_hardware_QMB.cpp index af47210..d068780 100644 --- a/source/psp/video_hardware_QMB.cpp +++ b/source/psp/video_hardware_QMB.cpp @@ -450,6 +450,8 @@ void QMB_InitParticles (void) return; } + GL_MarkTextureAsPermanent(particleimage); + loading_cur_step++; strcpy(loading_name, "Particles"); SCR_UpdateScreen (); @@ -476,6 +478,8 @@ void QMB_InitParticles (void) //Clear_LoadingFill (); return; } + + GL_MarkTextureAsPermanent(particleimage); max_s = 384.0; max_t = 192.0; for (i = 0, ti = 0 ; i < 2 ; i++) @@ -501,6 +505,8 @@ void QMB_InitParticles (void) //Clear_LoadingFill (); return; } + + GL_MarkTextureAsPermanent(particleimage); /*max_s = max_t = 128.0; for (i = 0, ti = 0 ; i < 2 ; i++) @@ -516,6 +522,9 @@ void QMB_InitParticles (void) //Clear_LoadingFill (); return; } + + GL_MarkTextureAsPermanent(particleimage); + max_s = max_t = 256.0; ADD_PARTICLE_TEXTURE(ptex_flame, particleimage, 0, 1, 0, 0, 256, 256); @@ -528,6 +537,8 @@ void QMB_InitParticles (void) return; } + GL_MarkTextureAsPermanent(particleimage); + max_s = 256.0; max_t = 128.0; ADD_PARTICLE_TEXTURE(ptex_lightning, particleimage, 0, 1, 0, 0, 256, 128);//R00k changed @@ -540,6 +551,9 @@ void QMB_InitParticles (void) //Clear_LoadingFill (); return; } + + GL_MarkTextureAsPermanent(particleimage); + //max_s = max_t = 256.0; ADD_PARTICLE_TEXTURE(ptex_muzzleflash, particleimage, 0, 1, 0, 0, 128, 128); @@ -555,6 +569,9 @@ void QMB_InitParticles (void) //Clear_LoadingFill (); return; } + + GL_MarkTextureAsPermanent(particleimage); + //max_s = max_t = 256.0; ADD_PARTICLE_TEXTURE(ptex_muzzleflash2, particleimage, 0, 1, 0, 0, 128, 128); @@ -565,6 +582,9 @@ void QMB_InitParticles (void) //Clear_LoadingFill (); return; } + + GL_MarkTextureAsPermanent(particleimage); + //max_s = max_t = 256.0; ADD_PARTICLE_TEXTURE(ptex_muzzleflash3, particleimage, 0, 1, 0, 0, 128, 128); @@ -579,6 +599,9 @@ void QMB_InitParticles (void) //Clear_LoadingFill (); return; } + + GL_MarkTextureAsPermanent(particleimage); + //max_s = max_t = 256.0; ADD_PARTICLE_TEXTURE(ptex_bloodcloud, particleimage, 0, 1, 0, 0, 64, 64); diff --git a/source/psp/video_hardware_draw.cpp b/source/psp/video_hardware_draw.cpp index 18f89c1..d9c1ada 100644 --- a/source/psp/video_hardware_draw.cpp +++ b/source/psp/video_hardware_draw.cpp @@ -47,7 +47,6 @@ qpic_t *sniper_scope; int translate_texture; int char_texture; -int detail_texture; //int zombie_skins[3][8]; int zombie_skins[2][2]; int ref_texture; @@ -101,6 +100,7 @@ void VID_SetPalette4(unsigned char* clut4pal); #define MAX_GLTEXTURES 1024 gltexture_t gltextures[MAX_GLTEXTURES]; bool gltextures_used[MAX_GLTEXTURES]; +bool gltextures_is_permanent[MAX_GLTEXTURES]; int numgltextures; typedef struct @@ -131,6 +131,7 @@ void GL_InitTextureUsage () { for (int i=0; iwidth, pic->height, pic->data, qfalse, GU_NEAREST, 0); } -qpic_t *Draw_PicFromWad (char *name) -{ - qpic_t *p; - glpic_t *gl; - - p = static_cast(W_GetLumpName (name)); - gl = (glpic_t *)p->data; - gl->index = GL_LoadPicTexture (p); - - return p; -} - - /* ================ Draw_CachePic @@ -372,7 +360,8 @@ qpic_t *Draw_CachePic (char *path) gltextures[index].islmp = qfalse; gl = (glpic_t *)pic->pic.data; gl->index = index; - + GL_MarkTextureAsPermanent(gl->index); + return &pic->pic; } @@ -395,6 +384,7 @@ qpic_t *Draw_CachePic (char *path) gl = (glpic_t *)pic->pic.data; gl->index = GL_LoadPicTexture (dat); + GL_MarkTextureAsPermanent(gl->index); gltextures[gl->index].islmp = qtrue; return &pic->pic; @@ -402,7 +392,7 @@ qpic_t *Draw_CachePic (char *path) /* ================ -Draw_CachePic +Draw_CacheImg ================ */ qpic_t *Draw_CacheImg (char *path) @@ -433,6 +423,7 @@ qpic_t *Draw_CacheImg (char *path) gl = (glpic_t *)pic->pic.data; gl->index = index; + GL_MarkTextureAsPermanent(gl->index); return &pic->pic; } @@ -453,6 +444,7 @@ qpic_t *Draw_CacheImg (char *path) gl = (glpic_t *)pic->pic.data; gl->index = GL_LoadPicTexture (dat); + GL_MarkTextureAsPermanent(gl->index); return &pic->pic; } @@ -528,32 +520,20 @@ void Draw_Init (void) // it into a texture nonetexture = GL_LoadTexture ("nonetexture", 8, 8, (byte*)nontexdt, qfalse, GU_NEAREST, 0); + GL_MarkTextureAsPermanent(nonetexture); R_CreateDlightImage(); // now turn them into textures char_texture = loadtextureimage ("gfx/charset", 0, 0, qfalse, GU_NEAREST); + GL_MarkTextureAsPermanent(char_texture); if (char_texture == 0)// did not find a matching TGA... Sys_Error ("Could not load charset, make sure you have every folder and file installed properly\nDouble check that all of your files are in their correct places\nAnd that you have installed the game properly.\nRefer to the readme.txt file for help\n"); - detail_texture = loadtextureimage ("gfx/detail", 0, 0, qfalse, GU_LINEAR); - - if (detail_texture == 0)// did not find a matching TGA... - { - detail = static_cast(COM_LoadTempFile ("gfx/detail.lmp")); - if (!detail) - { - //Con_Printf ("Couldn't load gfx/detail \n"); FIXME no point? - detail_texture = nonetexture; - } - else - detail_texture = GL_LoadTexture ("Detail", 256, 256, detail, qfalse, GU_LINEAR, 3); - } - sniper_scope = Draw_CachePic ("gfx/hud/scope_256"); - + // GL_MarkTextureAsPermanent(sniper_scope); + zombie_skins[0][0] = loadtextureimage ("models/ai/zfull.mdl_0", 0, 0, qtrue, GU_LINEAR); - - + GL_MarkTextureAsPermanent(zombie_skins[0][0]); // PSP PHAT: Only have 1 Zombie skin.. this saves 192kB of VRAM, well worth it. #ifdef SLIM @@ -561,13 +541,13 @@ void Draw_Init (void) zombie_skins[0][1] = loadtextureimage ("models/ai/zfull.mdl_1", 0, 0, qtrue, GU_LINEAR); zombie_skins[1][0] = loadtextureimage ("models/ai/zfull.mdl_2", 0, 0, qtrue, GU_LINEAR); zombie_skins[1][1] = loadtextureimage ("models/ai/zfull.mdl_3", 0, 0, qtrue, GU_LINEAR); - + GL_MarkTextureAsPermanent(zombie_skins[0][1]); + GL_MarkTextureAsPermanent(zombie_skins[1][0]); + GL_MarkTextureAsPermanent(zombie_skins[1][1]); #else - - zombie_skins[0][1] = loadtextureimage ("models/ai/zfull.mdl_0", 0, 0, qtrue, GU_LINEAR); - zombie_skins[1][0] = loadtextureimage ("models/ai/zfull.mdl_0", 0, 0, qtrue, GU_LINEAR); - zombie_skins[1][1] = loadtextureimage ("models/ai/zfull.mdl_0", 0, 0, qtrue, GU_LINEAR); - + zombie_skins[0][1] = zombie_skins[0][0]; + zombie_skins[1][0] = zombie_skins[0][0]; + zombie_skins[1][1] = zombie_skins[0][0]; #endif // SLIM Clear_LoadingFill (); @@ -760,6 +740,53 @@ void Draw_AlphaPic (int x, int y, qpic_t *pic, float alpha) } } +/* +============= +Draw_AlphaPicIndex +============= +*/ +void Draw_PicIndex (int x, int y, int width, int height, int texture_index) +{ + GL_Bind(texture_index); + + struct vertex + { + short u, v; + short x, y, z; + }; + + vertex* const vertices = static_cast(sceGuGetMemory(sizeof(vertex) * 2)); + + vertices[0].u = 0; + vertices[0].v = 0; + vertices[0].x = x; + vertices[0].y = y; + vertices[0].z = 0; + + const gltexture_t& glt = gltextures[texture_index]; + if (gltextures[texture_index].islmp) + { + vertices[1].u = glt.original_width; + vertices[1].v = glt.original_height; + } + else + { + vertices[1].u = glt.width; + vertices[1].v = glt.height; + } + vertices[1].x = x + width; + vertices[1].y = y + height; + vertices[1].z = 0; + + sceGuColor(0xffffffff); + + sceGuDrawArray( + GU_SPRITES, + GU_TEXTURE_16BIT | GU_VERTEX_16BIT | GU_TRANSFORM_2D, + 2, 0, vertices); +} + + /* ============= @@ -2464,81 +2491,87 @@ GL_UnloadTexture */ void GL_UnloadTexture(int texture_index) { + if (gltextures_used[texture_index] == false) return; + if (gltextures_is_permanent[texture_index]) return; - if (gltextures_used[texture_index] == true) - { - gltexture_t& texture = gltextures[texture_index]; + gltexture_t& texture = gltextures[texture_index]; - Con_DPrintf("Unloading: %s,%d\n",texture.identifier, texture.bpp); - // Source. - strcpy(texture.identifier,""); - texture.original_width = 0; - texture.original_height = 0; - texture.stretch_to_power_of_two = qfalse; + // Con_Printf("Unloading: %s,%d\n",texture.identifier, texture.bpp); + // Source. + strcpy(texture.identifier,""); + texture.original_width = 0; + texture.original_height = 0; + texture.stretch_to_power_of_two = qfalse; - // Fill in the texture description. - texture.format = GU_PSM_T8; - texture.bpp = 0; - texture.filter = GU_LINEAR; - texture.width = 0; - texture.height = 0; - texture.mipmaps = 0; - texture.swizzle = 0; + // Fill in the texture description. + texture.format = GU_PSM_T8; + texture.bpp = 0; + texture.filter = GU_LINEAR; + texture.width = 0; + texture.height = 0; + texture.mipmaps = 0; + texture.swizzle = 0; #ifdef STATIC_PAL - memset(texture.palette, 0, sizeof(texture.palette)); + memset(texture.palette, 0, sizeof(texture.palette)); #else - if (texture.palette != NULL) - { - free(texture.palette); - texture.palette = NULL; - } - if (texture.palette_2 != NULL) - { - free(texture.palette_2); - texture.palette_2 = NULL; - } + if (texture.palette != NULL) + { + free(texture.palette); + texture.palette = NULL; + } + if (texture.palette_2 != NULL) + { + free(texture.palette_2); + texture.palette_2 = NULL; + } #endif - texture.palette_active = qfalse; - if (texture.palette != NULL) - { - free(texture.palette); - texture.palette = NULL; - } - if (texture.palette_2 != NULL) - { - free(texture.palette_2); - texture.palette_2 = NULL; - } - - // Buffers. - if (texture.ram != NULL) - { - free(texture.ram); - texture.ram = NULL; - } - if (texture.vram != NULL) - { - vfree(texture.vram); - texture.vram = NULL; - } - + texture.palette_active = qfalse; + if (texture.palette != NULL) + { + free(texture.palette); + texture.palette = NULL; + } + if (texture.palette_2 != NULL) + { + free(texture.palette_2); + texture.palette_2 = NULL; + } + + // Buffers. + if (texture.ram != NULL) + { + free(texture.ram); + texture.ram = NULL; + } + if (texture.vram != NULL) + { + vfree(texture.vram); + texture.vram = NULL; } gltextures_used[texture_index] = false; numgltextures--; - +} + +void GL_UnloadAllTextures() { + for (int i = 0; i < MAX_GLTEXTURES; i++) { + GL_UnloadTexture(i); + } } /* -================ -GL_LoadTexture -================ +For marking textures as something that should never be cleaned up, like fonts, zombie, etc. +There should never be need to change anything back from permanent. */ -int GL_LoadTexture (const char *identifier, int width, int height, const byte *data, qboolean stretch_to_power_of_two, int filter, int mipmap_level) -{ - int texture_index = -1; +void GL_MarkTextureAsPermanent(int texture_index) { + if (gltextures_used[texture_index] == false) { + Sys_Error("Tried to mark an empty texture as permanent!\n"); + } - tex_scale_down = r_tex_scale_down.value == qtrue; + gltextures_is_permanent[texture_index] = true; +} + +int GL_TextureForName(const char * identifier) { // See if the texture is already present. if (identifier[0]) { @@ -2554,27 +2587,53 @@ int GL_LoadTexture (const char *identifier, int width, int height, const byte *d } } } + return -1; +} +int GL_GetTextureIndex() { // Out of textures? if (numgltextures == MAX_GLTEXTURES) { - Sys_Error("Out of OpenGL textures"); + Sys_Error("Out of gl textures"); } - // Use the next available texture. numgltextures++; - texture_index = numgltextures; + int texture_index = -1; for (int i = 0; i < MAX_GLTEXTURES; ++i) { - if (gltextures_used[i] == false) { + if (gltextures_used[i] == false) + { texture_index = i; break; } } - gltexture_t& texture = gltextures[texture_index]; + + if (texture_index < 0) { + Sys_Error("Could not find a free gl texture!\n"); + } + gltextures_used[texture_index] = true; + return texture_index; +} + +/* +================ +GL_LoadTexture +================ +*/ +int GL_LoadTexture (const char *identifier, int width, int height, const byte *data, qboolean stretch_to_power_of_two, int filter, int mipmap_level) +{ + int texture_index = GL_TextureForName(identifier); + if (texture_index >= 0) return texture_index; + + tex_scale_down = r_tex_scale_down.value == qtrue; + + texture_index = GL_GetTextureIndex(); + + gltexture_t& texture = gltextures[texture_index]; + // Fill in the source data. strcpy(texture.identifier, identifier); texture.original_width = width; @@ -2660,46 +2719,14 @@ GL_LoadPalTex */ int GL_LoadPalTex (const char *identifier, int width, int height, const byte *data, qboolean stretch_to_power_of_two, int filter, int mipmap_level, byte *palette, int paltype) { - - int texture_index = -1; + int texture_index = GL_TextureForName(identifier); + if (texture_index >= 0) return texture_index; tex_scale_down = r_tex_scale_down.value == qtrue; - // See if the texture is already present. - if (identifier[0]) - { - for (int i = 0; i < MAX_GLTEXTURES; ++i) - { - if (gltextures_used[i] == true) - { - const gltexture_t& texture = gltextures[i]; - if (!strcmp (identifier, texture.identifier)) - { - return i; - } - } - } - } + + texture_index = GL_GetTextureIndex(); - // Out of textures? - if (numgltextures == MAX_GLTEXTURES) - { - Sys_Error("Out of OpenGL textures"); - } - - // Use the next available texture. - numgltextures++; - texture_index = numgltextures; - - for (int i = 0; i < MAX_GLTEXTURES; ++i) - { - if (gltextures_used[i] == false) - { - texture_index = i; - break; - } - } gltexture_t& texture = gltextures[texture_index]; - gltextures_used[texture_index] = true; // Fill in the source data. strcpy(texture.identifier, identifier); @@ -2845,51 +2872,14 @@ GL_LoadTextureLM int GL_LoadTextureLM (const char *identifier, int width, int height, const byte *data, int bpp, int filter, qboolean update, int forcopy) { tex_scale_down = r_tex_scale_down.value == qtrue; - int texture_index = -1; - // See if the texture is already present. - if (identifier[0]) - { - for (int i = 0; i < MAX_GLTEXTURES; ++i) - { - if (gltextures_used[i] == true) - { - const gltexture_t& texture = gltextures[i]; - if (!strcmp (identifier, texture.identifier)) - { - if (update == qfalse) - { - return i; - } - else - { - texture_index = i; - break; - } - } - } - } + int texture_index = GL_TextureForName(identifier); + if (texture_index >= 0 && update == qfalse) { + return texture_index; } if (update == qfalse || texture_index == -1) { - // Out of textures? - if (numgltextures == MAX_GLTEXTURES) - { - Sys_Error("Out of OpenGL textures"); - } - - // Use the next available texture. - numgltextures++; - texture_index = numgltextures; - - for (int i = 0; i < MAX_GLTEXTURES; ++i) - { - if (gltextures_used[i] == false) - { - texture_index = i; - break; - } - } + texture_index = GL_GetTextureIndex(); gltexture_t& texture = gltextures[texture_index]; gltextures_used[texture_index] = true; @@ -3073,47 +3063,14 @@ GL_LoadImages int total_overbudget_texturemem; int GL_LoadImages (const char *identifier, int width, int height, const byte *data, qboolean stretch_to_power_of_two, int filter, int mipmap_level, int bpp) { - int texture_index = -1; + int texture_index = GL_TextureForName(identifier); + if (texture_index >= 0) return texture_index; tex_scale_down = r_tex_scale_down.value == qtrue; - // See if the texture is already present. - if (identifier[0]) - { - for (int i = 0; i < MAX_GLTEXTURES; ++i) - { - if (gltextures_used[i] == true) - { - const gltexture_t& texture = gltextures[i]; - if (!strcmp (identifier, texture.identifier)) - { - return i; - } - } - } - } - - // Out of textures? - if (numgltextures == MAX_GLTEXTURES) - { Sys_Error("Out of OpenGL textures"); - } + texture_index = GL_GetTextureIndex(); - // Use the next available texture. - numgltextures++; - texture_index = numgltextures; - - for (int i = 0; i < MAX_GLTEXTURES; ++i) - { - if (gltextures_used[i] == false) - { - texture_index = i; - break; - } - } - gltexture_t& texture = gltextures[texture_index]; - gltextures_used[texture_index] = true; - // Fill in the source data. strcpy(texture.identifier, identifier); texture.original_width = width; @@ -3263,6 +3220,7 @@ int GL_LoadImages (const char *identifier, int width, int height, const byte *da //FIXME: this isn't completely clearing out the normal ram stuff :s if (texture.vram && texture.ram) { + Con_Printf("Put %s into VRAM (%dkB)\n", identifier, buffer_size/1024); free(texture.ram); texture.ram = NULL; } else { @@ -3356,42 +3314,11 @@ void GL_Upload4(int texture_index, const byte *data, int width, int height) int GL_LoadTexture4(const char *identifier, unsigned int width, unsigned int height, const byte *data, int filter, qboolean swizzled) { - int texture_index = -1; - - if (identifier[0]) - { - for (int i = 0; i < MAX_GLTEXTURES; ++i) - { - if (gltextures_used[i] == true) - { - const gltexture_t& texture = gltextures[i]; - if (!strcmp(identifier, texture.identifier)) - { - return i; - } - } - } - } + int texture_index = GL_TextureForName(identifier); + if (texture_index >= 0) return texture_index; - // Out of textures? - if (numgltextures == MAX_GLTEXTURES) - { - Sys_Error("Out of OpenGL textures"); - } - - // Use the next available texture. - numgltextures++; - texture_index = numgltextures; - - for (int i = 0; i < MAX_GLTEXTURES; ++i) - { - if (gltextures_used[i] == false) { - texture_index = i; - break; - } - } + texture_index = GL_GetTextureIndex(); gltexture_t& texture = gltextures[texture_index]; - gltextures_used[texture_index] = true; // Fill in the source data. strcpy(texture.identifier, identifier); diff --git a/source/psp/video_hardware_hlmdl.cpp b/source/psp/video_hardware_hlmdl.cpp index 7bce615..8d7722f 100644 --- a/source/psp/video_hardware_hlmdl.cpp +++ b/source/psp/video_hardware_hlmdl.cpp @@ -31,8 +31,6 @@ extern"C" #include #include -extern std::list mapTextureNameList; - extern model_t *loadmodel; extern vec3_t lightcolor; // LordHavoc: .lit support @@ -157,9 +155,7 @@ qboolean Mod_LoadHLModel (model_t *mod, void *buffer) for(i = 0; i < header->numtextures; i++) { - tex[i].i = GL_LoadPalTex (tex[i].name, tex[i].w, tex[i].h, (byte *) header + tex[i].i, qtrue, GU_LINEAR, 0, (byte *) header + tex[i].w * tex[i].h + tex[i].i, PAL_RGB); - mapTextureNameList.push_back(tex[i].i); // for unload textures } // // move the complete, relocatable alias model to the cache diff --git a/source/psp/video_hardware_main.cpp b/source/psp/video_hardware_main.cpp index a9164a4..76b9734 100644 --- a/source/psp/video_hardware_main.cpp +++ b/source/psp/video_hardware_main.cpp @@ -55,7 +55,6 @@ const float piconst = GU_PI / 180.0f; entity_t r_worldentity; entity_t *currententity; -qboolean r_cache_thrash; // compatability qboolean envmap; qboolean mirror; @@ -3708,8 +3707,6 @@ void R_RenderScene (void) V_SetContentsColor (r_viewleaf->contents); V_CalcBlend (); - r_cache_thrash = qfalse; - c_brush_polys = 0; c_alias_polys = 0; c_md3_polys = 0; diff --git a/source/psp/video_hardware_misc.cpp b/source/psp/video_hardware_misc.cpp index 3f53ff4..2df3f3c 100644 --- a/source/psp/video_hardware_misc.cpp +++ b/source/psp/video_hardware_misc.cpp @@ -45,12 +45,19 @@ void R_InitOtherTextures (void) { //static decals decal_blood1 = loadtextureimage ("textures/decals/blood_splat01", 0, 0, qfalse, GU_LINEAR); + GL_MarkTextureAsPermanent(decal_blood1); decal_blood2 = loadtextureimage ("textures/decals/blood_splat02", 0, 0, qfalse, GU_LINEAR); + GL_MarkTextureAsPermanent(decal_blood2); decal_blood3 = loadtextureimage ("textures/decals/blood_splat03", 0, 0, qfalse, GU_LINEAR); + GL_MarkTextureAsPermanent(decal_blood3); decal_q3blood = loadtextureimage ("textures/decals/blood_stain", 0, 0, qfalse, GU_LINEAR); + GL_MarkTextureAsPermanent(decal_blood1); decal_burn = loadtextureimage ("textures/decals/explo_burn01", 0, 0, qfalse, GU_LINEAR); + GL_MarkTextureAsPermanent(decal_burn); decal_mark = loadtextureimage ("textures/decals/particle_burn01", 0, 0, qfalse, GU_LINEAR); + GL_MarkTextureAsPermanent(decal_mark); decal_glow = loadtextureimage ("textures/decals/glow2", 0, 0, qfalse, GU_LINEAR); + GL_MarkTextureAsPermanent(decal_glow); } /* @@ -350,7 +357,7 @@ void R_Init (void) Cvar_RegisterVariable (&r_runqmbparticles); R_InitParticles (); - R_InitParticleTexture (); + // R_InitParticleTexture (); R_InitOtherTextures (); R_InitDecals (); Sky_Init (); //johnfitz @@ -451,8 +458,3 @@ void R_TimeRefresh_f (void) GL_EndRendering (); } -void D_FlushCaches (void) -{ -} - - diff --git a/source/psp/video_hardware_model.cpp b/source/psp/video_hardware_model.cpp index 0c321fa..6896bdd 100644 --- a/source/psp/video_hardware_model.cpp +++ b/source/psp/video_hardware_model.cpp @@ -36,10 +36,6 @@ extern "C" #include "video_hardware_hlmdl.h" #include "video_hardware_images.h" -#include - -std::list mapTextureNameList; - int LIGHTMAP_BYTES; model_t *loadmodel; @@ -227,32 +223,18 @@ void Mod_ClearAll (void) ent_file = NULL; //~~~~ - // maybe we should check if it is new map or not - // (so we dont unload textures unnecessary) - while (mapTextureNameList.size() > 0) - { - texture_index = mapTextureNameList.front(); - mapTextureNameList.pop_front(); - GL_UnloadTexture(texture_index); - } + GL_UnloadAllTextures(); + solidskytexture = -1; alphaskytexture = -1; //purge old sky textures for (i=0; i<6; i++) - { - if (skyimage[i] && skyimage[i] != solidskytexture) - GL_UnloadTexture(skyimage[i]); skyimage[i] = NULL; - } //purge old lightmaps for (i=0; ibspversion == HL_BSPVERSION && (name)[0] == '!') || \ (loadmodel->bspversion == NZP_BSPVERSION && (name)[0] == '!')) -extern int detail_texture; extern int nonetexture; /* ================= @@ -553,8 +534,6 @@ void Mod_LoadTextures (lump_t *l) if (loadmodel->bspversion != HL_BSPVERSION && loadmodel->bspversion != NZP_BSPVERSION && ISSKYTEX(tx->name)) { R_InitSky (tx_pixels); - mapTextureNameList.push_back(solidskytexture); - mapTextureNameList.push_back(alphaskytexture); } else { @@ -582,7 +561,6 @@ void Mod_LoadTextures (lump_t *l) com_netpath[0] = 0; tx->gl_texturenum = index; tx->fullbright = -1; - mapTextureNameList.push_back(tx->gl_texturenum); tx->dt_texturenum = 0; // if(tx_pixels = WAD3_LoadTexture(mt)) @@ -612,7 +590,6 @@ void Mod_LoadTextures (lump_t *l) h = *((int*)(f + 8)); tx->gl_texturenum = GL_LoadTexture4(mt->name, w, h, (byte*)(f + 16), GU_LINEAR, qfalse); - mapTextureNameList.push_back(tx->gl_texturenum); } } @@ -625,7 +602,6 @@ void Mod_LoadTextures (lump_t *l) { tx->gl_texturenum = GL_LoadTexture (mt->name, tx->width, tx->height, (byte *)(tx_pixels), qtrue, GU_LINEAR, level); } - mapTextureNameList.push_back(tx->gl_texturenum); /* //Crow_bar mult detail textures sprintf (detname, "gfx/detail/%s", mt->name); @@ -645,7 +621,6 @@ void Mod_LoadTextures (lump_t *l) // load the fullbright pixels version of the texture tx->fullbright = GL_LoadTexture (fbr_mask_name, tx->width, tx->height, (byte *)(tx_pixels), qtrue, GU_LINEAR, level); - mapTextureNameList.push_back(tx->fullbright); } else tx->fullbright = -1; // because 0 is a potentially valid texture number @@ -2042,7 +2017,7 @@ void Mod_FloodFillSkin( byte *skin, int skinwidth, int skinheight ) qboolean model_is_gun(char name[MAX_QPATH]) { - char* wep_path = static_cast(malloc(sizeof(char)*15)); + char wep_path[15]; for (int i = 0; i < 15; i++) { wep_path[i] = name[i]; @@ -2111,7 +2086,6 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype) if (model_is_zombie(loadmodel->name) == qtrue) { Mod_FloodFillSkin(skin, pheader->skinwidth, pheader->skinheight); - // force-fill 4 skin slots for (int i = 0; i < 4; i++) { switch(i) { @@ -2171,14 +2145,12 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype) pheader->gl_texturenum[i][2] = pheader->gl_texturenum[i][3] = loadtextureimage("models/machines/v_perk.mdl_0", 0, 0, qtrue, GU_LINEAR); pskintype = (daliasskintype_t *)((byte *)(pskintype+1) + s); - mapTextureNameList.push_back(pheader->gl_texturenum[i][i]); } else if (!has_perk_revive && i == 0) { pheader->gl_texturenum[i][0] = pheader->gl_texturenum[i][1] = pheader->gl_texturenum[i][2] = pheader->gl_texturenum[i][3] = zombie_skins[0][0]; pskintype = (daliasskintype_t *)((byte *)(pskintype+1) + s); - mapTextureNameList.push_back(pheader->gl_texturenum[i][i]); } if (i == 1 && has_perk_juggernog) { pheader->gl_texturenum[i][0] = @@ -2186,14 +2158,12 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype) pheader->gl_texturenum[i][2] = pheader->gl_texturenum[i][3] = loadtextureimage("models/machines/v_perk.mdl_1", 0, 0, qtrue, GU_LINEAR); pskintype = (daliasskintype_t *)((byte *)(pskintype+1) + s); - mapTextureNameList.push_back(pheader->gl_texturenum[i][i]); } else if (!has_perk_juggernog && i == 1) { pheader->gl_texturenum[i][0] = pheader->gl_texturenum[i][1] = pheader->gl_texturenum[i][2] = pheader->gl_texturenum[i][3] = zombie_skins[0][0]; pskintype = (daliasskintype_t *)((byte *)(pskintype+1) + s); - mapTextureNameList.push_back(pheader->gl_texturenum[i][i]); } if (i == 2 && has_perk_speedcola) { pheader->gl_texturenum[i][0] = @@ -2201,14 +2171,12 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype) pheader->gl_texturenum[i][2] = pheader->gl_texturenum[i][3] = loadtextureimage("models/machines/v_perk.mdl_2", 0, 0, qtrue, GU_LINEAR); pskintype = (daliasskintype_t *)((byte *)(pskintype+1) + s); - mapTextureNameList.push_back(pheader->gl_texturenum[i][i]); } else if (!has_perk_speedcola && i == 2) { pheader->gl_texturenum[i][0] = pheader->gl_texturenum[i][1] = pheader->gl_texturenum[i][2] = pheader->gl_texturenum[i][3] = zombie_skins[0][0]; pskintype = (daliasskintype_t *)((byte *)(pskintype+1) + s); - mapTextureNameList.push_back(pheader->gl_texturenum[i][i]); } if (i == 3 && has_perk_doubletap) { pheader->gl_texturenum[i][0] = @@ -2216,14 +2184,12 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype) pheader->gl_texturenum[i][2] = pheader->gl_texturenum[i][3] = loadtextureimage("models/machines/v_perk.mdl_3", 0, 0, qtrue, GU_LINEAR); pskintype = (daliasskintype_t *)((byte *)(pskintype+1) + s); - mapTextureNameList.push_back(pheader->gl_texturenum[i][i]); } else if (!has_perk_doubletap && i == 3) { pheader->gl_texturenum[i][0] = pheader->gl_texturenum[i][1] = pheader->gl_texturenum[i][2] = pheader->gl_texturenum[i][3] = zombie_skins[0][0]; pskintype = (daliasskintype_t *)((byte *)(pskintype+1) + s); - mapTextureNameList.push_back(pheader->gl_texturenum[i][i]); } if (i == 4 && has_perk_staminup) { pheader->gl_texturenum[i][0] = @@ -2231,14 +2197,12 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype) pheader->gl_texturenum[i][2] = pheader->gl_texturenum[i][3] = loadtextureimage("models/machines/v_perk.mdl_4", 0, 0, qtrue, GU_LINEAR); pskintype = (daliasskintype_t *)((byte *)(pskintype+1) + s); - mapTextureNameList.push_back(pheader->gl_texturenum[i][i]); } else if (!has_perk_staminup && i == 4) { pheader->gl_texturenum[i][0] = pheader->gl_texturenum[i][1] = pheader->gl_texturenum[i][2] = pheader->gl_texturenum[i][3] = zombie_skins[0][0]; pskintype = (daliasskintype_t *)((byte *)(pskintype+1) + s); - mapTextureNameList.push_back(pheader->gl_texturenum[i][i]); } if (i == 5 && has_perk_flopper) { pheader->gl_texturenum[i][0] = @@ -2246,14 +2210,12 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype) pheader->gl_texturenum[i][2] = pheader->gl_texturenum[i][3] = loadtextureimage("models/machines/v_perk.mdl_5", 0, 0, qtrue, GU_LINEAR); pskintype = (daliasskintype_t *)((byte *)(pskintype+1) + s); - mapTextureNameList.push_back(pheader->gl_texturenum[i][i]); } else if (!has_perk_flopper && i == 5) { pheader->gl_texturenum[i][0] = pheader->gl_texturenum[i][1] = pheader->gl_texturenum[i][2] = pheader->gl_texturenum[i][3] = zombie_skins[0][0]; pskintype = (daliasskintype_t *)((byte *)(pskintype+1) + s); - mapTextureNameList.push_back(pheader->gl_texturenum[i][i]); } if (i == 6 && has_perk_deadshot) { pheader->gl_texturenum[i][0] = @@ -2261,14 +2223,12 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype) pheader->gl_texturenum[i][2] = pheader->gl_texturenum[i][3] = loadtextureimage("models/machines/v_perk.mdl_6", 0, 0, qtrue, GU_LINEAR); pskintype = (daliasskintype_t *)((byte *)(pskintype+1) + s); - mapTextureNameList.push_back(pheader->gl_texturenum[i][i]); } else if (!has_perk_deadshot && i == 6) { pheader->gl_texturenum[i][0] = pheader->gl_texturenum[i][1] = pheader->gl_texturenum[i][2] = pheader->gl_texturenum[i][3] = zombie_skins[0][0]; pskintype = (daliasskintype_t *)((byte *)(pskintype+1) + s); - mapTextureNameList.push_back(pheader->gl_texturenum[i][i]); } if (i == 7 && has_perk_mulekick) { pheader->gl_texturenum[i][0] = @@ -2276,14 +2236,12 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype) pheader->gl_texturenum[i][2] = pheader->gl_texturenum[i][3] = loadtextureimage("models/machines/v_perk.mdl_7", 0, 0, qtrue, GU_LINEAR); pskintype = (daliasskintype_t *)((byte *)(pskintype+1) + s); - mapTextureNameList.push_back(pheader->gl_texturenum[i][i]); } else if (!has_perk_mulekick && i == 7) { pheader->gl_texturenum[i][0] = pheader->gl_texturenum[i][1] = pheader->gl_texturenum[i][2] = pheader->gl_texturenum[i][3] = zombie_skins[0][0]; pskintype = (daliasskintype_t *)((byte *)(pskintype+1) + s); - mapTextureNameList.push_back(pheader->gl_texturenum[i][i]); } } @@ -2338,9 +2296,6 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype) pheader->gl_texturenum[i][3] = loadrgbafrompal(name, pheader->skinwidth, pheader->skinheight, (byte*)(pskintype+1)); } pskintype = (daliasskintype_t *)((byte *)(pskintype+1) + s); - /* Crow_bar Memory Leak Fixed One Work not used */ - mapTextureNameList.push_back(pheader->gl_texturenum[i][i]); - /* Crow_bar Memory Leak Fixed */ } else { @@ -2375,9 +2330,6 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype) } } pskintype = (daliasskintype_t *)((byte *)(pskintype) + s); - /* Crow_bar Memory Leak Fixed*/ - mapTextureNameList.push_back(pheader->gl_texturenum[i][j&3]); - /* Crow_bar Memory Leak Fixed*/ } k = j; for (/* */; j < 4; j++) @@ -2823,9 +2775,6 @@ void Mod_LoadQ2AliasModel (model_t *mod, void *buffer) { pheader->gl_texturenum[i] = loadtextureimage (pinskins, 0, 0, qtrue, GU_LINEAR); pinskins += MD2MAX_SKINNAME; - /* Crow_bar Memory Leak Fixed */ - mapTextureNameList.push_back(pheader->gl_texturenum[i]); - /* Crow_bar Memory Leak Fixed */ } } @@ -3090,8 +3039,6 @@ void Mod_LoadQ3ModelTexture (char *identifier, int flags, int *gl_texnum) Q_snprintfz (loadpath, sizeof(loadpath), "maps/%s", identifier); *gl_texnum = loadtextureimage (loadpath, 0, 0, qtrue, GU_LINEAR); } - - mapTextureNameList.push_back(*gl_texnum); } //============================================================================== @@ -3652,10 +3599,6 @@ void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int framenum, Sys_Error("Mod_LoadSpriteFrame: Non sprite type"); } - /* Crow_bar Memory Leak Fixed */ - mapTextureNameList.push_back(pspriteframe->gl_texturenum); - /* Crow_bar Memory Leak Fixed */ - return (void *)((byte *)pinframe + sizeof (dspriteframe_t) + size); } @@ -3972,7 +3915,6 @@ qboolean Mod_LoadQ2SpriteModel (model_t *mod, void *buffer) frame = psprite->frames[i].frameptr = static_cast(Hunk_AllocName(sizeof(mspriteframe_t), loadname)); frame->gl_texturenum = loadtextureimage (pframetype->name, 0, 0, qtrue, GU_LINEAR); - mapTextureNameList.push_back(frame->gl_texturenum); frame->width = LittleLong(pframetype->width); frame->height = LittleLong(pframetype->height); diff --git a/source/psp/video_hardware_screen.cpp b/source/psp/video_hardware_screen.cpp index ea7f9de..11097be 100644 --- a/source/psp/video_hardware_screen.cpp +++ b/source/psp/video_hardware_screen.cpp @@ -111,7 +111,8 @@ qpic_t *hitmark; /*qpic_t *ls_ndu; qpic_t *ls_warehouse; qpic_t *ls_xmas;*/ -qpic_t *lscreen; +// qpic_t *lscreen; +int lscreen_index; int scr_fullupdate; @@ -862,7 +863,7 @@ char *lodinglinetext; qpic_t *awoo; char *ReturnLoadingtex (void) { - int StringNum = Random_Int(55); + int StringNum = Random_Int(61); switch(StringNum) { case 1: @@ -1027,10 +1028,31 @@ char *ReturnLoadingtex (void) case 54: return "Play some Custom Maps!"; break; + case 55: + return "Real OGs play on a PSP-1000!"; + break; + case 56: + return "Adding this tip improved framerate by 39%!"; + break; + case 57: + return "The NZ in NZP stands for New Zealand!"; + break; + case 58: + return "The P in NZP stands for Professional!"; + break; + case 59: + return "Many people have worked on this game!"; + break; + case 60: + return "Remember to stay hydrated!"; + break; + case 61: + return "cofe"; + break; } return "wut wut"; } -qboolean load_screen_exists; + void SCR_DrawLoadScreen (void) { @@ -1041,24 +1063,16 @@ void SCR_DrawLoadScreen (void) if (loadingScreen) { if (!loadscreeninit) { - load_screen_exists = qfalse; - - char* lpath; - lpath = (char*)Z_Malloc(sizeof(char)*32); + char lpath[32]; strcpy(lpath, "gfx/lscreen/"); strcat(lpath, loadname2); - - lscreen = Draw_CachePic(lpath); + lscreen_index = loadtextureimage(lpath, 0, 0, qfalse, GU_LINEAR); awoo = Draw_CacheImg("gfx/menu/awoo"); - - if (lscreen != NULL) - load_screen_exists = qtrue; - loadscreeninit = qtrue; } - if (load_screen_exists == qtrue) - Draw_Pic(scr_vrect.x, scr_vrect.y, lscreen); + if (lscreen_index > 0) + Draw_PicIndex(scr_vrect.x, scr_vrect.y, 480, 272, lscreen_index); Draw_FillByColor(0, 0, 480, 24, GU_RGBA(0, 0, 0, 150)); Draw_FillByColor(0, 248, 480, 24, GU_RGBA(0, 0, 0, 150)); diff --git a/source/render.h b/source/render.h index 6fb1e10..4de7626 100644 --- a/source/render.h +++ b/source/render.h @@ -179,8 +179,6 @@ typedef struct // // refresh // -extern int reinit_surfcache; - extern refdef_t r_refdef; extern vec3_t r_origin, vpn, vright, vup; @@ -226,16 +224,6 @@ void R_TeleportSplash (vec3_t org); void R_PushDlights (void); - -// -// surface cache related -// -extern int reinit_surfcache; // if 1, surface cache is currently empty and -extern qboolean r_cache_thrash; // set if thrashing the surface cache - -int D_SurfaceCacheForRes (int width, int height); -void D_FlushCaches (void); -void D_DeleteSurfaceCache (void); void D_InitCaches (void *buffer, int size); void R_SetVrect (vrect_t *pvrect, vrect_t *pvrectin, int lineadj);