aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/jake2/game')
-rw-r--r--src/jake2/game/GameBase.java34
-rw-r--r--src/jake2/game/GameSave.java37
-rw-r--r--src/jake2/game/GameSpawn.java8
-rw-r--r--src/jake2/game/GameTargetAdapters.java11
-rw-r--r--src/jake2/game/GameUtil.java12
-rw-r--r--src/jake2/game/game_export_t.java124
6 files changed, 35 insertions, 191 deletions
diff --git a/src/jake2/game/GameBase.java b/src/jake2/game/GameBase.java
index cdec20b..323f6c8 100644
--- a/src/jake2/game/GameBase.java
+++ b/src/jake2/game/GameBase.java
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 30.11.2003 by RST.
-// $Id: GameBase.java,v 1.5 2004-08-22 14:25:11 salomo Exp $
+// $Id: GameBase.java,v 1.6 2004-08-29 21:39:24 hzi Exp $
/** Father of all GameObjects. */
@@ -38,12 +38,12 @@ public class GameBase extends Globals {
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();
public static int sm_meat_index;
public static int snd_fry;
public static int meansOfDeath;
+ public static int num_edicts;
public static edict_t g_edicts[]= new edict_t[MAX_EDICTS];
static {
@@ -156,7 +156,7 @@ public class GameBase extends Globals {
else
from.i++;
- for (; from.i < globals.num_edicts; from.i++) {
+ for (; from.i < num_edicts; from.i++) {
from.o= g_edicts[from.i];
if (from.o.classname == null) {
Com.Printf("edict with classname = null" + from.o.index);
@@ -193,7 +193,7 @@ public class GameBase extends Globals {
else
from.i++;
- for (; from.i < globals.num_edicts; from.i++) {
+ for (; from.i < num_edicts; from.i++) {
from.o= g_edicts[from.i];
if (!from.o.inuse)
continue;
@@ -375,21 +375,6 @@ public class GameBase extends Globals {
================
*/
public static int DI_NODIR= -1;
- public static void assert1(boolean cond) {
- if (!cond) {
-
- try {
-
- int a[]= null;
- int b= a[0];
- }
- catch (Exception e) {
- System.err.println("assertion failed!");
- e.printStackTrace();
- }
-
- }
- }
public static void ClearBounds(float[] mins, float[] maxs) {
mins[0]= mins[1]= mins[2]= 99999;
@@ -427,9 +412,6 @@ public class GameBase extends Globals {
public static void ShutdownGame() {
gi.dprintf("==== ShutdownGame ====\n");
-
- //gi.FreeTags (TAG_LEVEL);
- //gi.FreeTags (TAG_GAME);
}
//======================================================================
@@ -654,7 +636,7 @@ public class GameBase extends Globals {
// even the world gets a chance to think
//
- for (i= 0; i < globals.num_edicts; i++) {
+ for (i= 0; i < num_edicts; i++) {
ent= g_edicts[i];
if (!ent.inuse)
continue;
@@ -698,7 +680,7 @@ public class GameBase extends Globals {
=================
*/
- public static game_export_t GetGameApi(game_import_t imp) {
+ public static void GetGameApi(game_import_t imp) {
gi= imp;
gi.pointcontents= new pmove_t.PointContentsAdapter() {
@@ -707,7 +689,7 @@ public class GameBase extends Globals {
}
};
- globals.apiversion= GAME_API_VERSION;
+ //globals.apiversion= GAME_API_VERSION;
/*
globals.Init = InitGame;
globals.Shutdown = ShutdownGame;
@@ -728,6 +710,6 @@ public class GameBase extends Globals {
globals.ServerCommand = ServerCommand;
*/
- return globals;
+ //return globals;
}
} \ No newline at end of file
diff --git a/src/jake2/game/GameSave.java b/src/jake2/game/GameSave.java
index 7db262e..90d9619 100644
--- a/src/jake2/game/GameSave.java
+++ b/src/jake2/game/GameSave.java
@@ -19,21 +19,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 29.12.2003 by RST.
-// $Id: GameSave.java,v 1.3 2004-08-22 14:25:12 salomo Exp $
+// $Id: GameSave.java,v 1.4 2004-08-29 21:39:24 hzi Exp $
package jake2.game;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-import java.nio.*;
-
-import jake2.*;
-import jake2.client.*;
-import jake2.qcommon.*;
-import jake2.render.*;
-import jake2.server.*;
-import jake2.util.*;
+import jake2.qcommon.Com;
+import jake2.util.QuakeFile;
public class GameSave extends GameFunc {
@@ -57,7 +48,7 @@ public class GameSave extends GameFunc {
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;
+ GameBase.g_edicts= g_edicts;
}
public static void CreateClients() {
@@ -139,15 +130,15 @@ public class GameSave extends GameFunc {
game.maxentities= (int) maxentities.value;
CreateEdicts();
- globals.edicts= g_edicts;
- globals.max_edicts= game.maxentities;
+// 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;
+ num_edicts= game.maxclients + 1;
}
/*
@@ -221,7 +212,7 @@ public class GameSave extends GameFunc {
=================
*/
- static void WriteLevel(String filename) {
+ public static void WriteLevel(String filename) {
try {
int i;
edict_t ent;
@@ -235,7 +226,7 @@ public class GameSave extends GameFunc {
level.write(f);
// write out all the entities
- for (i= 0; i < globals.num_edicts; i++) {
+ for (i= 0; i < num_edicts; i++) {
ent= g_edicts[i];
if (!ent.inuse)
continue;
@@ -270,7 +261,7 @@ public class GameSave extends GameFunc {
No clients are connected yet.
=================
*/
- static void ReadLevel(String filename) {
+ public static void ReadLevel(String filename) {
try {
edict_t ent;
@@ -282,7 +273,7 @@ public class GameSave extends GameFunc {
// wipe all the entities
Game.CreateEdicts();
- globals.num_edicts= (int) maxclients.value + 1;
+ num_edicts= (int) maxclients.value + 1;
// load the level locals
level.read(f);
@@ -293,8 +284,8 @@ public class GameSave extends GameFunc {
if (entnum == -1)
break;
- if (entnum >= globals.num_edicts)
- globals.num_edicts= entnum + 1;
+ if (entnum >= num_edicts)
+ num_edicts= entnum + 1;
ent= g_edicts[entnum];
System.out.println("readint ent" + entnum);
@@ -313,7 +304,7 @@ public class GameSave extends GameFunc {
}
// do any load time things at this point
- for (int i= 0; i < globals.num_edicts; i++) {
+ for (int i= 0; i < num_edicts; i++) {
ent= g_edicts[i];
if (!ent.inuse)
diff --git a/src/jake2/game/GameSpawn.java b/src/jake2/game/GameSpawn.java
index c87c330..c93ebc0 100644
--- a/src/jake2/game/GameSpawn.java
+++ b/src/jake2/game/GameSpawn.java
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 18.11.2003 by RST.
-// $Id: GameSpawn.java,v 1.5 2004-08-29 19:27:37 hzi Exp $
+// $Id: GameSpawn.java,v 1.6 2004-08-29 21:39:24 hzi Exp $
package jake2.game;
@@ -284,7 +284,7 @@ public class GameSpawn extends GameSave {
int c, c2;
c = 0;
c2 = 0;
- for (i = 1; i < globals.num_edicts; i++) {
+ for (i = 1; i < num_edicts; i++) {
e = g_edicts[i];
if (!e.inuse)
@@ -298,7 +298,7 @@ public class GameSpawn extends GameSave {
c++;
c2++;
//Com.Printf("Team:" + e.team+" entity: " + e.index + "\n");
- for (j = i + 1; j < globals.num_edicts; j++) {
+ for (j = i + 1; j < num_edicts; j++) {
e2 = g_edicts[j];
if (!e2.inuse)
continue;
@@ -328,7 +328,7 @@ public class GameSpawn extends GameSave {
==============
*/
- static void SpawnEntities(String mapname, String entities, String spawnpoint) {
+ public static void SpawnEntities(String mapname, String entities, String spawnpoint) {
edict_t ent;
int inhibit;
String com_token;
diff --git a/src/jake2/game/GameTargetAdapters.java b/src/jake2/game/GameTargetAdapters.java
index e02975f..19a48c9 100644
--- a/src/jake2/game/GameTargetAdapters.java
+++ b/src/jake2/game/GameTargetAdapters.java
@@ -19,15 +19,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 26.02.2004 by RST.
-// $Id: GameTargetAdapters.java,v 1.2 2004-08-27 21:57:48 hzi Exp $
+// $Id: GameTargetAdapters.java,v 1.3 2004-08-29 21:39:24 hzi Exp $
package jake2.game;
-import jake2.*;
-import jake2.client.*;
-import jake2.qcommon.*;
-import jake2.render.*;
-import jake2.server.*;
+import jake2.Defines;
+import jake2.Globals;
import jake2.util.Lib;
import jake2.util.Math3D;
@@ -553,7 +550,7 @@ public class GameTargetAdapters {
self.last_move_time = GameBase.level.time + 0.5f;
}
- for (i = 1; i < GameBase.globals.num_edicts; i++) {
+ for (i = 1; i < GameBase.num_edicts; i++) {
e = GameBase.g_edicts[i];
if (!e.inuse)
diff --git a/src/jake2/game/GameUtil.java b/src/jake2/game/GameUtil.java
index 5769564..765659d 100644
--- a/src/jake2/game/GameUtil.java
+++ b/src/jake2/game/GameUtil.java
@@ -19,16 +19,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 01.11.2003 by RST.
-// $Id: GameUtil.java,v 1.4 2004-08-20 21:29:57 salomo Exp $
+// $Id: GameUtil.java,v 1.5 2004-08-29 21:39:24 hzi Exp $
package jake2.game;
-import java.sql.Savepoint;
-
-import jake2.Defines;
import jake2.client.M;
import jake2.qcommon.Com;
-import jake2.util.*;
+import jake2.util.Lib;
+import jake2.util.Math3D;
public class GameUtil extends GameBase
{
@@ -165,7 +163,7 @@ public class GameUtil extends GameBase
int i;
edict_t e = null;
- for (i = (int) maxclients.value + 1; i < globals.num_edicts; i++)
+ for (i = (int) maxclients.value + 1; i < num_edicts; i++)
{
e = g_edicts[i];
// the first couple seconds of server time can involve a lot of
@@ -182,7 +180,7 @@ public class GameUtil extends GameBase
gi.error("ED_Alloc: no free edicts");
e = g_edicts[i] = new edict_t(i);
- globals.num_edicts++;
+ num_edicts++;
G_InitEdict(e, i);
return e;
}
diff --git a/src/jake2/game/game_export_t.java b/src/jake2/game/game_export_t.java
deleted file mode 100644
index cfc0610..0000000
--- a/src/jake2/game/game_export_t.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
-Copyright (C) 1997-2001 Id Software, Inc.
-
-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.
-
-*/
-
-// Created on 31.10.2003 by RST.
-// $Id: game_export_t.java,v 1.5 2004-08-22 14:25:11 salomo Exp $
-
-package jake2.game;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-
-import jake2.qcommon.Com;
-import jake2.util.QuakeFile;
-
-//
-//functions exported by the game subsystem
-//
-
-public class game_export_t {
-
- public int apiversion;
-
- // the init function will only be called when a game starts,
- // 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);
- }
-
- // Read/Write Game is for storing persistant cross level information
- // about the world state and the clients.
- // 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);
- }
-
- // 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();
- }
-
- // ServerCommand will be called when an "sv <command>" command is issued on the
- // server console.
- // the game can issue gi.argc() / gi.argv() commands to get the rest
- // of the parameters
- public void ServerCommand() {
- Game.ServerCommand();
- }
-
- //
- // global variables shared between game and server
- //
-
- // the edict array is allocated in the game dll so it
- // can vary in size from one game to another.
-
- // 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;
-}