Updates to q_math

This commit is contained in:
Walter Julius Hennecke 2014-08-13 23:29:27 +02:00
parent 5afa43ec61
commit b766076ed6
18 changed files with 5744 additions and 5715 deletions

View file

@ -8,6 +8,7 @@
#include "cg_local.h"
#include "cg_text.h"
#include "cg_screenfx.h"
#include "../game/q_math.h"
/* set in CG_ParseTeamInfo */
int32_t sortedTeamPlayers[TEAM_MAXOVERLAY];

View file

@ -5,6 +5,7 @@
#include "cg_local.h"
#include "fx_local.h"
#include "../game/q_math.h"
/*

View file

@ -32,7 +32,7 @@ void CG_PositionEntityOnTag( refEntity_t *entity, const refEntity_t *parent,
}
// had to cast away the const to avoid compiler problems...
MatrixMultiply( lerped.axis, ((refEntity_t *)parent)->axis, entity->axis );
MatrixMultiply( (double**)lerped.axis, (double**)((refEntity_t *)parent)->axis, (double**)entity->axis );
entity->backlerp = parent->backlerp;
}
@ -63,8 +63,8 @@ void CG_PositionRotatedEntityOnTag( refEntity_t *entity, const refEntity_t *pare
}
// had to cast away the const to avoid compiler problems...
MatrixMultiply( entity->axis, lerped.axis, tempAxis );
MatrixMultiply( tempAxis, ((refEntity_t *)parent)->axis, entity->axis );
MatrixMultiply((double**)entity->axis, (double**)lerped.axis, (double**)tempAxis);
MatrixMultiply((double**)tempAxis, (double**)((refEntity_t *)parent)->axis, (double**)entity->axis);
}

View file

@ -7,6 +7,7 @@
#include "cg_screenfx.h"
#include "fx_local.h"
#include "../game/bg_misc.h"
#include "../game/q_math.h"
//#include "cg_anims.h" //RPG-X: J2J - Added for animation string table.
const char *cg_customSoundNames[MAX_CUSTOM_SOUNDS] = {

View file

@ -4,6 +4,7 @@
// for a 3D rendering
#include "cg_local.h"
#include "cg_screenfx.h"
#include "../game/q_math.h"
#define MAX_SHAKE_INTENSITY 16.0f

View file

@ -3,6 +3,7 @@
// cg_weapons.c -- events and effects dealing with weapons
#include "cg_local.h"
#include "fx_local.h"
#include "../game/q_math.h"
//RPG-X : TiM - Weapons Arrays
static int32_t RAweapons[8] = { WP_3,

View file

@ -1,5 +1,6 @@
#include "cg_local.h"
#include "fx_local.h"
#include "../game/q_math.h"
/*

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,491 +1,491 @@
#ifndef _G_SPAWN_H
#define _G_SPAWN_H
//
// fields are needed for spawning from the entity string
//
typedef enum {
F_INT,
F_FLOAT,
F_LSTRING, // string on disk, pointer in memory, TAG_LEVEL
F_GSTRING, // string on disk, pointer in memory, TAG_GAME
F_VECTOR,
F_VECTOR4,
F_ANGLEHACK,
F_ENTITY, // index on disk, pointer in memory
F_ITEM, // index on disk, pointer in memory
F_CLIENT, // index on disk, pointer in memory
F_IGNORE
} fieldtype_t;
typedef struct
{
char* name;
int ofs;
fieldtype_t type;
int flags;
} field_t;
/**
* @brief Spawn player start entity.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_info_player_deathmatch(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of intermission entity.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_info_player_intermission(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of func_plat entity.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_plat (/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of func_forcefield entity.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_forcefield(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of func static entity.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_static(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of func_rotating.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_rotating(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of func_bobbing.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_bobbing(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function func_pendulum.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_pendulum(/*@shared@*/ gentity_t* entity );
/**
* @brief Spawn function func_button.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_button(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of func_door entity.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_door(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of func_train.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_train(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function func_timer.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_timer(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function func_usable.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_usable(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of func_breakable.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_breakable(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of func_door_rotating.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_door_rotating(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of func_brushmodel.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_brushmodel(/*@shared@*/ gentity_t* entity); // for brushmodel hijacking :D
/**
* @brief Spawn function of func_lightchange.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_lightchange(/*@shared@*/ gentity_t* entity); // "toggling" light
/**
* @brief Spawn function of func_targetmover.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_targetmover(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function func_stasis_door.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_stasis_door(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of trigger_always.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_trigger_always(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of trigger_multiple.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_trigger_multiple(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of trigger_push.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_trigger_push(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of trigger_teleport.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_trigger_teleport(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of trigger_hurt.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_trigger_hurt(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of trigger_transporter.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_trigger_transporter(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of trigger_radiation.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_trigger_radiation(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of target_remove_powerups.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_remove_powerups(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of target_give.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_give(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of target_delay.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_delay(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of target_speaker.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_speaker(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of target_print.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_print(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of target_laser.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_laser(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of target_character.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_character(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of target_teleporter.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_teleporter(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of target_relay.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_relay(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of target_kill.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_kill(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function target_location.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_location(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of target_push.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_push(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of target_counter.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_counter(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of target_objective.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_objective(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of target_boolean.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_boolean(/*@shared@*/ gentity_t* entity); //RPG-X | Phenix | 13/06/2004
/**
* @brief Spawn function of target_gravity.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_gravity(/*@shared@*/ gentity_t* entity); //RPG-X | Phenix | 13/06/2004
/**
* @brief Spawn function of target_shake.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_shake(/*@shared@*/ gentity_t* entity); //RPG-X | Phenix | 16/11/2004
/**
* @brief Spawn function of target_evosuit.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_evosuit(/*@shared@*/ gentity_t* entity); //RPG-X | Phenix | 16/11/2004
/**
* @brief Spawn function of target_turbolift.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_turbolift(/*@shared@*/ gentity_t* entity); //RPG-X | TiM
/**
* @brief Spawn function of target_doorLock.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_doorLock(/*@shared@*/ gentity_t* entity); //RPG-X | GSIO01 | 08/05/2009
void SP_target_repair(/*@shared@*/ gentity_t* entity); //RPG-X | GSIO01 | 09/05/2009
void SP_target_alert(/*@shared@*/ gentity_t* entity); //RPG-X | GSIO01 | 11/05/2009
void SP_target_warp(/*@shared@*/ gentity_t* entity); //RPG-X | GSIO01 | 19/05/2009
void SP_target_deactivate(/*@shared@*/ gentity_t* entity);
void SP_target_serverchange(/*@shared@*/ gentity_t* entity);
void SP_target_levelchange(/*@shared@*/ gentity_t* entity);
void SP_target_shaderremap(/*@shared@*/ gentity_t* entity);
void SP_target_selfdestruct(/*@shared@*/ gentity_t* entity);
void SP_target_zone(/*@shared@*/ gentity_t* entity);
void SP_target_shiphealth(/*@shared@*/ gentity_t* entity);
void SP_target_sequence(/*@shared@*/ gentity_t* entity);
void SP_light(/*@shared@*/ gentity_t* entity);
void SP_info_null(/*@shared@*/ gentity_t* entity);
void SP_info_notnull(/*@shared@*/ gentity_t* entity);
void SP_info_camp(/*@shared@*/ gentity_t* entity);
void SP_path_corner(/*@shared@*/ gentity_t* entity);
void SP_misc_model(/*@shared@*/ gentity_t* entity);
void SP_misc_model_breakable(/*@shared@*/ gentity_t* entity);
void SP_misc_portal_camera(/*@shared@*/ gentity_t* entity);
void SP_misc_portal_surface(/*@shared@*/ gentity_t* entity);
void SP_misc_turret(/*@shared@*/ gentity_t* entity);
void SP_laser_arm(/*@shared@*/ gentity_t* entity);
void SP_misc_ammo_station(/*@shared@*/ gentity_t* entity);
void SP_shooter_rocket(/*@shared@*/ gentity_t* entity);
void SP_shooter_plasma(/*@shared@*/ gentity_t* entity);
void SP_shooter_grenade(/*@shared@*/ gentity_t* entity);
void SP_shooter_torpedo(/*@shared@*/ gentity_t* entity);
// extra Trek stuff
void SP_fx_spark (/*@shared@*/ gentity_t* entity);
void SP_fx_steam (/*@shared@*/ gentity_t* entity);
void SP_fx_bolt (/*@shared@*/ gentity_t* entity);
void SP_fx_transporter(/*@shared@*/ gentity_t* entity);
void SP_fx_drip(/*@shared@*/ gentity_t* entity);
//RPG-X - TiM: SP ripped visual FX
void SP_fx_fountain(/*@shared@*/ gentity_t* entity);
void SP_fx_surface_explosion(/*@shared@*/ gentity_t* entity);
void SP_fx_blow_chunks(/*@shared@*/ gentity_t* entity);
void SP_fx_smoke(/*@shared@*/ gentity_t* entity);
void SP_fx_electrical_explosion(/*@shared@*/ gentity_t* entity);
//RPG-X | RPG-X | 09/05/2009: additional Trek fx
void SP_fx_phaser(/*@shared@*/ gentity_t* entity);
void SP_fx_torpedo(/*@shared@*/ gentity_t* entity);
//RPG-X | RPG-X | 01/07/2009: additional fx
void SP_fx_particleFire(/*@shared@*/ gentity_t* entity);
void SP_fx_fire(/*@shared@*/ gentity_t* entity);
// Additional ports from SP by Harry Young
void SP_fx_cooking_steam(/*@shared@*/ gentity_t* entity);
void SP_fx_electricfire(/*@shared@*/ gentity_t* entity);
//void SP_fx_forge_bolt( gentity_t *entity );
//void SP_fx_plasma( gentity_t *entity );
//void SP_fx_stream( gentity_t *entity );
//void SP_fx_transporter_stream( gentity_t *entity );
//void SP_fx_explosion_trail( gentity_t *entity );
//void SP_fx_borg_energy_beam( gentity_t *entity );
void SP_fx_shimmery_thing(/*@shared@*/ gentity_t* entity);
void SP_fx_borg_bolt(/*@shared@*/ gentity_t* entity);
// new mover
void SP_func_mover(/*@shared@*/ gentity_t* entity);
void SP_path_point(/*@shared@*/ gentity_t* entity);
// ui entities
void SP_ui_transporter(/*@shared@*/ gentity_t* entity);
void SP_ui_msd(/*@shared@*/ gentity_t* entity);
void SP_ui_holodeck(/*@shared@*/ gentity_t* entity);
// cinematic entities
void SP_cinematic_camera(/*@shared@*/ gentity_t* entity);
/**
* \brief Get a string for a custom entity key.
*
* Spawn string returns a temporary reference, you must copy the string if you want to keep it.
*
* \param[in] key Key to get the value for.
* \param[in] defaultString Default value for this key.
* \param[out] out The result.
* \return Success or fail.
*/
qboolean G_SpawnString( const char* key, const char* defaultString, /*@out@*/ char** out );
/**
* \brief Get a float for a custom entity key.
*
* \param[in] key Key to get the value for.
* \param[in] defaultString Default value for this key.
* \param[out] out The result.
* \return Success or fail.
*/
qboolean G_SpawnFloat( const char* key, const char* defaultString, /*@out@*/ float* out );
/**
* \brief Get a int for a custom entity key.
*
* \param[in] key Key to get the value for.
* \param[in] defaultString Default value for this key.
* \param[out] out The result.
* \return Success or fail.
*/
qboolean G_SpawnInt( const char* key, const char* defaultString, /*@out@*/ int* out );
/**
* \brief Get a vector for a custom entity key.
*
* \param[in] key Key to get the value for.
* \param[in] defaultString Default value for this key.
* \param[out] out The result.
* \return Success or fail.
*/
qboolean G_SpawnVector( const char* key, const char* defaultString, /*@out@*/ float* out );
/**
* \brief Get a vector for a custom entity key.
*
* \param[in] key Key to get the value for.
* \param[in] defaultString Default value for this key.
* \param[out] out The result.
* \return Success or fail.
*/
qboolean G_SpawnVector4( const char* key, const char* defaultString, /*@out@*/ float* out );
/**
* \brief Spawn all entities from the entity string.
*/
void G_SpawnEntitiesFromString( void );
/**
* \brief Calls the spawn function for an entity.
*/
qboolean G_CallSpawn(gentity_t *ent);
#endif /* _G_SPAWN_H */
#ifndef _G_SPAWN_H
#define _G_SPAWN_H
//
// fields are needed for spawning from the entity string
//
typedef enum {
F_INT,
F_FLOAT,
F_LSTRING, // string on disk, pointer in memory, TAG_LEVEL
F_GSTRING, // string on disk, pointer in memory, TAG_GAME
F_VECTOR,
F_VECTOR4,
F_ANGLEHACK,
F_ENTITY, // index on disk, pointer in memory
F_ITEM, // index on disk, pointer in memory
F_CLIENT, // index on disk, pointer in memory
F_IGNORE
} fieldtype_t;
typedef struct
{
char* name;
int ofs;
fieldtype_t type;
int flags;
} field_t;
/**
* @brief Spawn player start entity.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_info_player_deathmatch(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of intermission entity.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_info_player_intermission(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of func_plat entity.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_plat (/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of func_forcefield entity.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_forcefield(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of func static entity.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_static(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of func_rotating.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_rotating(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of func_bobbing.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_bobbing(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function func_pendulum.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_pendulum(/*@shared@*/ gentity_t* entity );
/**
* @brief Spawn function func_button.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_button(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of func_door entity.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_door(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of func_train.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_train(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function func_timer.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_timer(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function func_usable.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_usable(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of func_breakable.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_breakable(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of func_door_rotating.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_door_rotating(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of func_brushmodel.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_brushmodel(/*@shared@*/ gentity_t* entity); // for brushmodel hijacking :D
/**
* @brief Spawn function of func_lightchange.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_lightchange(/*@shared@*/ gentity_t* entity); // "toggling" light
/**
* @brief Spawn function of func_targetmover.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_targetmover(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function func_stasis_door.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_func_stasis_door(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of trigger_always.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_trigger_always(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of trigger_multiple.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_trigger_multiple(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of trigger_push.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_trigger_push(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of trigger_teleport.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_trigger_teleport(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of trigger_hurt.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_trigger_hurt(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of trigger_transporter.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_trigger_transporter(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of trigger_radiation.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_trigger_radiation(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of target_remove_powerups.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_remove_powerups(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of target_give.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_give(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of target_delay.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_delay(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of target_speaker.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_speaker(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of target_print.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_print(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of target_laser.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_laser(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of target_character.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_character(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of target_teleporter.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_teleporter(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of target_relay.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_relay(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of target_kill.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_kill(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function target_location.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_location(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of target_push.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_push(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of target_counter.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_counter(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of target_objective.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_objective(/*@shared@*/ gentity_t* entity);
/**
* @brief Spawn function of target_boolean.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_boolean(/*@shared@*/ gentity_t* entity); //RPG-X | Phenix | 13/06/2004
/**
* @brief Spawn function of target_gravity.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_gravity(/*@shared@*/ gentity_t* entity); //RPG-X | Phenix | 13/06/2004
/**
* @brief Spawn function of target_shake.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_shake(/*@shared@*/ gentity_t* entity); //RPG-X | Phenix | 16/11/2004
/**
* @brief Spawn function of target_evosuit.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_evosuit(/*@shared@*/ gentity_t* entity); //RPG-X | Phenix | 16/11/2004
/**
* @brief Spawn function of target_turbolift.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_turbolift(/*@shared@*/ gentity_t* entity); //RPG-X | TiM
/**
* @brief Spawn function of target_doorLock.
*
* @param [in,out] entity If non-null, the entity.
*/
void SP_target_doorLock(/*@shared@*/ gentity_t* entity); //RPG-X | GSIO01 | 08/05/2009
void SP_target_repair(/*@shared@*/ gentity_t* entity); //RPG-X | GSIO01 | 09/05/2009
void SP_target_alert(/*@shared@*/ gentity_t* entity); //RPG-X | GSIO01 | 11/05/2009
void SP_target_warp(/*@shared@*/ gentity_t* entity); //RPG-X | GSIO01 | 19/05/2009
void SP_target_deactivate(/*@shared@*/ gentity_t* entity);
void SP_target_serverchange(/*@shared@*/ gentity_t* entity);
void SP_target_levelchange(/*@shared@*/ gentity_t* entity);
void SP_target_shaderremap(/*@shared@*/ gentity_t* entity);
void SP_target_selfdestruct(/*@shared@*/ gentity_t* entity);
void SP_target_zone(/*@shared@*/ gentity_t* entity);
void SP_target_shiphealth(/*@shared@*/ gentity_t* entity);
void SP_target_sequence(/*@shared@*/ gentity_t* entity);
void SP_light(/*@shared@*/ gentity_t* entity);
void SP_info_null(/*@shared@*/ gentity_t* entity);
void SP_info_notnull(/*@shared@*/ gentity_t* entity);
void SP_info_camp(/*@shared@*/ gentity_t* entity);
void SP_path_corner(/*@shared@*/ gentity_t* entity);
void SP_misc_model(/*@shared@*/ gentity_t* entity);
void SP_misc_model_breakable(/*@shared@*/ gentity_t* entity);
void SP_misc_portal_camera(/*@shared@*/ gentity_t* entity);
void SP_misc_portal_surface(/*@shared@*/ gentity_t* entity);
void SP_misc_turret(/*@shared@*/ gentity_t* entity);
void SP_laser_arm(/*@shared@*/ gentity_t* entity);
void SP_misc_ammo_station(/*@shared@*/ gentity_t* entity);
void SP_shooter_rocket(/*@shared@*/ gentity_t* entity);
void SP_shooter_plasma(/*@shared@*/ gentity_t* entity);
void SP_shooter_grenade(/*@shared@*/ gentity_t* entity);
void SP_shooter_torpedo(/*@shared@*/ gentity_t* entity);
// extra Trek stuff
void SP_fx_spark (/*@shared@*/ gentity_t* entity);
void SP_fx_steam (/*@shared@*/ gentity_t* entity);
void SP_fx_bolt (/*@shared@*/ gentity_t* entity);
void SP_fx_transporter(/*@shared@*/ gentity_t* entity);
void SP_fx_drip(/*@shared@*/ gentity_t* entity);
//RPG-X - TiM: SP ripped visual FX
void SP_fx_fountain(/*@shared@*/ gentity_t* entity);
void SP_fx_surface_explosion(/*@shared@*/ gentity_t* entity);
void SP_fx_blow_chunks(/*@shared@*/ gentity_t* entity);
void SP_fx_smoke(/*@shared@*/ gentity_t* entity);
void SP_fx_electrical_explosion(/*@shared@*/ gentity_t* entity);
//RPG-X | RPG-X | 09/05/2009: additional Trek fx
void SP_fx_phaser(/*@shared@*/ gentity_t* entity);
void SP_fx_torpedo(/*@shared@*/ gentity_t* entity);
//RPG-X | RPG-X | 01/07/2009: additional fx
void SP_fx_particleFire(/*@shared@*/ gentity_t* entity);
void SP_fx_fire(/*@shared@*/ gentity_t* entity);
// Additional ports from SP by Harry Young
void SP_fx_cooking_steam(/*@shared@*/ gentity_t* entity);
void SP_fx_electricfire(/*@shared@*/ gentity_t* entity);
//void SP_fx_forge_bolt( gentity_t *entity );
//void SP_fx_plasma( gentity_t *entity );
//void SP_fx_stream( gentity_t *entity );
//void SP_fx_transporter_stream( gentity_t *entity );
//void SP_fx_explosion_trail( gentity_t *entity );
//void SP_fx_borg_energy_beam( gentity_t *entity );
void SP_fx_shimmery_thing(/*@shared@*/ gentity_t* entity);
void SP_fx_borg_bolt(/*@shared@*/ gentity_t* entity);
// new mover
void SP_func_mover(/*@shared@*/ gentity_t* entity);
void SP_path_point(/*@shared@*/ gentity_t* entity);
// ui entities
void SP_ui_transporter(/*@shared@*/ gentity_t* entity);
void SP_ui_msd(/*@shared@*/ gentity_t* entity);
void SP_ui_holodeck(/*@shared@*/ gentity_t* entity);
// cinematic entities
void SP_cinematic_camera(/*@shared@*/ gentity_t* entity);
/**
* \brief Get a string for a custom entity key.
*
* Spawn string returns a temporary reference, you must copy the string if you want to keep it.
*
* \param[in] key Key to get the value for.
* \param[in] defaultString Default value for this key.
* \param[out] out The result.
* \return Success or fail.
*/
qboolean G_SpawnString( const char* key, const char* defaultString, /*@out@*/ char** out );
/**
* \brief Get a float for a custom entity key.
*
* \param[in] key Key to get the value for.
* \param[in] defaultString Default value for this key.
* \param[out] out The result.
* \return Success or fail.
*/
qboolean G_SpawnFloat( const char* key, const char* defaultString, /*@out@*/ float* out );
/**
* \brief Get a int for a custom entity key.
*
* \param[in] key Key to get the value for.
* \param[in] defaultString Default value for this key.
* \param[out] out The result.
* \return Success or fail.
*/
qboolean G_SpawnInt( const char* key, const char* defaultString, /*@out@*/ int* out );
/**
* \brief Get a vector for a custom entity key.
*
* \param[in] key Key to get the value for.
* \param[in] defaultString Default value for this key.
* \param[out] out The result.
* \return Success or fail.
*/
qboolean G_SpawnVector( const char* key, const char* defaultString, /*@out@*/ float* out );
/**
* \brief Get a vector for a custom entity key.
*
* \param[in] key Key to get the value for.
* \param[in] defaultString Default value for this key.
* \param[out] out The result.
* \return Success or fail.
*/
qboolean G_SpawnVector4( const char* key, const char* defaultString, /*@out@*/ float* out );
/**
* \brief Spawn all entities from the entity string.
*/
void G_SpawnEntitiesFromString( void );
/**
* \brief Calls the spawn function for an entity.
*/
qboolean G_CallSpawn(gentity_t *ent);
#endif /* _G_SPAWN_H */

View file

@ -11,6 +11,7 @@
#include "g_logger.h"
#include "g_lua.h"
#include "g_combat.h"
#include "q_math.h"
#define MAX_BEAM_HITS 4

View file

@ -556,6 +556,7 @@
<ClInclude Include="match.h" />
<ClInclude Include="md5.h" />
<ClInclude Include="memorypool.h" />
<ClInclude Include="q_math.h" />
<ClInclude Include="q_shared.h" />
<ClInclude Include="sqlite3.h" />
<ClInclude Include="surfaceflags.h" />

View file

@ -533,6 +533,9 @@
<ClInclude Include="g_mover.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="q_math.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="game.def">

View file

@ -3,6 +3,8 @@
*
* q_math.c -- stateless support routines that are included in each code module
*/
#include "q_math.h"
#include "q_shared.h"
int32_t nonansicast = 0;
@ -383,8 +385,8 @@ void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point,
zrot[1][0] = -sin( rad );
zrot[1][1] = cos( rad );
MatrixMultiply( m, zrot, tmpmat );
MatrixMultiply( tmpmat, im, rot );
MatrixMultiply((double**)m, (double**)zrot, (double**)tmpmat);
MatrixMultiply((double**)tmpmat, (double**)im, (double**)rot);
for ( i = 0; i < 3; i++ ) {
dst[i] = rot[i][0] * point[0] + rot[i][1] * point[1] + rot[i][2] * point[2];
@ -546,27 +548,28 @@ void VectorRotate( vec3_t in, vec3_t matrix[3], vec3_t out )
* \param number number to calculate the inverse square root for
* \return inverse square root of number
*/
float Q_rsqrt( float number )
double Q_rsqrt( double number )
{
long i;
float x2, y;
const float threehalfs = 1.5F;
int64_t i = 0;
double x2 = 0.0;
double y = 0.0;
const double threehalfs = 1.5;
x2 = number * 0.5F;
y = number;
i = * ( long * ) &y; /* evil floating point bit level hacking */
i = * ( int64_t * ) &y; /* evil floating point bit level hacking */
i = 0x5f3759df - ( i >> 1 ); /* what the fuck? */
y = * ( float * ) &i;
y = * ( double * ) &i;
y = y * ( threehalfs - ( x2 * y * y ) ); /* 1st iteration */
// y = y * ( threehalfs - ( x2 * y * y ) ); /* 2nd iteration, this can be removed */
return y;
}
float Q_fabs( float f ) {
double Q_fabs( double f ) {
int32_t tmp = * ( int32_t * ) &f;
tmp &= 0x7FFFFFFF;
return * ( float * ) &tmp;
return * ( double * ) &tmp;
}
//============================================================
@ -1256,7 +1259,7 @@ int32_t PlaneTypeForNormal (vec3_t normal) {
MatrixMultiply
================
*/
void MatrixMultiply(float in1[3][3], float in2[3][3], float out[3][3]) {
void MatrixMultiply(double** in1, double** in2, double** out) {
out[0][0] = in1[0][0] * in2[0][0] + in1[0][1] * in2[1][0] +
in1[0][2] * in2[2][0];
out[0][1] = in1[0][0] * in2[0][1] + in1[0][1] * in2[1][1] +

23
code/game/q_math.h Normal file
View file

@ -0,0 +1,23 @@
#ifndef _Q_MATH_H
#define Q__MATH_H
#ifdef _MSC_VER
#include <stddef.h>
#include <stdint.h>
#else
#include <stdint.h>
#endif
double Q_fabs(double f);
double Q_rsqrt(double f); // reciprocal square root
#define SQRTFAST( x ) ( 1.0f / Q_rsqrt( x ) )
int32_t Q_rand(int32_t *seed);
double Q_random(int32_t *seed);
double Q_crandom(int32_t *seed);
#endif /* _Q_MATH_H */

View file

@ -509,11 +509,6 @@ extern vec3_t axisDefault[3];
#define IS_NAN(x) (((*(int32_t *)&x)&nanmask)==nanmask)
float Q_fabs( float f );
float Q_rsqrt( float f ); // reciprocal square root
#define SQRTFAST( x ) ( 1.0f / Q_rsqrt( x ) )
signed char ClampChar( int32_t i );
int16_t ClampShort( int32_t i );
@ -595,10 +590,6 @@ void Vector4Scale( const vec4_t in, vec_t scale, vec4_t out );
void VectorRotate( vec3_t in, vec3_t matrix[3], vec3_t out );
int32_t Q_log2(int32_t val);
int32_t Q_rand( int32_t *seed );
double Q_random( int32_t *seed );
double Q_crandom( int32_t *seed );
#define random() ((rand () & 0x7fff) / ((float)0x7fff))
#define crandom() (2.0 * (random() - 0.5))
@ -632,7 +623,7 @@ void MakeNormalVectors( const vec3_t forward, vec3_t right, vec3_t up );
int32_t PlaneTypeForNormal (vec3_t normal);
void MatrixMultiply(float in1[3][3], float in2[3][3], float out[3][3]);
void MatrixMultiply(double** in1, double** in2, double** out);
void AngleVectors( const vec3_t angles, /*@null@*/ /*@out@*/ vec3_t forward, /*@null@*/ /*@out@*/ vec3_t right, /*@null@*/ /*@out@*/ vec3_t up);
void PerpendicularVector( vec3_t dst, const vec3_t src );
void VectorShort(vec3_t vect);

View file

@ -347,7 +347,7 @@ static void UI_PositionEntityOnTag( refEntity_t *entity, const refEntity_t *pare
}
// cast away const because of compiler problems
MatrixMultiply( lerped.axis, ((refEntity_t*)parent)->axis, entity->axis );
MatrixMultiply((double**)lerped.axis, (double**)((refEntity_t*)parent)->axis, (double**)entity->axis);
entity->backlerp = parent->backlerp;
UI_LogFuncEnd();
}
@ -376,8 +376,8 @@ static void UI_PositionRotatedEntityOnTag( refEntity_t *entity, const refEntity_
}
// cast away const because of compiler problems
MatrixMultiply( entity->axis, ((refEntity_t *)parent)->axis, tempAxis );
MatrixMultiply( lerped.axis, tempAxis, entity->axis );
MatrixMultiply((double**)entity->axis, (double**)((refEntity_t *)parent)->axis, (double**)tempAxis);
MatrixMultiply((double**)lerped.axis, (double**)tempAxis, (double**)entity->axis);
UI_LogFuncEnd();
}