More 3DS+PSP consolidation

This commit is contained in:
cypress 2024-09-05 19:06:36 -07:00
parent 4cc71152de
commit 22de83d643
10 changed files with 591 additions and 529 deletions

View file

@ -67,6 +67,7 @@ COMMON_OBJS = chase.c \
cl_main.c \
cl_parse.c \
cl_tent.c \
cl_slist.c \
bsp_strlcpy.c \
cmd.c \
common.c \

196
source/cl_slist.c Normal file
View file

@ -0,0 +1,196 @@
/*
Copyright (C) 1999,2000 contributors of the QuakeForge project
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "quakedef.h"
#include "cl_slist.h"
server_entry_t slist[MAX_SERVER_LIST];
//--------------------------------------UTILS-----------------------------------
char *Cmd_MakeArgs (int start)
{
int i, c;
static char text[1024];
text[0] = 0;
c = Cmd_Argc();
for (i = start; i < c; i++) {
if (i > start)
strncat (text, " ", sizeof(text) - strlen(text) - 1);
strncat (text, Cmd_Argv(i), sizeof(text) - strlen(text) - 1);
}
return text;
}
char *CreateSpaces(int amount)
{
static char spaces[1024];
int size;
size = bound(1, amount, sizeof(spaces) - 1);
memset(spaces, ' ', size);
spaces[size] = 0;
return spaces;
}
//------------------------------------------------------------------------------
void SList_Init (void)
{
memset (&slist, 0, sizeof(slist));
}
void SList_Shutdown (void)
{
FILE *f;
// if the first is empty already that means there isn't a single entry
if (!slist[0].server)
return;
//if (!(f = fopen("servers.lst", "wt")))
if (!(f = fopen(va("%s/servers.lst", com_gamedir), "wt")))
{
Con_DPrintf ("Couldn't open servers.lst\n");
return;
}
SList_Save (f);
fclose (f);
}
void SList_Set (int i, char *addr, char *desc)
{
if (i >= MAX_SERVER_LIST || i < 0)
Sys_Error ("SList_Set: Bad index %d", i);
if (slist[i].server)
Z_Free (slist[i].server);
if (slist[i].description)
Z_Free (slist[i].description);
slist[i].server = CopyString (addr);
slist[i].description = CopyString (desc);
}
void SList_Reset_NoFree (int i)
{
if (i >= MAX_SERVER_LIST || i < 0)
Sys_Error ("SList_Reset_NoFree: Bad index %d", i);
slist[i].description = slist[i].server = NULL;
}
void SList_Reset (int i)
{
if (i >= MAX_SERVER_LIST || i < 0)
Sys_Error ("SList_Reset: Bad index %d", i);
if (slist[i].server)
{
Z_Free (slist[i].server);
slist[i].server = NULL;
}
if (slist[i].description)
{
Z_Free (slist[i].description);
slist[i].description = NULL;
}
}
void SList_Switch (int a, int b)
{
server_entry_t temp;
if (a >= MAX_SERVER_LIST || a < 0)
Sys_Error ("SList_Switch: Bad index %d", a);
if (b >= MAX_SERVER_LIST || b < 0)
Sys_Error ("SList_Switch: Bad index %d", b);
memcpy_vfpu(&temp, &slist[a], sizeof(temp));
memcpy_vfpu(&slist[a], &slist[b], sizeof(temp));
memcpy_vfpu(&slist[b], &temp, sizeof(temp));
}
int SList_Length (void)
{
int count;
for (count = 0 ; count < MAX_SERVER_LIST && slist[count].server ; count++)
;
return count;
}
void SList_Load (void)
{
int c, len, argc, count;
char line[128], *desc, *addr;
FILE *f;
if (!(f = fopen (va("%s/servers.lst", com_gamedir), "rt")))
//if (!(f = fopen("servers.lst", "rt")))
return;
count = len = 0;
while ((c = getc(f)))
{
if (c == '\n' || c == '\r' || c == EOF)
{
if (c == '\r' && (c = getc(f)) != '\n' && c != EOF)
ungetc (c, f);
line[len] = 0;
len = 0;
Cmd_TokenizeString (line);
if ((argc = Cmd_Argc()) >= 1)
{
addr = Cmd_Argv(0);
desc = (argc >= 2) ? Cmd_Args() : "Unknown";
SList_Set (count, addr, desc);
if (++count == MAX_SERVER_LIST)
break;
}
if (c == EOF)
break; //just in case an EOF follows a '\r'
}
else
{
if (len + 1 < sizeof(line))
line[len++] = c;
}
}
fclose (f);
}
void SList_Save (FILE *f)
{
int i;
for (i=0 ; i<MAX_SERVER_LIST ; i++)
{
if (!slist[i].server)
break;
fprintf (f, "%s\t%s\n", slist[i].server, slist[i].description);
}
}

38
source/cl_slist.h Normal file
View file

@ -0,0 +1,38 @@
/*
Copyright (C) 1999,2000 contributors of the QuakeForge project
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#define MAX_SERVER_LIST 256
typedef struct {
char *server;
char *description;
} server_entry_t;
extern server_entry_t slist[MAX_SERVER_LIST];
void SList_Init(void);
void SList_Shutdown(void);
void SList_Set(int i,char *addr,char *desc);
void SList_Reset_NoFree(int i);
void SList_Reset(int i);
void SList_Switch(int a,int b);
int SList_Length(void);
void SList_Load(void);
void SList_Save(FILE *f);

View file

@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
@ -20,17 +20,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// host.c -- coordinates spawning and killing of local servers
#include "quakedef.h"
#include "r_local.h"
#ifdef __PSP__
#include "thread.h"
#include "psp/module.h"
#include <pspge.h>
#include <pspsysevent.h>
#endif // __PSP__
/*
A server can allways be started, even if the system started out as a client
to a remote system.
A client can NOT be started if the system started as a dedicated server.
Memory is cleared / released when a server or client begins, not when they end.
*/
quakeparms_t host_parms;
@ -53,10 +56,11 @@ jmp_buf host_abortserver;
byte *host_basepal;
byte *host_colormap;
byte *host_q2pal;
byte *host_h2pal;
cvar_t host_framerate = {"host_framerate","0"}; // set for slow motion
cvar_t host_speeds = {"host_speeds","0"}; // set for running times
cvar_t host_maxfps = {"host_maxfps", "500"};
cvar_t sys_ticrate = {"sys_ticrate","0.05"};
cvar_t serverprofile = {"serverprofile","0"};
@ -66,9 +70,17 @@ cvar_t timelimit = {"timelimit","0",false,true};
cvar_t teamplay = {"teamplay","0",false,true};
cvar_t samelevel = {"samelevel","0"};
cvar_t noexit = {"noexit","0",false,true};
cvar_t developer = {"developer","0"}; // should be 0 for release!
cvar_t show_fps = {"show_fps","0", true}; // set for running times - muff
cvar_t cl_maxfps = {"cl_maxfps", "30", true}; // dr_mabuse1981: maxfps setting
#ifdef __PSP__
cvar_t show_bat = {"show_bat","0"}; // test
#endif // __PSP__
int fps_count;
cvar_t developer = {"developer","0"};
cvar_t skill = {"skill","1"}; // 0 - 3
cvar_t deathmatch = {"deathmatch","0"}; // 0, 1, or 2
@ -78,16 +90,10 @@ cvar_t pausable = {"pausable","1"};
cvar_t temp1 = {"temp1","0"};
/*
================
Max_Fps_f -- ericw
================
*/
static void Max_Fps_f (cvar_t *var)
{
if (var->value > 72)
Con_Warning ("host_maxfps above 72 breaks physics.\n");
}
cvar_t host_timescale = {"host_timescale", "0"}; //johnfitz
qboolean bmg_type_changed = false;
/*
================
@ -98,18 +104,18 @@ void Host_EndGame (char *message, ...)
{
va_list argptr;
char string[1024];
va_start (argptr,message);
vsprintf (string,message,argptr);
va_end (argptr);
Con_DPrintf ("Host_EndGame: %s\n",string);
if (sv.active)
Host_ShutdownServer (false);
if (cls.state == ca_dedicated)
Sys_Error ("Host_EndGame: %s\n",string); // dedicated servers exit
if (cls.demonum != -1)
CL_NextDemo ();
else
@ -132,18 +138,18 @@ void Host_Error (char *error, ...)
va_list argptr;
char string[1024];
static qboolean inerror = false;
if (inerror)
Sys_Error ("Host_Error: recursively entered");
inerror = true;
SCR_EndLoadingPlaque (); // reenable screen updates
va_start (argptr,error);
vsprintf (string,error,argptr);
va_end (argptr);
Con_Printf ("Host_Error: %s\n",string);
if (sv.active)
Host_ShutdownServer (false);
@ -170,7 +176,7 @@ void Host_FindMaxClients (void)
int i;
svs.maxclients = 1;
i = COM_CheckParm ("-dedicated");
if (i)
{
@ -217,31 +223,26 @@ void Host_FindMaxClients (void)
Host_InitLocal
======================
*/
extern bool new3ds_flag;
void Host_InitLocal (void)
{
Host_InitCommands ();
Cvar_RegisterVariable (&host_framerate);
Cvar_RegisterVariable (&host_speeds);
Cvar_RegisterVariable (&host_maxfps);
if (host_maxfps.value == 500) {
if (new3ds_flag) {
Cvar_SetValue("host_maxfps", 60);
} else {
Cvar_SetValue("host_maxfps", 20);
}
}
Cvar_RegisterVariable (&sys_ticrate);
Cvar_RegisterVariable (&serverprofile);
#ifdef __PSP__
Cvar_RegisterVariable (&show_bat); // Crow_bar battery info
#endif // __PSP__
Cvar_RegisterVariable (&show_fps); // muff
Cvar_RegisterVariable (&cl_maxfps); // dr_mabuse1981: maxfps setting
Cvar_RegisterVariable (&fraglimit);
Cvar_RegisterVariable (&timelimit);
Cvar_RegisterVariable (&teamplay);
Cvar_RegisterVariable (&samelevel);
Cvar_RegisterVariable (&noexit);
Cvar_RegisterVariable (&skill);
Cvar_RegisterVariable (&developer);
Cvar_RegisterVariable (&deathmatch);
@ -250,9 +251,10 @@ void Host_InitLocal (void)
Cvar_RegisterVariable (&pausable);
Cvar_RegisterVariable (&temp1);
Cvar_RegisterVariable (&host_timescale);
Host_FindMaxClients ();
host_time = 1.0; // so a think at time 0 won't get called
}
@ -278,7 +280,7 @@ void Host_WriteConfiguration (void)
Con_Printf ("Couldn't write config.cfg.\n");
return;
}
Key_WriteBindings (f);
Key_WriteDTBindings (f);
Cvar_WriteVariables (f);
@ -292,7 +294,7 @@ void Host_WriteConfiguration (void)
=================
SV_ClientPrintf
Sends text across to be displayed
Sends text across to be displayed
FIXME: make this just a stuffed echo?
=================
*/
@ -300,11 +302,11 @@ void SV_ClientPrintf (char *fmt, ...)
{
va_list argptr;
char string[1024];
va_start (argptr,fmt);
vsprintf (string, fmt,argptr);
va_end (argptr);
MSG_WriteByte (&host_client->message, svc_print);
MSG_WriteString (&host_client->message, string);
}
@ -321,11 +323,11 @@ void SV_BroadcastPrintf (char *fmt, ...)
va_list argptr;
char string[1024];
int i;
va_start (argptr,fmt);
vsprintf (string, fmt,argptr);
va_end (argptr);
for (i=0 ; i<svs.maxclients ; i++)
if (svs.clients[i].active && svs.clients[i].spawned)
{
@ -345,11 +347,11 @@ void Host_ClientCommands (char *fmt, ...)
{
va_list argptr;
char string[1024];
va_start (argptr,fmt);
vsprintf (string, fmt,argptr);
va_end (argptr);
MSG_WriteByte (&host_client->message, svc_stufftext);
MSG_WriteString (&host_client->message, string);
}
@ -376,7 +378,7 @@ void SV_DropClient (qboolean crash)
MSG_WriteByte (&host_client->message, svc_disconnect);
NET_SendMessage (host_client->netconnection, &host_client->message);
}
if (host_client->edict && host_client->spawned)
{
// call the prog function for removing a client
@ -469,7 +471,7 @@ void Host_ShutdownServer(qboolean crash)
while (count);
// make sure all the clients know we're disconnecting
buf.data = message;
buf.data = (byte *)message;
buf.maxsize = 4;
buf.cursize = 0;
MSG_WriteByte(&buf, svc_disconnect);
@ -505,8 +507,9 @@ extern float crosshair_offset_step;
void Host_ClearMemory (void)
{
Con_DPrintf ("Clearing memory\n");
D_FlushCaches ();
Mod_ClearAll ();
if (host_hunklevel)
Hunk_FreeToLowMark (host_hunklevel);
@ -527,6 +530,7 @@ void Host_ClearMemory (void)
crosshair_offset_step = 0;
cur_spread = 0;
Hitmark_Time = 0;
}
@ -542,29 +546,24 @@ Returns false if the time is too short to run a frame
*/
qboolean Host_FilterTime (float time)
{
float maxfps; //johnfitz
realtime += time;
//johnfitz -- max fps cvar
maxfps = CLAMP (10.f, host_maxfps.value, 1000.f);
if (!cls.timedemo && realtime - oldrealtime < 1.0/maxfps)
if (cl_maxfps.value < 1) Cvar_SetValue("cl_maxfps", 30);
if (!cls.timedemo && realtime - oldrealtime < 1.0/cl_maxfps.value)
return false; // framerate is too high
//johnfitz
host_frametime = realtime - oldrealtime;
oldrealtime = realtime;
if (host_framerate.value > 0)
//johnfitz -- host_timescale is more intuitive than host_framerate
if (host_timescale.value > 0)
host_frametime *= host_timescale.value;
//johnfitz
else if (host_framerate.value > 0)
host_frametime = host_framerate.value;
else
{ // don't allow really long or short frames
if (host_frametime > 0.1)
host_frametime = 0.1;
if (host_frametime < 0.001)
host_frametime = 0.001;
}
else // don't allow really long or short frames
host_frametime = CLAMP (0.001, host_frametime, 0.1); //johnfitz -- use CLAMP
return true;
}
@ -596,68 +595,20 @@ Host_ServerFrame
==================
*/
#ifdef FPS_20
void _Host_ServerFrame (void)
{
// run the world state
pr_global_struct->frametime = host_frametime;
// read client messages
SV_RunClients ();
// move things around and think
// always pause in single player if in console or menus
if (!sv.paused && (svs.maxclients > 1 || key_dest == key_game) )
SV_Physics ();
}
void Host_ServerFrame (void)
{
float save_host_frametime;
float temp_host_frametime;
// run the world state
// run the world state
pr_global_struct->frametime = host_frametime;
// set the time and clear the general datagram
SV_ClearDatagram ();
// check for new clients
SV_CheckForNewClients ();
temp_host_frametime = save_host_frametime = host_frametime;
while(temp_host_frametime > (1.0/72.0))
{
if (temp_host_frametime > 0.05)
host_frametime = 0.05;
else
host_frametime = temp_host_frametime;
temp_host_frametime -= host_frametime;
_Host_ServerFrame ();
}
host_frametime = save_host_frametime;
// send all messages to the clients
SV_SendClientMessages ();
}
#else
void Host_ServerFrame (void)
{
// run the world state
pr_global_struct->frametime = host_frametime;
// set the time and clear the general datagram
SV_ClearDatagram ();
// check for new clients
SV_CheckForNewClients ();
// read client messages
SV_RunClients ();
// move things around and think
// always pause in single player if in console or menus
if (!sv.paused && (svs.maxclients > 1 || key_dest == key_game) )
@ -667,9 +618,6 @@ void Host_ServerFrame (void)
SV_SendClientMessages ();
}
#endif
/*
==================
Host_Frame
@ -685,15 +633,19 @@ void _Host_Frame (float time)
int pass1, pass2, pass3;
if (setjmp (host_abortserver) )
{
return; // something bad happened, or the server disconnected
}
// keep the random time dependent
rand ();
// decide the simulation time
if (!Host_FilterTime (time))
{
return; // don't run too fast, or packets will flood out
}
// get new key events
Sys_SendKeyEvents ();
@ -708,7 +660,7 @@ void _Host_Frame (float time)
// if running the server locally, make intentions now
if (sv.active)
CL_SendCmd ();
//-------------------
//
// server operations
@ -717,10 +669,8 @@ void _Host_Frame (float time)
// check for commands typed to the host
Host_GetConsoleCommands ();
if (sv.active)
Host_ServerFrame ();
//-------------------
//
// client operations
@ -739,16 +689,12 @@ void _Host_Frame (float time)
{
CL_ReadFromServer ();
}
// update video
if (host_speeds.value)
time1 = Sys_FloatTime ();
SCR_UpdateScreen ();
if (host_speeds.value)
time2 = Sys_FloatTime ();
// update audio
if (cls.signon == SIGNONS)
{
@ -757,8 +703,6 @@ void _Host_Frame (float time)
}
else
S_Update (vec3_origin, vec3_origin, vec3_origin, vec3_origin);
CDAudio_Update();
if (host_speeds.value)
{
@ -769,10 +713,17 @@ void _Host_Frame (float time)
Con_Printf ("%3i tot %3i server %3i gfx %3i snd\n",
pass1+pass2+pass3, pass1, pass2, pass3);
}
// Debug log free memory
// if ((host_framecount % 120) == 0) Con_Printf ("%.2fkB free \n", pspSdkTotalFreeUserMemSize()/1024.f);
//frame speed counter
fps_count++;//muff
host_framecount++;
}
void Host_Frame (float time)
{
double time1, time2;
@ -785,17 +736,17 @@ void Host_Frame (float time)
_Host_Frame (time);
return;
}
time1 = Sys_FloatTime ();
_Host_Frame (time);
time2 = Sys_FloatTime ();
time2 = Sys_FloatTime ();
timetotal += time2 - time1;
timecount++;
if (timecount < 1000)
return;
if (timecount < 1000)
{
return;
}
m = timetotal*1000/timecount;
timecount = 0;
timetotal = 0;
@ -805,7 +756,6 @@ void Host_Frame (float time)
if (svs.clients[i].active)
c++;
}
Con_Printf ("serverprofile: %2i clients %2i msec\n", c, m);
}
@ -820,7 +770,7 @@ void Host_InitVCR (quakeparms_t *parms)
{
int i, len, n;
char *p;
if (COM_CheckParm("-playback"))
{
if (com_argc != 2)
@ -835,12 +785,12 @@ void Host_InitVCR (quakeparms_t *parms)
Sys_Error("Invalid signature in vcr file\n");
Sys_FileRead (vcrFile, &com_argc, sizeof(int));
com_argv = malloc(com_argc * sizeof(char *));
com_argv = Q_malloc(com_argc * sizeof(char *));
com_argv[0] = parms->argv[0];
for (i = 0; i < com_argc; i++)
{
Sys_FileRead (vcrFile, &len, sizeof(int));
p = malloc(len);
p = Q_malloc(len);
Sys_FileRead (vcrFile, p, len);
com_argv[i+1] = p;
}
@ -871,17 +821,45 @@ void Host_InitVCR (quakeparms_t *parms)
Sys_FileWrite(vcrFile, com_argv[i], len);
}
}
}
void Preload (void)
{
Mod_ForName ("models/player.mdl", true);
// Body
Mod_ForName("models/ai/zb%.mdl", true);
Mod_ForName("models/ai/zbc%.mdl", true);
// Full Model
Mod_ForName ("models/ai/zfull.mdl",true);
Mod_ForName ("models/ai/zcfull.mdl",true);
// Head
Mod_ForName ("models/ai/zh^.mdl",true);
Mod_ForName ("models/ai/zhc^.mdl",true);
// Left Arm
Mod_ForName ("models/ai/zal(.mdl",true);
Mod_ForName ("models/ai/zalc(.mdl",true);
// Right Arm
Mod_ForName ("models/ai/zar(.mdl",true);
Mod_ForName ("models/ai/zarc(.mdl",true);
}
/*
====================
Host_Init
====================
*/
#include "cl_slist.h"
void M_Start_Menu_f (void);
void Host_Init (quakeparms_t *parms)
{
minimum_memory = MINIMUM_MEMORY_LEVELPAK;
minimum_memory = MINIMUM_MEMORY;
if (COM_CheckParm ("-minmemory"))
parms->memsize = minimum_memory;
@ -896,70 +874,75 @@ void Host_Init (quakeparms_t *parms)
Memory_Init (parms->membase, parms->memsize);
Cbuf_Init ();
Cmd_Init ();
Cmd_Init ();
V_Init ();
Chase_Init ();
Host_InitVCR (parms);
COM_Init (parms->basedir);
Host_InitLocal ();
Key_Init ();
Con_Init ();
M_Init ();
Con_Init ();
M_Init ();
PR_Init ();
Mod_Init ();
NET_Init ();
SV_Init ();
Con_Printf ("Exe: "__TIME__" "__DATE__"\n");
Con_Printf ("%4.1f megabyte heap\n",parms->memsize/ (1024*1024.0));
#ifdef __PSP__
Con_Printf ("PSP NZP v%4.1f (PBP: "__TIME__" "__DATE__")\n", (float)(VERSION));
Con_Printf ("%4.1f megabyte PSP application heap \n",1.0f*PSP_HEAP_SIZE_MB);
Con_Printf ("PSP Model: %s\n", Sys_GetPSPModel());
Con_Printf ("VRAM Size: %i bytes\n", sceGeEdramGetSize());
#elif __3DS
Con_Printf ("3DS NZP v%4.1f (3DSX: "__TIME__" "__DATE__")\n", (float)(VERSION));
if (new3ds_flag)
Con_Printf ("3DS Model: NEW Nintendo 3DS\n");
else
Con_Printf ("3DS Model: Nintendo 3DS\n");
#endif // __PSP__, _3DS
Con_Printf ("%4.1f megabyte Quake hunk \n",parms->memsize/ (1024*1024.0));
R_InitTextures (); // needed even for dedicated servers
if (cls.state != ca_dedicated)
{
host_basepal = (byte *)COM_LoadHunkFile ("gfx/palette.lmp");
if (!host_basepal)
Sys_Error ("Couldn't load gfx/palette.lmp");
host_colormap = (byte *)COM_LoadHunkFile ("gfx/colormap.lmp");
if (!host_colormap)
Sys_Error ("Couldn't load gfx/colormap.lmp");
#ifndef _WIN32 // on non win32, mouse comes before video for security reasons
IN_Init ();
#endif
VID_Init (host_basepal);
#ifdef __PSP__
host_q2pal = (byte *)COM_LoadHunkFile ("gfx/q2pal.lmp");
if (!host_q2pal)
Sys_Error ("Couldn't load gfx/q2pal.lmp");
host_h2pal = (byte *)COM_LoadHunkFile ("gfx/h2pal.lmp");
if (!host_h2pal)
Sys_Error ("Couldn't load gfx/h2pal.lmp");
#endif // __PSP__
IN_Init ();
VID_Init (host_basepal);
Draw_Init ();
SCR_Init ();
R_Init ();
#ifndef _WIN32
// on Win32, sound initialization has to come before video initialization, so we
// can put up a popup if the sound hardware is in use
S_Init ();
#else
#ifdef GLQUAKE
// FIXME: doesn't use the new one-window approach yet
S_Init ();
#endif
#endif // _WIN32
CDAudio_Init ();
Sbar_Init ();
HUD_Init ();
CL_Init ();
#ifdef _WIN32 // on non win32, mouse comes before video for security reasons
IN_Init ();
#endif
}
Preload();
Cbuf_InsertText ("exec nzp.rc\n");
Hunk_AllocName (0, "-HOST_HUNKLEVEL-");
host_hunklevel = Hunk_LowMark ();
host_initialized = true;
M_Start_Menu_f();
Sys_Printf ("========Nazi Zombies Portable Initialized=========\n");
}
@ -975,10 +958,9 @@ to run quit through here before the final handoff to the sys code.
void Host_Shutdown(void)
{
static qboolean isdown = false;
if (isdown)
{
printf ("recursive shutdown\n");
return;
}
isdown = true;
@ -988,7 +970,14 @@ void Host_Shutdown(void)
Clear_LoadingFill ();
Host_WriteConfiguration ();
SList_Shutdown();
Host_WriteConfiguration ();
#ifdef __PSP__
if (con_initialized)
History_Shutdown ();
#endif // __PSP__
CDAudio_Shutdown ();
NET_Shutdown ();

View file

@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
@ -42,7 +42,7 @@ void Host_Quit_f (void)
return;
}
CL_Disconnect ();
Host_ShutdownServer(false);
Host_ShutdownServer(false);
Sys_Quit ();
}
@ -61,7 +61,7 @@ void Host_Status_f (void)
int hours = 0;
int j;
void (*print) (char *fmt, ...);
if (cmd_source == src_command)
{
if (!sv.active)
@ -97,7 +97,9 @@ void Host_Status_f (void)
}
else
hours = 0;
print ("#%-2u %-16.16s %3i %2i:%02i:%02i\n", j+1, client->name, (int)client->edict->v.points, hours, minutes, seconds);
print (" %s\n", client->netconnection->address);
print(" SignOn State: %i\n",cls.signon);
}
}
@ -214,7 +216,7 @@ void Host_Ping_f (void)
int i, j;
float total;
client_t *client;
if (cmd_source == src_command)
{
Cmd_ForwardToServer ();
@ -247,7 +249,7 @@ SERVER TRANSITIONS
======================
Host_Map_f
handle a
handle a
map <servername>
command from the console. Active clients are kicked off.
======================
@ -263,7 +265,7 @@ void Host_Map_f (void)
cls.demonum = -1; // stop demo loop in case this fails
CL_Disconnect ();
Host_ShutdownServer(false);
Host_ShutdownServer(false);
key_dest = key_game; // remove console or menu
SCR_BeginLoadingPlaque ();
@ -278,14 +280,10 @@ void Host_Map_f (void)
svs.serverflags = 0; // haven't completed an episode yet
strcpy (name, Cmd_Argv(1));
#ifdef QUAKE2
SV_SpawnServer (name, NULL);
#else
SV_SpawnServer (name);
#endif
if (!sv.active)
return;
if (cls.state != ca_dedicated)
{
strcpy (cls.spawnparms, "");
@ -295,9 +293,9 @@ void Host_Map_f (void)
strcat (cls.spawnparms, Cmd_Argv(i));
strcat (cls.spawnparms, " ");
}
Cmd_ExecuteString ("connect local", src_command);
}
}
}
/*
@ -309,34 +307,6 @@ Goes to a new map, taking all clients along
*/
void Host_Changelevel_f (void)
{
#ifdef QUAKE2
char level[MAX_QPATH];
char _startspot[MAX_QPATH];
char *startspot;
if (Cmd_Argc() < 2)
{
Con_Printf ("changelevel <levelname> : continue game on a new level\n");
return;
}
if (!sv.active || cls.demoplayback)
{
Con_Printf ("Only the server may changelevel\n");
return;
}
strcpy (level, Cmd_Argv(1));
if (Cmd_Argc() == 2)
startspot = NULL;
else
{
strcpy (_startspot, Cmd_Argv(2));
startspot = _startspot;
}
SV_SaveSpawnparms ();
SV_SpawnServer (level, startspot);
#else
char level[MAX_QPATH];
if (Cmd_Argc() != 2)
@ -352,7 +322,6 @@ void Host_Changelevel_f (void)
SV_SaveSpawnparms ();
strcpy (level, Cmd_Argv(1));
SV_SpawnServer (level);
#endif
}
/*
@ -365,9 +334,6 @@ Restarts the current server for a dead player
void Host_Restart_f (void)
{
char mapname[MAX_QPATH];
#ifdef QUAKE2
char startspot[MAX_QPATH];
#endif
if (cls.demoplayback || !sv.active)
return;
@ -376,12 +342,7 @@ void Host_Restart_f (void)
return;
strcpy (mapname, sv.name); // must copy out, because it gets cleared
// in sv_spawnserver
#ifdef QUAKE2
strcpy(startspot, sv.startspot);
SV_SpawnServer (mapname, startspot);
#else
SV_SpawnServer (mapname);
#endif
SV_SpawnServer (mapname);
}
/*
@ -408,7 +369,7 @@ User command to connect to server
void Host_Connect_f (void)
{
char name[MAX_QPATH];
cls.demonum = -1; // stop demo loop in case this fails
if (cls.demoplayback)
{
@ -435,13 +396,33 @@ LOAD / SAVE GAME
===============
Host_SavegameComment
Writes a SAVEGAME_COMMENT_LENGTH character comment describing the current
Writes a SAVEGAME_COMMENT_LENGTH character comment describing the current
===============
*/
void Host_SavegameComment (char *text)
{
int i;
char kills[20];
for (i=0 ; i<SAVEGAME_COMMENT_LENGTH ; i++)
text[i] = ' ';
#ifdef PSP_VFPU
memcpy_vfpu(text, cl.levelname, strlen(cl.levelname));
#else
memcpy(text, cl.levelname, strlen(cl.levelname));
#endif // PSP_VFPU
sprintf (kills,"kills:%3i/%3i", cl.stats[STAT_INSTA], cl.stats[STAT_ROUNDCHANGE]);
#ifdef PSP_VFPU
memcpy_vfpu(text+22, kills, strlen(kills));
#else
memcpy(text+22, kills, strlen(kills));
#endif // PSP_VFPU
// convert space to _ to make stdio happy
for (i=0 ; i<SAVEGAME_COMMENT_LENGTH ; i++)
if (text[i] == ' ')
text[i] = '_';
text[SAVEGAME_COMMENT_LENGTH] = '\0';
}
@ -489,7 +470,7 @@ void Host_Savegame_f (void)
Con_Printf ("Relative pathnames are not allowed.\n");
return;
}
for (i=0 ; i<svs.maxclients ; i++)
{
if (svs.clients[i].active && (svs.clients[i].edict->v.health <= 0) )
@ -501,15 +482,15 @@ void Host_Savegame_f (void)
sprintf (name, "%s/%s", com_gamedir, Cmd_Argv(1));
COM_DefaultExtension (name, ".sav");
Con_Printf ("Saving game to %s...\n", name);
f = fopen (name, "w");
if (!f)
{
Con_Printf ("ERROR: couldn't open.\n");
Con_Printf ("ERROR: couldn't open save file for writing.\n");
return;
}
fprintf (f, "%i\n", SAVEGAME_VERSION);
Host_SavegameComment (comment);
fprintf (f, "%s\n", comment);
@ -572,7 +553,7 @@ void Host_Loadgame_f (void)
sprintf (name, "%s/%s", com_gamedir, Cmd_Argv(1));
COM_DefaultExtension (name, ".sav");
// we can't call SCR_BeginLoadingPlaque, because too much stack space has
// been used. The menu calls it before stuffing loadgame command
// SCR_BeginLoadingPlaque ();
@ -581,7 +562,7 @@ void Host_Loadgame_f (void)
f = fopen (name, "r");
if (!f)
{
Con_Printf ("ERROR: couldn't open.\n");
Con_Printf ("ERROR: couldn't open save file for reading.\n");
return;
}
@ -600,22 +581,12 @@ void Host_Loadgame_f (void)
current_skill = (int)(tfloat + 0.1);
Cvar_SetValue ("skill", (float)current_skill);
#ifdef QUAKE2
Cvar_SetValue ("deathmatch", 0);
Cvar_SetValue ("coop", 0);
Cvar_SetValue ("teamplay", 0);
#endif
fscanf (f, "%s\n",mapname);
fscanf (f, "%f\n",&time);
CL_Disconnect_f ();
#ifdef QUAKE2
SV_SpawnServer (mapname, NULL);
#else
SV_SpawnServer (mapname);
#endif
if (!sv.active)
{
Con_Printf ("Couldn't load map\n");
@ -658,7 +629,7 @@ void Host_Loadgame_f (void)
break; // end of file
if (strcmp(com_token,"{"))
Sys_Error ("First token isn't a brace");
if (entnum == -1)
{ // parse the global vars
ED_ParseGlobals (start);
@ -670,7 +641,7 @@ void Host_Loadgame_f (void)
memset (&ent->v, 0, progs->entityfields * 4);
ent->free = false;
ED_ParseEdict (start, ent);
// link it into the bsp tree
if (!ent->free)
SV_LinkEdict (ent, false);
@ -678,7 +649,7 @@ void Host_Loadgame_f (void)
entnum++;
}
sv.num_edicts = entnum;
sv.time = time;
@ -694,198 +665,6 @@ void Host_Loadgame_f (void)
}
}
#ifdef QUAKE2
void SaveGamestate()
{
char name[256];
FILE *f;
int i;
char comment[SAVEGAME_COMMENT_LENGTH+1];
edict_t *ent;
sprintf (name, "%s/%s.gip", com_gamedir, sv.name);
Con_Printf ("Saving game to %s...\n", name);
f = fopen (name, "w");
if (!f)
{
Con_Printf ("ERROR: couldn't open.\n");
return;
}
fprintf (f, "%i\n", SAVEGAME_VERSION);
Host_SavegameComment (comment);
fprintf (f, "%s\n", comment);
// for (i=0 ; i<NUM_SPAWN_PARMS ; i++)
// fprintf (f, "%f\n", svs.clients->spawn_parms[i]);
fprintf (f, "%f\n", skill.value);
fprintf (f, "%s\n", sv.name);
fprintf (f, "%f\n", sv.time);
// write the light styles
for (i=0 ; i<MAX_LIGHTSTYLES ; i++)
{
if (sv.lightstyles[i])
fprintf (f, "%s\n", sv.lightstyles[i]);
else
fprintf (f,"m\n");
}
for (i=svs.maxclients+1 ; i<sv.num_edicts ; i++)
{
ent = EDICT_NUM(i);
if ((int)ent->v.flags & FL_ARCHIVE_OVERRIDE)
continue;
fprintf (f, "%i\n",i);
ED_Write (f, ent);
fflush (f);
}
fclose (f);
Con_Printf ("done.\n");
}
int LoadGamestate(char *level, char *startspot)
{
char name[MAX_OSPATH];
FILE *f;
char mapname[MAX_QPATH];
float time, sk;
char str[32768], *start;
int i, r;
edict_t *ent;
int entnum;
int version;
// float spawn_parms[NUM_SPAWN_PARMS];
sprintf (name, "%s/%s.gip", com_gamedir, level);
Con_Printf ("Loading game from %s...\n", name);
f = fopen (name, "r");
if (!f)
{
Con_Printf ("ERROR: couldn't open.\n");
return -1;
}
fscanf (f, "%i\n", &version);
if (version != SAVEGAME_VERSION)
{
fclose (f);
Con_Printf ("Savegame is version %i, not %i\n", version, SAVEGAME_VERSION);
return -1;
}
fscanf (f, "%s\n", str);
// for (i=0 ; i<NUM_SPAWN_PARMS ; i++)
// fscanf (f, "%f\n", &spawn_parms[i]);
fscanf (f, "%f\n", &sk);
Cvar_SetValue ("skill", sk);
fscanf (f, "%s\n",mapname);
fscanf (f, "%f\n",&time);
SV_SpawnServer (mapname, startspot);
if (!sv.active)
{
Con_Printf ("Couldn't load map\n");
return -1;
}
// load the light styles
for (i=0 ; i<MAX_LIGHTSTYLES ; i++)
{
fscanf (f, "%s\n", str);
sv.lightstyles[i] = Hunk_Alloc (strlen(str)+1);
strcpy (sv.lightstyles[i], str);
}
// load the edicts out of the savegame file
while (!feof(f))
{
fscanf (f, "%i\n",&entnum);
for (i=0 ; i<sizeof(str)-1 ; i++)
{
r = fgetc (f);
if (r == EOF || !r)
break;
str[i] = r;
if (r == '}')
{
i++;
break;
}
}
if (i == sizeof(str)-1)
Sys_Error ("Loadgame buffer overflow");
str[i] = 0;
start = str;
start = COM_Parse(str);
if (!com_token[0])
break; // end of file
if (strcmp(com_token,"{"))
Sys_Error ("First token isn't a brace");
// parse an edict
ent = EDICT_NUM(entnum);
memset (&ent->v, 0, progs->entityfields * 4);
ent->free = false;
ED_ParseEdict (start, ent);
// link it into the bsp tree
if (!ent->free)
SV_LinkEdict (ent, false);
}
// sv.num_edicts = entnum;
sv.time = time;
fclose (f);
// for (i=0 ; i<NUM_SPAWN_PARMS ; i++)
// svs.clients->spawn_parms[i] = spawn_parms[i];
return 0;
}
// changing levels within a unit
void Host_Changelevel2_f (void)
{
char level[MAX_QPATH];
char _startspot[MAX_QPATH];
char *startspot;
if (Cmd_Argc() < 2)
{
Con_Printf ("changelevel2 <levelname> : continue game on a new level in the unit\n");
return;
}
if (!sv.active || cls.demoplayback)
{
Con_Printf ("Only the server may changelevel\n");
return;
}
strcpy (level, Cmd_Argv(1));
if (Cmd_Argc() == 2)
startspot = NULL;
else
{
strcpy (_startspot, Cmd_Argv(2));
startspot = _startspot;
}
SV_SaveSpawnparms ();
// save the current level's state
SaveGamestate ();
// try to restore the new level
if (LoadGamestate (level, startspot))
SV_SpawnServer (level, startspot);
}
#endif
//============================================================================
@ -905,7 +684,7 @@ void Host_Name_f (void)
return;
}
if (Cmd_Argc () == 2)
newName = Cmd_Argv(1);
newName = Cmd_Argv(1);
else
newName = Cmd_Args();
newName[15] = 0;
@ -925,72 +704,21 @@ void Host_Name_f (void)
Con_Printf ("%s renamed to %s\n", host_client->name, newName);
Q_strcpy (host_client->name, newName);
host_client->edict->v.netname = host_client->name - pr_strings;
// send notification to all clients
MSG_WriteByte (&sv.reliable_datagram, svc_updatename);
MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients);
MSG_WriteString (&sv.reliable_datagram, host_client->name);
}
void Host_Version_f (void)
{
Con_Printf ("Version %4.2f\n", VERSION);
Con_Printf ("Exe: "__TIME__" "__DATE__"\n");
}
#ifdef IDGODS
void Host_Please_f (void)
{
client_t *cl;
int j;
if (cmd_source != src_command)
return;
if ((Cmd_Argc () == 3) && strcmp(Cmd_Argv(1), "#") == 0)
{
j = Q_atof(Cmd_Argv(2)) - 1;
if (j < 0 || j >= svs.maxclients)
return;
if (!svs.clients[j].active)
return;
cl = &svs.clients[j];
if (cl->privileged)
{
cl->privileged = false;
cl->edict->v.flags = (int)cl->edict->v.flags & ~(FL_GODMODE|FL_NOTARGET);
cl->edict->v.movetype = MOVETYPE_WALK;
noclip_anglehack = false;
}
else
cl->privileged = true;
}
if (Cmd_Argc () != 2)
return;
for (j=0, cl = svs.clients ; j<svs.maxclients ; j++, cl++)
{
if (!cl->active)
continue;
if (Q_strcasecmp(cl->name, Cmd_Argv(1)) == 0)
{
if (cl->privileged)
{
cl->privileged = false;
cl->edict->v.flags = (int)cl->edict->v.flags & ~(FL_GODMODE|FL_NOTARGET);
cl->edict->v.movetype = MOVETYPE_WALK;
noclip_anglehack = false;
}
else
cl->privileged = true;
break;
}
}
}
#endif
void Host_Say(qboolean teamonly)
@ -999,7 +727,7 @@ void Host_Say(qboolean teamonly)
client_t *save;
int j;
char *p;
unsigned char text[64];
char text[64];
qboolean fromServer = false;
if (cmd_source == src_command)
@ -1138,7 +866,7 @@ void Host_Kill_f (void)
SV_ClientPrintf ("Can't suicide -- allready dead!\n");
return;
}
pr_global_struct->time = sv.time;
pr_global_struct->self = EDICT_TO_PROG(sv_player);
PR_ExecuteProgram (pr_global_struct->ClientKill);
@ -1152,7 +880,7 @@ Host_Pause_f
*/
void Host_Pause_f (void)
{
if (cmd_source == src_command)
{
Cmd_ForwardToServer ();
@ -1200,7 +928,7 @@ void Host_PreSpawn_f (void)
Con_Printf ("prespawn not valid -- allready spawned\n");
return;
}
SZ_Write (&host_client->message, sv.signon.data, sv.signon.cursize);
MSG_WriteByte (&host_client->message, svc_signonnum);
MSG_WriteByte (&host_client->message, 2);
@ -1218,6 +946,7 @@ void Host_Spawn_f (void)
client_t *client;
edict_t *ent;
if (cmd_source == src_command)
{
Con_Printf ("spawn is not valid from the console\n");
@ -1232,6 +961,7 @@ void Host_Spawn_f (void)
host_client->nomap = false;
// run the entrance script
if (sv.loadgame)
{ // loaded games are fully inited allready
@ -1243,9 +973,12 @@ void Host_Spawn_f (void)
// set up the edict
ent = host_client->edict;
memset (&ent->v, 0, progs->entityfields * 4);
ent->v.colormap = NUM_FOR_EDICT(ent);
ent->v.team = (host_client->colors & 15) + 1;
ent->v.netname = host_client->name - pr_strings;
// copy spawn parms out of the client_t
@ -1262,10 +995,9 @@ void Host_Spawn_f (void)
if ((Sys_FloatTime() - host_client->netconnection->connecttime) <= sv.time)
Sys_Printf ("%s entered the game\n", host_client->name);
PR_ExecuteProgram (pr_global_struct->PutClientInServer);
PR_ExecuteProgram (pr_global_struct->PutClientInServer);
}
// send all current names, colors, and frag counts
SZ_Clear (&host_client->message);
@ -1285,7 +1017,7 @@ void Host_Spawn_f (void)
MSG_WriteByte (&host_client->message, i);
MSG_WriteShort (&host_client->message, client->old_kills);
}
// send all current light styles
for (i=0 ; i<MAX_LIGHTSTYLES ; i++)
{
@ -1305,7 +1037,14 @@ void Host_Spawn_f (void)
MSG_WriteByte (&host_client->message, STAT_ROUNDCHANGE);
MSG_WriteByte (&host_client->message, pr_global_struct->rounds_change);
MSG_WriteByte (&host_client->message, svc_updatestat);
MSG_WriteByte (&host_client->message, STAT_X2);
MSG_WriteByte (&host_client->message, sv_player->v.x2_icon);
MSG_WriteByte (&host_client->message, svc_updatestat);
MSG_WriteByte (&host_client->message, STAT_INSTA);
MSG_WriteByte (&host_client->message, sv_player->v.insta_icon);
//
// send a fixangle
// Never send a roll angle, because savegames can catch the server
@ -1446,8 +1185,7 @@ Host_Give_f
void Host_Give_f (void)
{
char *t;
int v, w;
eval_t *val;
int v;
if (cmd_source == src_command)
{
@ -1460,11 +1198,12 @@ void Host_Give_f (void)
t = Cmd_Argv(1);
v = atoi (Cmd_Argv(2));
switch (t[0])
{
default:
break;
case 'h':
sv_player->v.health = v;
break;
}
}
@ -1472,7 +1211,7 @@ edict_t *FindViewthing (void)
{
int i;
edict_t *e;
for (i=0 ; i<sv.num_edicts ; i++)
{
e = EDICT_NUM(i);
@ -1503,7 +1242,7 @@ void Host_Viewmodel_f (void)
Con_Printf ("Can't load %s\n", Cmd_Argv(1));
return;
}
e->v.frame = 0;
cl.model_precache[(int)e->v.modelindex] = m;
}
@ -1528,7 +1267,7 @@ void Host_Viewframe_f (void)
if (f >= m->numframes)
f = m->numframes-1;
e->v.frame = f;
e->v.frame = f;
}
@ -1541,7 +1280,7 @@ void PrintFrameName (model_t *m, int frame)
if (!hdr)
return;
pframedesc = &hdr->frames[frame];
Con_Printf ("frame %i: %s\n", frame, pframedesc->name);
}
@ -1554,7 +1293,7 @@ void Host_Viewnext_f (void)
{
edict_t *e;
model_t *m;
e = FindViewthing ();
if (!e)
return;
@ -1564,7 +1303,7 @@ void Host_Viewnext_f (void)
if (e->v.frame >= m->numframes)
e->v.frame = m->numframes - 1;
PrintFrameName (m, e->v.frame);
PrintFrameName (m, e->v.frame);
}
/*
@ -1587,7 +1326,7 @@ void Host_Viewprev_f (void)
if (e->v.frame < 0)
e->v.frame = 0;
PrintFrameName (m, e->v.frame);
PrintFrameName (m, e->v.frame);
}
/*
@ -1687,17 +1426,13 @@ void Host_InitCommands (void)
Cmd_AddCommand ("map", Host_Map_f);
Cmd_AddCommand ("restart", Host_Restart_f);
Cmd_AddCommand ("changelevel", Host_Changelevel_f);
#ifdef QUAKE2
Cmd_AddCommand ("changelevel2", Host_Changelevel2_f);
#endif
Cmd_AddCommand ("connect", Host_Connect_f);
Cmd_AddCommand ("reconnect", Host_Reconnect_f);
Cmd_AddCommand ("name", Host_Name_f);
Cmd_AddCommand ("noclip", Host_Noclip_f);
Cmd_AddCommand ("version", Host_Version_f);
#ifdef IDGODS
Cmd_AddCommand ("please", Host_Please_f);
#endif
Cmd_AddCommand ("say", Host_Say_f);
Cmd_AddCommand ("say_team", Host_Say_Team_f);
Cmd_AddCommand ("tell", Host_Tell_f);
@ -1722,4 +1457,6 @@ void Host_InitCommands (void)
Cmd_AddCommand ("viewprev", Host_Viewprev_f);
Cmd_AddCommand ("mcache", Mod_Print);
}

View file

@ -60,6 +60,7 @@ void (*vid_menukeyfn)(int key);
enum
{
m_none,
m_start,
m_main,
m_paused_menu,
m_singleplayer,
@ -83,6 +84,8 @@ enum
m_search,
m_slist,
} m_state;
void M_Start_Menu_f (void);
void M_Menu_Main_f (void);
void M_Menu_SinglePlayer_f (void);
void M_Menu_CustomMaps_f (void);
@ -236,6 +239,41 @@ void M_Load_Menu_Pics ()
menu_custom = Draw_CachePic("gfx/menu/custom");
}
void M_Start_Menu_f ()
{
//Load_Achivements();
M_Load_Menu_Pics();
key_dest = key_menu;
m_state = m_start;
m_entersound = true;
//loadingScreen = 0;
}
static void M_Start_Menu_Draw ()
{
// Background
menu_bk = Draw_CachePic("gfx/menu/menu_background");
Draw_StretchPic(0, 0, menu_bk, 400, 240);
// Fill black to make everything easier to see
Draw_FillByColor(0, 0, vid.width, vid.height, 0, 0, 0, 102);
Draw_ColoredStringCentered(vid.height - 64, "Press A to Start", 255, 0, 0, 255, 1);
}
void M_Start_Key (int key)
{
switch (key)
{
case K_AUX1:
S_LocalSound ("sounds/menu/enter.wav");
//Cbuf_AddText("cd playstring tensioned_by_the_damned 1\n");
Cbuf_AddText("togglemenu\n");
break;
}
}
int m_save_demonum;
/*
@ -2209,7 +2247,6 @@ void M_Init (void)
game_build_date = "version.txt not found.";
}
//M_Load_Menu_Pics();
Map_Finder();
}
@ -2245,6 +2282,10 @@ void M_Draw (void)
case m_none:
break;
case m_start:
M_Start_Menu_Draw();
break;
case m_paused_menu:
M_Paused_Menu_Draw();
break;
@ -2316,6 +2357,10 @@ void M_Keydown (int key)
case m_none:
return;
case m_start:
M_Start_Key (key);
break;
case m_paused_menu:
M_Paused_Menu_Key (key);
break;

View file

@ -2678,6 +2678,7 @@ void PF_precache_sound (void)
PR_CheckEmptyString (s);
// AWFUL AWFUL HACK for limiting zombie sound variations
#ifndef _3DS
#ifndef SLIM
if (s[strlen(s) - 6] == 'r' || s[strlen(s) - 6] == 'd' || s[strlen(s) - 6] == 'a' ||
@ -2699,6 +2700,7 @@ void PF_precache_sound (void)
#endif // SLIM
#endif // _3DS
for (i=0 ; i<MAX_SOUNDS ; i++)

View file

@ -58,7 +58,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
#define SPRITE_VERSION 1
#define SPRITE_VERSION 1
#define SPRITEHL_VERSION 2
#define SPRITE32_VERSION 32
// must match definition in modelgen.h
#ifndef SYNCTYPE_T
@ -79,11 +81,32 @@ typedef struct {
synctype_t synctype;
} dsprite_t;
typedef struct
{
int ident;
int version;
int type;
int texFormat;
float boundingradius;
int width;
int height;
int numframes;
float beamlength;
synctype_t synctype;
} dspritehl_t;
#define SPR_VP_PARALLEL_UPRIGHT 0
#define SPR_FACING_UPRIGHT 1
#define SPR_VP_PARALLEL 2
#define SPR_ORIENTED 3
#define SPR_FACING_UPRIGHT 1
#define SPR_VP_PARALLEL 2
#define SPR_ORIENTED 3
#define SPR_VP_PARALLEL_ORIENTED 4
#define SPR_LABEL 5
#define SPR_LABEL_SCALE 6
#define SPR_NORMAL 0
#define SPR_ADDITIVE 1
#define SPR_INDEXALPHA 2
#define SPR_ALPHATEST 3
typedef struct {
int origin[2];
@ -102,9 +125,32 @@ typedef struct {
typedef enum { SPR_SINGLE=0, SPR_GROUP } spriteframetype_t;
typedef struct {
int type;
#ifdef __PSP__
spriteframetype_t type;
#else
int type;
#endif // __PSP__
} dspriteframetype_t;
#define IDSPRITEHEADER (('P'<<24)+('S'<<16)+('D'<<8)+'I')
// little-endian "IDSP"
#define MAX_SKINNAME 64
#define IDSPRITE2HEADER (('2'<<24)+('S'<<16)+('D'<<8)+'I')
// little-endian "IDS2"
#define SPRITE2_VERSION 2
typedef struct
{
int width, height;
int origin_x, origin_y; // raster coordinates inside pic
char name[MAX_SKINNAME]; // name of pcx file
} dmd2sprframe_t;
typedef struct {
int ident;
int version;
int numframes;
dmd2sprframe_t frames[1]; // variable sized
} dmd2sprite_t;

View file

@ -162,6 +162,7 @@ void SwapPic (qpic_t *pic)
WAD3 Texture Loading for BSP 3.0 Support From Baker --Diabolickal HLBSP
=============================================================================
*/
#ifdef _3DS
#define TEXWAD_MAXIMAGES 16384
@ -315,3 +316,4 @@ byte *WAD3_LoadTexture(miptex_t *mt) {
}
return NULL;
}
#endif // _3DS

View file

@ -74,7 +74,13 @@ void *W_GetLumpNum (int num);
void SwapPic (qpic_t *pic);
//Diabolickal HLBSP
void WAD3_LoadTextureWadFile (char *filename);
byte *WAD3_LoadTexture(miptex_t *mt);
//Diabolickal end
#ifdef __PSP__
int WAD3_LoadTexture(miptex_t *mt);
int WAD3_LoadTextureName(char *name);
int ConvertWad3ToRGBA(miptex_t *tex);
void W_LoadTextureWadFileHL (char *filename, int complain);
byte *W_ConvertWAD3TextureHL(miptex_t *tex);
byte *W_GetTextureHL(char *name);
#endif // __PSP__