spingle/source/pr_comp.h

330 lines
5.3 KiB
C

/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2010-2014 QuakeSpasm developers
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.
*/
#ifndef spingle__pr_comp_h
#define spingle__pr_comp_h
enum
{
GBL_NULL,
GBL_RETURN,
GBL_PARM0 = GBL_RETURN + 3,
GBL_PARM1 = GBL_PARM0 + 3,
GBL_PARM2 = GBL_PARM1 + 3,
GBL_PARM3 = GBL_PARM2 + 3,
GBL_PARM4 = GBL_PARM3 + 3,
GBL_PARM5 = GBL_PARM4 + 3,
GBL_PARM6 = GBL_PARM5 + 3,
GBL_PARM7 = GBL_PARM6 + 3,
GBL_self = 28,
GBL_other,
GBL_world,
GBL_time,
GBL_frametime,
GBL_force_retouch,
GBL_mapname,
GBL_deathmatch,
GBL_coop,
GBL_teamplay,
GBL_serverflags,
GBL_total_secrets,
GBL_total_monsters,
GBL_found_secrets,
GBL_killed_monsters,
GBL_parm1,
GBL_parm2,
GBL_parm3,
GBL_parm4,
GBL_parm5,
GBL_parm6,
GBL_parm7,
GBL_parm8,
GBL_parm9,
GBL_parm10,
GBL_parm11,
GBL_parm12,
GBL_parm13,
GBL_parm14,
GBL_parm15,
GBL_parm16,
GBL_v_forward,
GBL_v_up = GBL_v_forward + 3,
GBL_v_right = GBL_v_up + 3,
GBL_trace_allsolid = GBL_v_right + 3,
GBL_trace_startsolid,
GBL_trace_fraction,
GBL_trace_endpos,
GBL_trace_plane_normal = GBL_trace_endpos + 3,
GBL_trace_plane_dist = GBL_trace_plane_normal + 3,
GBL_trace_ent,
GBL_trace_inopen,
GBL_trace_inwater,
GBL_msg_entity,
GBL_main,
GBL_StartFrame,
GBL_PlayerPreThink,
GBL_PlayerPostThink,
GBL_ClientKill,
GBL_ClientConnect,
GBL_PutClientInServer,
GBL_ClientDisconnect,
GBL_SetNewParms,
GBL_SetChangeParms,
GBL_SYSTEM_END,
};
enum
{
ED_modelindex,
ED_absmin,
ED_absmax = ED_absmin + 3,
ED_ltime = ED_absmax + 3,
ED_movetype,
ED_solid,
ED_origin,
ED_oldorigin = ED_origin + 3,
ED_velocity = ED_oldorigin + 3,
ED_angles = ED_velocity + 3,
ED_avelocity = ED_angles + 3,
ED_punchangle = ED_avelocity + 3,
ED_classname = ED_punchangle + 3,
ED_model,
ED_frame,
ED_skin,
ED_effects,
ED_mins,
ED_maxs = ED_mins + 3,
ED_size = ED_maxs + 3,
ED_touch = ED_size + 3,
ED_use,
ED_think,
ED_blocked,
ED_nextthink,
ED_groundentity,
ED_health,
ED_frags,
ED_weapon,
ED_weaponmodel,
ED_weaponframe,
ED_currentammo,
ED_ammo_shells,
ED_ammo_nails,
ED_ammo_rockets,
ED_ammo_cells,
ED_items,
ED_takedamage,
ED_chain,
ED_deadflag,
ED_view_ofs,
ED_button0 = ED_view_ofs + 3,
ED_button1,
ED_button2,
ED_impulse,
ED_fixangle,
ED_v_angle,
ED_idealpitch = ED_v_angle + 3,
ED_netname,
ED_enemy,
ED_flags,
ED_colormap,
ED_team,
ED_max_health,
ED_teleport_time,
ED_armortype,
ED_armorvalue,
ED_waterlevel,
ED_watertype,
ED_ideal_yaw,
ED_yaw_speed,
ED_aiment,
ED_goalentity,
ED_spawnflags,
ED_target,
ED_targetname,
ED_dmg_take,
ED_dmg_save,
ED_dmg_inflictor,
ED_owner,
ED_movedir,
ED_message = ED_movedir + 3,
ED_sounds,
ED_noise,
ED_noise1,
ED_noise2,
ED_noise3,
ED_SYSTEM_END,
};
#define DEF_SAVEGLOBAL (1 << 15)
#define PROG_VERSION 6
typedef int32_t func_t;
typedef int32_t string_t;
typedef enum
{
ev_bad = -1,
ev_void = 0,
ev_string,
ev_float,
ev_vector,
ev_entity,
ev_field,
ev_function,
ev_pointer
} etype_t;
enum
{
OP_DONE,
OP_MUL_F,
OP_MUL_V,
OP_MUL_FV,
OP_MUL_VF,
OP_DIV_F,
OP_ADD_F,
OP_ADD_V,
OP_SUB_F,
OP_SUB_V,
OP_EQ_F,
OP_EQ_V,
OP_EQ_S,
OP_EQ_E,
OP_EQ_FNC,
OP_NE_F,
OP_NE_V,
OP_NE_S,
OP_NE_E,
OP_NE_FNC,
OP_LE,
OP_GE,
OP_LT,
OP_GT,
OP_LOAD_F,
OP_LOAD_V,
OP_LOAD_S,
OP_LOAD_ENT,
OP_LOAD_FLD,
OP_LOAD_FNC,
OP_ADDRESS,
OP_STORE_F,
OP_STORE_V,
OP_STORE_S,
OP_STORE_ENT,
OP_STORE_FLD,
OP_STORE_FNC,
OP_STOREP_F,
OP_STOREP_V,
OP_STOREP_S,
OP_STOREP_ENT,
OP_STOREP_FLD,
OP_STOREP_FNC,
OP_RETURN,
OP_NOT_F,
OP_NOT_V,
OP_NOT_S,
OP_NOT_ENT,
OP_NOT_FNC,
OP_IF,
OP_IFNOT,
OP_CALL0,
OP_CALL1,
OP_CALL2,
OP_CALL3,
OP_CALL4,
OP_CALL5,
OP_CALL6,
OP_CALL7,
OP_CALL8,
OP_STATE,
OP_GOTO,
OP_AND,
OP_OR,
OP_BITAND,
OP_BITOR
};
typedef struct
{
uint16_t op;
int16_t a, b, c;
} dstatement_t;
typedef struct
{
uint16_t type; /* if DEF_SAVEGLOBAL bit is set the variable needs to be saved in savegames */
uint16_t ofs;
int32_t s_name;
} ddef_t;
typedef struct
{
int32_t first_statement; // negative numbers are builtins
int32_t parm_start;
int32_t locals; // total ints of parms + locals
int32_t profile; // runtime
int32_t s_name;
int32_t s_file; // source file defined in
int32_t numparms;
byte parm_size[8];
} dfunction_t;
typedef struct
{
int32_t version;
int32_t crc; // check of header file
int32_t ofs_statements;
int32_t numstatements; // statement 0 is an error
int32_t ofs_globaldefs;
int32_t numglobaldefs;
int32_t ofs_fielddefs;
int32_t numfielddefs;
int32_t ofs_functions;
int32_t numfunctions; // function 0 is an empty
int32_t ofs_strings;
int32_t numstrings; // first string is a null string
int32_t ofs_globals;
int32_t numglobals;
int32_t entityfields;
} dprograms_t;
#endif