aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/game/game_export_t.java
blob: 4f8369c8bbb142f5d307e8a5b36ba04404ce06af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
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.1 2004-07-07 19:59:25 hzi Exp $

package jake2.game;

import jake2.Defines;
import jake2.qcommon.Com;


//
//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) {
		Com.Error(Defines.ERR_FATAL, "WriteGame not implemnted!");
	}
	
	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) {
		Com.Error(Defines.ERR_FATAL, "WriteLevel not implemnted!");
	}

	public void ReadLevel(String filename) {
		Com.Error(Defines.ERR_FATAL, "ReadLevel not implemnted!");
	}

	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;
}