From: Rene S. <sa...@us...> - 2004-08-22 14:25:56
|
Update of /cvsroot/jake2/jake2/src/jake2/game In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8042/src/jake2/game Modified Files: game_import_t.java game_export_t.java GameBase.java GameFuncAdapters.java GameSave.java edict_t.java Log Message: cleanups and base3 bugfix for the load and save routines. Index: game_export_t.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/game_export_t.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** game_export_t.java 20 Aug 2004 21:29:58 -0000 1.4 --- game_export_t.java 22 Aug 2004 14:25:11 -0000 1.5 *************** *** 35,40 **** // ! public class game_export_t ! { public int apiversion; --- 35,39 ---- // ! public class game_export_t { public int apiversion; *************** *** 43,58 **** // not each time a level is loaded. Persistant data for clients // and the server can be allocated in init ! public void Init() ! { Game.InitGame(); } ! public void Shutdown() ! { Game.ShutdownGame(); } // each new level entered will cause a call to SpawnEntities ! public void SpawnEntities(String mapname, String entstring, String spawnpoint) ! { Game.SpawnEntities(mapname, entstring, spawnpoint); } --- 42,54 ---- // not each time a level is loaded. Persistant data for clients // and the server can be allocated in init ! public void Init() { Game.InitGame(); } ! public void Shutdown() { Game.ShutdownGame(); } // each new level entered will cause a call to SpawnEntities ! public void SpawnEntities(String mapname, String entstring, String spawnpoint) { Game.SpawnEntities(mapname, entstring, spawnpoint); } *************** *** 62,72 **** // WriteGame is called every time a level is exited. // ReadGame is called on a loadgame. ! public void WriteGame(String filename, boolean autosave) ! { GameSave.WriteGame(filename, autosave); } ! public void ReadGame(String filename) ! { Game.ReadGame(filename); } --- 58,66 ---- // WriteGame is called every time a level is exited. // ReadGame is called on a loadgame. ! public void WriteGame(String filename, boolean autosave) { GameSave.WriteGame(filename, autosave); } ! public void ReadGame(String filename) { Game.ReadGame(filename); } *************** *** 74,132 **** // ReadLevel is called after the default map information has been // loaded with SpawnEntities ! public void WriteLevel(String filename) ! { ! try ! { ! GameSave.WriteLevel(filename); ! } ! catch (IOException e) ! { ! e.printStackTrace(); ! } } ! public void ReadLevel(String filename) ! { ! try ! { ! GameSave.ReadLevel(filename); ! } ! catch (IOException e) ! { ! e.printStackTrace(); ! } } ! public boolean ClientConnect(edict_t ent, String userinfo) ! { return PlayerClient.ClientConnect(ent, userinfo); } ! ! public void ClientBegin(edict_t ent) ! { PlayerClient.ClientBegin(ent); } ! ! public void ClientUserinfoChanged(edict_t ent, String userinfo) ! { PlayerClient.ClientUserinfoChanged(ent, userinfo); } ! ! public void ClientDisconnect(edict_t ent) ! { PlayerClient.ClientDisconnect(ent); } ! public void ClientCommand(edict_t ent) ! { PlayerClient.ClientCommand(ent); } ! public void ClientThink(edict_t ent, usercmd_t cmd) ! { PlayerClient.ClientThink(ent, cmd); } ! public void RunFrame() ! { Game.G_RunFrame(); } --- 68,103 ---- // ReadLevel is called after the default map information has been // loaded with SpawnEntities ! public void WriteLevel(String filename) { ! GameSave.WriteLevel(filename); } ! public void ReadLevel(String filename) { ! GameSave.ReadLevel(filename); } ! public boolean ClientConnect(edict_t ent, String userinfo) { return PlayerClient.ClientConnect(ent, userinfo); } ! ! public void ClientBegin(edict_t ent) { PlayerClient.ClientBegin(ent); } ! ! public void ClientUserinfoChanged(edict_t ent, String userinfo) { PlayerClient.ClientUserinfoChanged(ent, userinfo); } ! ! public void ClientDisconnect(edict_t ent) { PlayerClient.ClientDisconnect(ent); } ! public void ClientCommand(edict_t ent) { PlayerClient.ClientCommand(ent); } ! public void ClientThink(edict_t ent, usercmd_t cmd) { PlayerClient.ClientThink(ent, cmd); } ! public void RunFrame() { Game.G_RunFrame(); } *************** *** 136,141 **** // the game can issue gi.argc() / gi.argv() commands to get the rest // of the parameters ! public void ServerCommand() ! { Game.ServerCommand(); } --- 107,111 ---- // the game can issue gi.argc() / gi.argv() commands to get the rest // of the parameters ! public void ServerCommand() { Game.ServerCommand(); } *************** *** 149,154 **** // the size will be fixed when ge.Init() is called ! public edict_t edicts[] = Game.g_edicts; public int num_edicts; // current number, <= max_edicts public int max_edicts; ! } \ No newline at end of file --- 119,124 ---- // the size will be fixed when ge.Init() is called ! public edict_t edicts[]= Game.g_edicts; public int num_edicts; // current number, <= max_edicts public int max_edicts; ! } Index: GameFuncAdapters.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/GameFuncAdapters.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GameFuncAdapters.java 8 Jul 2004 15:58:44 -0000 1.1 --- GameFuncAdapters.java 22 Aug 2004 14:25:11 -0000 1.2 *************** *** 31,36 **** import jake2.util.*; ! public class GameFuncAdapters ! { /* --- 31,35 ---- import jake2.util.*; ! public class GameFuncAdapters { [...2696 lines suppressed...] GameBase.gi.setmodel(ent, ent.model); ! ent.use = use_killbox; ! ent.svflags = Defines.SVF_NOCLIENT; return true; } --- 1623,1636 ---- Kills everything inside when fired, irrespective of protection. */ ! static EntUseAdapter use_killbox= new EntUseAdapter() { ! public void use(edict_t self, edict_t other, edict_t activator) { GameUtil.KillBox(self); } }; ! static EntThinkAdapter SP_func_killbox= new EntThinkAdapter() { ! public boolean think(edict_t ent) { GameBase.gi.setmodel(ent, ent.model); ! ent.use= use_killbox; ! ent.svflags= Defines.SVF_NOCLIENT; return true; } Index: GameSave.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/GameSave.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GameSave.java 20 Aug 2004 21:29:57 -0000 1.2 --- GameSave.java 22 Aug 2004 14:25:12 -0000 1.3 *************** *** 38,42 **** public class GameSave extends GameFunc { ! public static field_t levelfields[] = { new field_t("changemap", F_LSTRING), --- 38,42 ---- public class GameSave extends GameFunc { ! public static field_t levelfields[]= { new field_t("changemap", F_LSTRING), *************** *** 47,51 **** new field_t(null, F_INT)}; ! public static field_t clientfields[] = { new field_t("pers.weapon", F_ITEM), --- 47,51 ---- new field_t(null, F_INT)}; ! public static field_t clientfields[]= { new field_t("pers.weapon", F_ITEM), *************** *** 55,68 **** public static void CreateEdicts() { ! g_edicts = new edict_t[game.maxentities]; ! for (int i = 0; i < game.maxentities; i++) ! g_edicts[i] = new edict_t(i); ! SV_GAME.ge.edicts = g_edicts; } public static void CreateClients() { ! game.clients = new gclient_t[game.maxclients]; ! for (int i = 0; i < game.maxclients; i++) ! game.clients[i] = new gclient_t(i); } --- 55,68 ---- public static void CreateEdicts() { ! g_edicts= new edict_t[game.maxentities]; ! for (int i= 0; i < game.maxentities; i++) ! g_edicts[i]= new edict_t(i); ! SV_GAME.ge.edicts= g_edicts; } public static void CreateClients() { ! game.clients= new gclient_t[game.maxclients]; ! for (int i= 0; i < game.maxclients; i++) ! game.clients[i]= new gclient_t(i); } *************** *** 80,152 **** gi.dprintf("==== InitGame ====\n"); ! gun_x = gi.cvar("gun_x", "0", 0); ! gun_y = gi.cvar("gun_y", "0", 0); ! gun_z = gi.cvar("gun_z", "0", 0); //FIXME: sv_ prefix is wrong for these ! sv_rollspeed = gi.cvar("sv_rollspeed", "200", 0); ! sv_rollangle = gi.cvar("sv_rollangle", "2", 0); ! sv_maxvelocity = gi.cvar("sv_maxvelocity", "2000", 0); ! sv_gravity = gi.cvar("sv_gravity", "800", 0); // noset vars ! dedicated = gi.cvar("dedicated", "0", CVAR_NOSET); // latched vars ! sv_cheats = gi.cvar("cheats", "0", CVAR_SERVERINFO | CVAR_LATCH); gi.cvar("gamename", GAMEVERSION, CVAR_SERVERINFO | CVAR_LATCH); gi.cvar("gamedate", __DATE__, CVAR_SERVERINFO | CVAR_LATCH); ! maxclients = gi.cvar("maxclients", "4", CVAR_SERVERINFO | CVAR_LATCH); ! maxspectators = gi.cvar("maxspectators", "4", CVAR_SERVERINFO); ! deathmatch = gi.cvar("deathmatch", "0", CVAR_LATCH); ! coop = gi.cvar("coop", "0", CVAR_LATCH); ! skill = gi.cvar("skill", "0", CVAR_LATCH); ! maxentities = gi.cvar("maxentities", "1024", CVAR_LATCH); // change anytime vars ! dmflags = gi.cvar("dmflags", "0", CVAR_SERVERINFO); ! fraglimit = gi.cvar("fraglimit", "0", CVAR_SERVERINFO); ! timelimit = gi.cvar("timelimit", "0", CVAR_SERVERINFO); ! password = gi.cvar("password", "", CVAR_USERINFO); ! spectator_password = gi.cvar("spectator_password", "", CVAR_USERINFO); ! needpass = gi.cvar("needpass", "0", CVAR_SERVERINFO); ! filterban = gi.cvar("filterban", "1", 0); ! g_select_empty = gi.cvar("g_select_empty", "0", CVAR_ARCHIVE); ! run_pitch = gi.cvar("run_pitch", "0.002", 0); ! run_roll = gi.cvar("run_roll", "0.005", 0); ! bob_up = gi.cvar("bob_up", "0.005", 0); ! bob_pitch = gi.cvar("bob_pitch", "0.002", 0); ! bob_roll = gi.cvar("bob_roll", "0.002", 0); // flood control ! flood_msgs = gi.cvar("flood_msgs", "4", 0); ! flood_persecond = gi.cvar("flood_persecond", "4", 0); ! flood_waitdelay = gi.cvar("flood_waitdelay", "10", 0); // dm map list ! sv_maplist = gi.cvar("sv_maplist", "", 0); // items InitItems(); ! game.helpmessage1 = ""; ! game.helpmessage2 = ""; // initialize all entities for this game ! game.maxentities = (int) maxentities.value; CreateEdicts(); ! globals.edicts = g_edicts; ! globals.max_edicts = game.maxentities; // initialize all clients for this game ! game.maxclients = (int) maxclients.value; CreateClients(); ! ! globals.num_edicts = game.maxclients + 1; } --- 80,152 ---- gi.dprintf("==== InitGame ====\n"); ! gun_x= gi.cvar("gun_x", "0", 0); ! gun_y= gi.cvar("gun_y", "0", 0); ! gun_z= gi.cvar("gun_z", "0", 0); //FIXME: sv_ prefix is wrong for these ! sv_rollspeed= gi.cvar("sv_rollspeed", "200", 0); ! sv_rollangle= gi.cvar("sv_rollangle", "2", 0); ! sv_maxvelocity= gi.cvar("sv_maxvelocity", "2000", 0); ! sv_gravity= gi.cvar("sv_gravity", "800", 0); // noset vars ! dedicated= gi.cvar("dedicated", "0", CVAR_NOSET); // latched vars ! sv_cheats= gi.cvar("cheats", "0", CVAR_SERVERINFO | CVAR_LATCH); gi.cvar("gamename", GAMEVERSION, CVAR_SERVERINFO | CVAR_LATCH); gi.cvar("gamedate", __DATE__, CVAR_SERVERINFO | CVAR_LATCH); ! maxclients= gi.cvar("maxclients", "4", CVAR_SERVERINFO | CVAR_LATCH); ! maxspectators= gi.cvar("maxspectators", "4", CVAR_SERVERINFO); ! deathmatch= gi.cvar("deathmatch", "0", CVAR_LATCH); ! coop= gi.cvar("coop", "0", CVAR_LATCH); ! skill= gi.cvar("skill", "0", CVAR_LATCH); ! maxentities= gi.cvar("maxentities", "1024", CVAR_LATCH); // change anytime vars ! dmflags= gi.cvar("dmflags", "0", CVAR_SERVERINFO); ! fraglimit= gi.cvar("fraglimit", "0", CVAR_SERVERINFO); ! timelimit= gi.cvar("timelimit", "0", CVAR_SERVERINFO); ! password= gi.cvar("password", "", CVAR_USERINFO); ! spectator_password= gi.cvar("spectator_password", "", CVAR_USERINFO); ! needpass= gi.cvar("needpass", "0", CVAR_SERVERINFO); ! filterban= gi.cvar("filterban", "1", 0); ! g_select_empty= gi.cvar("g_select_empty", "0", CVAR_ARCHIVE); ! run_pitch= gi.cvar("run_pitch", "0.002", 0); ! run_roll= gi.cvar("run_roll", "0.005", 0); ! bob_up= gi.cvar("bob_up", "0.005", 0); ! bob_pitch= gi.cvar("bob_pitch", "0.002", 0); ! bob_roll= gi.cvar("bob_roll", "0.002", 0); // flood control ! flood_msgs= gi.cvar("flood_msgs", "4", 0); ! flood_persecond= gi.cvar("flood_persecond", "4", 0); ! flood_waitdelay= gi.cvar("flood_waitdelay", "10", 0); // dm map list ! sv_maplist= gi.cvar("sv_maplist", "", 0); // items InitItems(); ! game.helpmessage1= ""; ! game.helpmessage2= ""; // initialize all entities for this game ! game.maxentities= (int) maxentities.value; CreateEdicts(); ! globals.edicts= g_edicts; ! globals.max_edicts= game.maxentities; // initialize all clients for this game ! game.maxclients= (int) maxclients.value; CreateClients(); ! ! globals.num_edicts= game.maxclients + 1; } *************** *** 165,205 **** ============ */ ! public static void WriteGame (String filename, boolean autosave) ! { ! try ! { ! QuakeFile f; ! if (!autosave) SaveClientData(); ! ! f = new QuakeFile(filename, "rw"); ! if (f == null) ! gi.error ("Couldn't write to " + filename); ! ! game.autosaved = autosave; game.write(f); ! game.autosaved = false; ! ! for (int i=0 ; i<game.maxclients ; i++) ! game.clients[i]. write(f); ! ! fclose (f); } ! catch (Exception e) ! { e.printStackTrace(); } } - public static void ReadGame(String filename) { ! QuakeFile f = null; try { ! f = new QuakeFile(filename, "r"); Com.Printf("loading game:" + filename); CreateEdicts(); --- 165,201 ---- ============ */ ! public static void WriteGame(String filename, boolean autosave) { ! try { ! QuakeFile f; ! if (!autosave) SaveClientData(); ! ! f= new QuakeFile(filename, "rw"); ! if (f == null) ! gi.error("Couldn't write to " + filename); ! ! game.autosaved= autosave; game.write(f); ! game.autosaved= false; ! ! for (int i= 0; i < game.maxclients; i++) ! game.clients[i].write(f); ! ! fclose(f); } ! catch (Exception e) { e.printStackTrace(); } } public static void ReadGame(String filename) { ! QuakeFile f= null; try { ! f= new QuakeFile(filename, "r"); Com.Printf("loading game:" + filename); CreateEdicts(); *************** *** 207,215 **** game.load(f); ! for (int i = 0; i < game.maxclients; i++) { ! game.clients[i] = new gclient_t(i); game.clients[i].read(f); } ! f.close(); } --- 203,211 ---- game.load(f); ! for (int i= 0; i < game.maxclients; i++) { ! game.clients[i]= new gclient_t(i); game.clients[i].read(f); } ! f.close(); } *************** *** 219,223 **** } } ! /* ================= --- 215,219 ---- } } ! /* ================= *************** *** 226,267 **** ================= */ ! static void WriteLevel (String filename) ! { ! try ! { int i; edict_t ent; QuakeFile f; ! f= new QuakeFile(filename, "rw"); ! if (f==null) gi.error("Couldn't open for writing: " + filename); ! // write out level_locals_t level.write(f); ! // write out all the entities ! for (i= 0; i < globals.num_edicts; i++) ! { ent= g_edicts[i]; if (!ent.inuse) ! continue; ! f.writeInt(i); ent.write(f); ! } ! i= -1; f.writeInt(-1); ! f.close(); } ! catch (Exception e) ! { e.printStackTrace(); } } ! ! /* ================= --- 222,258 ---- ================= */ ! static void WriteLevel(String filename) { ! try { int i; edict_t ent; QuakeFile f; ! f= new QuakeFile(filename, "rw"); ! if (f == null) gi.error("Couldn't open for writing: " + filename); ! // write out level_locals_t level.write(f); ! // write out all the entities ! for (i= 0; i < globals.num_edicts; i++) { ent= g_edicts[i]; if (!ent.inuse) ! continue; ! f.writeInt(i); ent.write(f); ! } ! i= -1; f.writeInt(-1); ! f.close(); } ! catch (Exception e) { e.printStackTrace(); } } ! /* ================= *************** *** 280,339 **** ================= */ ! static void ReadLevel (String filename) throws IOException ! { ! edict_t ent; ! ! QuakeFile f = new QuakeFile(filename, "r"); ! ! if (f==null) ! gi.error ("Couldn't read level file " + filename); ! ! // wipe all the entities ! Game.CreateEdicts(); ! ! globals.num_edicts = (int) maxclients.value + 1; ! // load the level locals ! level.read(f); ! ! // load all the entities ! while (true) ! { ! int entnum = f.readInt(); ! if (entnum == -1) ! break; ! ! if (entnum >= globals.num_edicts) ! globals.num_edicts = entnum + 1; ! ! ent = g_edicts[entnum]; ! System.out.println("readint ent" + entnum); ! ent.read(f); ! ent.cleararealinks(); ! gi.linkentity(ent); ! } ! ! fclose (f); ! ! // mark all clients as unconnected ! for (int i=0 ; i<maxclients.value ; i++) ! { ! ent = g_edicts[i+1]; ! ent.client = game.clients[i]; ! ent.client.pers.connected = false; } ! ! // do any load time things at this point ! for (int i=0 ; i<globals.num_edicts ; i++) ! { ! ent = g_edicts[i]; ! ! if (!ent.inuse) ! continue; ! ! // fire any cross-level triggers ! if (ent.classname != null) ! if (strcmp(ent.classname, "target_crosslevel_target") == 0) ! ent.nextthink = level.time + ent.delay; } } --- 271,331 ---- ================= */ ! static void ReadLevel(String filename) { ! try { ! edict_t ent; ! QuakeFile f= new QuakeFile(filename, "r"); ! ! if (f == null) ! gi.error("Couldn't read level file " + filename); ! ! // wipe all the entities ! Game.CreateEdicts(); ! ! globals.num_edicts= (int) maxclients.value + 1; ! ! // load the level locals ! level.read(f); ! ! // load all the entities ! while (true) { ! int entnum= f.readInt(); ! if (entnum == -1) ! break; ! ! if (entnum >= globals.num_edicts) ! globals.num_edicts= entnum + 1; ! ! ent= g_edicts[entnum]; ! System.out.println("readint ent" + entnum); ! ent.read(f); ! ent.cleararealinks(); ! gi.linkentity(ent); ! } ! ! fclose(f); ! ! // mark all clients as unconnected ! for (int i= 0; i < maxclients.value; i++) { ! ent= g_edicts[i + 1]; ! ent.client= game.clients[i]; ! ent.client.pers.connected= false; ! } ! ! // do any load time things at this point ! for (int i= 0; i < globals.num_edicts; i++) { ! ent= g_edicts[i]; ! ! if (!ent.inuse) ! continue; ! ! // fire any cross-level triggers ! if (ent.classname != null) ! if (strcmp(ent.classname, "target_crosslevel_target") == 0) ! ent.nextthink= level.time + ent.delay; ! } } ! catch (Exception e) { ! e.printStackTrace(); } } Index: edict_t.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/edict_t.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** edict_t.java 20 Aug 2004 21:29:57 -0000 1.3 --- edict_t.java 22 Aug 2004 14:25:12 -0000 1.4 *************** *** 30,39 **** import jake2.util.*; ! public class edict_t ! { /** Constructor. */ ! public edict_t(int i) ! { s.number= i; index= i; --- 30,37 ---- import jake2.util.*; ! public class edict_t { /** Constructor. */ ! public edict_t(int i) { s.number= i; index= i; *************** *** 41,46 **** /** Used during level loading. */ ! public void cleararealinks() ! { area= new link_t(this); } --- 39,43 ---- /** Used during level loading. */ ! public void cleararealinks() { area= new link_t(this); } *************** *** 220,418 **** ///////////////////////////////////////////////// ! public boolean set(String key, String value) ! { ! if (key.equals("classname")) ! { classname= GameSpawn.ED_NewString(value); return true; } // F_LSTRING), ! if (key.equals("model")) ! { model= GameSpawn.ED_NewString(value); return true; } // F_LSTRING), ! if (key.equals("spawnflags")) ! { spawnflags= Lib.atoi(value); return true; } // F_INT), ! if (key.equals("speed")) ! { speed= Lib.atof(value); return true; } // F_FLOAT), ! if (key.equals("accel")) ! { accel= Lib.atof(value); return true; } // F_FLOAT), ! if (key.equals("decel")) ! { decel= Lib.atof(value); return true; } // F_FLOAT), ! if (key.equals("target")) ! { target= GameSpawn.ED_NewString(value); return true; } // F_LSTRING), ! if (key.equals("targetname")) ! { targetname= GameSpawn.ED_NewString(value); return true; } // F_LSTRING), ! if (key.equals("pathtarget")) ! { pathtarget= GameSpawn.ED_NewString(value); return true; } // F_LSTRING), ! if (key.equals("deathtarget")) ! { deathtarget= GameSpawn.ED_NewString(value); return true; } // F_LSTRING), ! if (key.equals("killtarget")) ! { killtarget= GameSpawn.ED_NewString(value); return true; } // F_LSTRING), ! if (key.equals("combattarget")) ! { combattarget= GameSpawn.ED_NewString(value); return true; } // F_LSTRING), ! if (key.equals("message")) ! { message= GameSpawn.ED_NewString(value); return true; } // F_LSTRING), ! if (key.equals("team")) ! { team= GameSpawn.ED_NewString(value); return true; } // F_LSTRING), ! if (key.equals("wait")) ! { wait= Lib.atof(value); return true; } // F_FLOAT), ! if (key.equals("delay")) ! { delay= Lib.atof(value); return true; } // F_FLOAT), ! if (key.equals("random")) ! { random= Lib.atof(value); return true; } // F_FLOAT), ! if (key.equals("move_origin")) ! { move_origin= Lib.atov(value); return true; } // F_VECTOR), ! if (key.equals("move_angles")) ! { move_angles= Lib.atov(value); return true; } // F_VECTOR), ! if (key.equals("style")) ! { style= Lib.atoi(value); return true; } // F_INT), ! if (key.equals("count")) ! { count= Lib.atoi(value); return true; } // F_INT), ! if (key.equals("health")) ! { health= Lib.atoi(value); return true; } // F_INT), ! if (key.equals("sounds")) ! { sounds= Lib.atoi(value); return true; } // F_INT), ! if (key.equals("light")) ! { return true; } // F_IGNORE), ! if (key.equals("dmg")) ! { dmg= Lib.atoi(value); return true; } // F_INT), ! if (key.equals("mass")) ! { mass= Lib.atoi(value); return true; } // F_INT), ! if (key.equals("volume")) ! { volume= Lib.atof(value); return true; } // F_FLOAT), ! if (key.equals("attenuation")) ! { attenuation= Lib.atof(value); return true; } // F_FLOAT), ! if (key.equals("map")) ! { map= GameSpawn.ED_NewString(value); return true; } // F_LSTRING), ! if (key.equals("origin")) ! { s.origin= Lib.atov(value); return true; } // F_VECTOR), ! if (key.equals("angles")) ! { s.angles= Lib.atov(value); return true; } // F_VECTOR), ! if (key.equals("angle")) ! { s.angles= new float[] { 0, Lib.atof(value), 0 }; return true; } // F_ANGLEHACK), ! if (key.equals("item")) ! { Game.gi.error("ent.set(\"item\") called."); return true; --- 217,381 ---- ///////////////////////////////////////////////// ! public boolean set(String key, String value) { ! if (key.equals("classname")) { classname= GameSpawn.ED_NewString(value); return true; } // F_LSTRING), ! if (key.equals("model")) { model= GameSpawn.ED_NewString(value); return true; } // F_LSTRING), ! if (key.equals("spawnflags")) { spawnflags= Lib.atoi(value); return true; } // F_INT), ! if (key.equals("speed")) { speed= Lib.atof(value); return true; } // F_FLOAT), ! if (key.equals("accel")) { accel= Lib.atof(value); return true; } // F_FLOAT), ! if (key.equals("decel")) { decel= Lib.atof(value); return true; } // F_FLOAT), ! if (key.equals("target")) { target= GameSpawn.ED_NewString(value); return true; } // F_LSTRING), ! if (key.equals("targetname")) { targetname= GameSpawn.ED_NewString(value); return true; } // F_LSTRING), ! if (key.equals("pathtarget")) { pathtarget= GameSpawn.ED_NewString(value); return true; } // F_LSTRING), ! if (key.equals("deathtarget")) { deathtarget= GameSpawn.ED_NewString(value); return true; } // F_LSTRING), ! if (key.equals("killtarget")) { killtarget= GameSpawn.ED_NewString(value); return true; } // F_LSTRING), ! if (key.equals("combattarget")) { combattarget= GameSpawn.ED_NewString(value); return true; } // F_LSTRING), ! if (key.equals("message")) { message= GameSpawn.ED_NewString(value); return true; } // F_LSTRING), ! if (key.equals("team")) { team= GameSpawn.ED_NewString(value); return true; } // F_LSTRING), ! if (key.equals("wait")) { wait= Lib.atof(value); return true; } // F_FLOAT), ! if (key.equals("delay")) { delay= Lib.atof(value); return true; } // F_FLOAT), ! if (key.equals("random")) { random= Lib.atof(value); return true; } // F_FLOAT), ! if (key.equals("move_origin")) { move_origin= Lib.atov(value); return true; } // F_VECTOR), ! if (key.equals("move_angles")) { move_angles= Lib.atov(value); return true; } // F_VECTOR), ! if (key.equals("style")) { style= Lib.atoi(value); return true; } // F_INT), ! if (key.equals("count")) { count= Lib.atoi(value); return true; } // F_INT), ! if (key.equals("health")) { health= Lib.atoi(value); return true; } // F_INT), ! if (key.equals("sounds")) { sounds= Lib.atoi(value); return true; } // F_INT), ! if (key.equals("light")) { return true; } // F_IGNORE), ! if (key.equals("dmg")) { dmg= Lib.atoi(value); return true; } // F_INT), ! if (key.equals("mass")) { mass= Lib.atoi(value); return true; } // F_INT), ! if (key.equals("volume")) { volume= Lib.atof(value); return true; } // F_FLOAT), ! if (key.equals("attenuation")) { attenuation= Lib.atof(value); return true; } // F_FLOAT), ! if (key.equals("map")) { map= GameSpawn.ED_NewString(value); return true; } // F_LSTRING), ! if (key.equals("origin")) { s.origin= Lib.atov(value); return true; } // F_VECTOR), ! if (key.equals("angles")) { s.angles= Lib.atov(value); return true; } // F_VECTOR), ! if (key.equals("angle")) { s.angles= new float[] { 0, Lib.atof(value), 0 }; return true; } // F_ANGLEHACK), ! if (key.equals("item")) { Game.gi.error("ent.set(\"item\") called."); return true; *************** *** 423,428 **** /** Writes the entity to the file. */ ! public void write(QuakeFile f) throws IOException ! { s.write(f); --- 386,390 ---- /** Writes the entity to the file. */ ! public void write(QuakeFile f) throws IOException { s.write(f); *************** *** 435,440 **** if (clusternums == null) f.writeInt(-1); ! else ! { f.writeInt(Defines.MAX_ENT_CLUSTERS); for (int n= 0; n < Defines.MAX_ENT_CLUSTERS; n++) --- 397,401 ---- if (clusternums == null) f.writeInt(-1); ! else { f.writeInt(Defines.MAX_ENT_CLUSTERS); for (int n= 0; n < Defines.MAX_ENT_CLUSTERS; n++) *************** *** 468,471 **** --- 429,433 ---- f.writeString(target); f.writeString(targetname); + f.writeString(killtarget); f.writeString(team); f.writeString(pathtarget); *************** *** 583,588 **** /** Reads the entity from the file.*/ ! public void read(QuakeFile f) throws IOException ! { s.read(f); inuse= f.readBoolean(); --- 545,549 ---- /** Reads the entity from the file.*/ ! public void read(QuakeFile f) throws IOException { s.read(f); inuse= f.readBoolean(); *************** *** 597,602 **** if (len == -1) clusternums= null; ! else ! { clusternums= new int[Defines.MAX_ENT_CLUSTERS]; for (int n= 0; n < Defines.MAX_ENT_CLUSTERS; n++) --- 558,562 ---- if (len == -1) clusternums= null; ! else { clusternums= new int[Defines.MAX_ENT_CLUSTERS]; for (int n= 0; n < Defines.MAX_ENT_CLUSTERS; n++) *************** *** 630,633 **** --- 590,594 ---- target= f.readString(); targetname= f.readString(); + killtarget= f.readString(); team= f.readString(); pathtarget= f.readString(); Index: game_import_t.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/game_import_t.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** game_import_t.java 8 Jul 2004 15:58:44 -0000 1.2 --- game_import_t.java 22 Aug 2004 14:25:11 -0000 1.3 *************** *** 41,46 **** public class game_import_t { - // R S T: SEE SV_InitGameProgs() ! - // special messages public void bprintf(int printlevel, String s) --- 41,44 ---- Index: GameBase.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/GameBase.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GameBase.java 20 Aug 2004 21:29:58 -0000 1.4 --- GameBase.java 22 Aug 2004 14:25:11 -0000 1.5 *************** *** 34,45 **** import jake2.util.*; ! public class GameBase extends Globals ! { ! public static cplane_t dummyplane = new cplane_t(); ! public static game_locals_t game = new game_locals_t(); ! public static level_locals_t level = new level_locals_t(); ! public static game_import_t gi = new game_import_t(); ! public static game_export_t globals = new game_export_t(); ! public static spawn_temp_t st = new spawn_temp_t(); [...1146 lines suppressed...] }; ! globals.apiversion = GAME_API_VERSION; /* globals.Init = InitGame; --- 699,712 ---- */ ! public static game_export_t GetGameApi(game_import_t imp) { ! gi= imp; ! gi.pointcontents= new pmove_t.PointContentsAdapter() { ! public int pointcontents(float[] o) { return SV_WORLD.SV_PointContents(o); } }; ! globals.apiversion= GAME_API_VERSION; /* globals.Init = InitGame; |