mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-05-10 12:36:38 +03:00
Replaced calls to SpawnTempModel by calls to SpawnEffect call
Set m_spawnthing to m_localemitter if the current SFX is null
This commit is contained in:
parent
7c2cdd52b0
commit
3e657679a0
1 changed files with 62 additions and 52 deletions
|
@ -2714,20 +2714,19 @@ spawnthing_t *ClientGameCommandManager::CreateNewEmitter(void)
|
||||||
//===============
|
//===============
|
||||||
void ClientGameCommandManager::BeginOriginSpawn(Event *ev)
|
void ClientGameCommandManager::BeginOriginSpawn(Event *ev)
|
||||||
{
|
{
|
||||||
// FIXME: partially implemented
|
|
||||||
|
|
||||||
if (!current_entity) {
|
if (!current_entity) {
|
||||||
|
m_spawnthing = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!m_pCurrentSfx) {
|
||||||
|
m_spawnthing = &m_localemitter;
|
||||||
|
}
|
||||||
|
InitializeSpawnthing(m_spawnthing);
|
||||||
|
|
||||||
// Setup ending function
|
// Setup ending function
|
||||||
endblockfcn = &ClientGameCommandManager::EndOriginSpawn;
|
endblockfcn = &ClientGameCommandManager::EndOriginSpawn;
|
||||||
|
|
||||||
if (!m_pCurrentSfx) {
|
|
||||||
// Init the thing we are going to spawn
|
|
||||||
m_spawnthing = InitializeSpawnthing(&m_localemitter);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the origin based on the entity's origin
|
// Set the origin based on the entity's origin
|
||||||
m_spawnthing->cgd.origin = current_entity->origin;
|
m_spawnthing->cgd.origin = current_entity->origin;
|
||||||
|
|
||||||
|
@ -2742,8 +2741,9 @@ void ClientGameCommandManager::BeginOriginSpawn(Event *ev)
|
||||||
//===============
|
//===============
|
||||||
void ClientGameCommandManager::EndOriginSpawn(void)
|
void ClientGameCommandManager::EndOriginSpawn(void)
|
||||||
{
|
{
|
||||||
// Okay we should have a valid spawnthing, let's create a render entity
|
if (m_spawnthing) {
|
||||||
SpawnTempModel(m_spawnthing->count);
|
SpawnEffect(m_spawnthing->count, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientGameCommandManager::TestEffectEndFunc()
|
void ClientGameCommandManager::TestEffectEndFunc()
|
||||||
|
@ -2780,6 +2780,11 @@ void ClientGameCommandManager::BeginTagEmitter(Event *ev)
|
||||||
str tagname;
|
str tagname;
|
||||||
int tagnum;
|
int tagnum;
|
||||||
|
|
||||||
|
if (current_entity) {
|
||||||
|
m_spawnthing = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Get the tagname and orientation
|
// Get the tagname and orientation
|
||||||
tagname = ev->GetString(1);
|
tagname = ev->GetString(1);
|
||||||
|
|
||||||
|
@ -2825,15 +2830,16 @@ void ClientGameCommandManager::EndTagEmitter(void)
|
||||||
//===============
|
//===============
|
||||||
void ClientGameCommandManager::BeginTagBeamEmitter(Event *ev)
|
void ClientGameCommandManager::BeginTagBeamEmitter(Event *ev)
|
||||||
{
|
{
|
||||||
|
if (current_entity) {
|
||||||
|
m_spawnthing = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Setup ending function
|
// Setup ending function
|
||||||
endblockfcn = &ClientGameCommandManager::EndTagBeamEmitter;
|
endblockfcn = &ClientGameCommandManager::EndTagBeamEmitter;
|
||||||
|
|
||||||
// Init the emitter
|
// Init the emitter
|
||||||
m_spawnthing = CreateNewEmitter();
|
m_spawnthing = CreateNewEmitter();
|
||||||
if (!m_spawnthing) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_spawnthing->cgd.flags |= T_BEAMTHING;
|
m_spawnthing->cgd.flags |= T_BEAMTHING;
|
||||||
|
|
||||||
// Get the tagname and orientation
|
// Get the tagname and orientation
|
||||||
|
@ -2869,14 +2875,16 @@ void ClientGameCommandManager::EndTagBeamEmitter(void)
|
||||||
//===============
|
//===============
|
||||||
void ClientGameCommandManager::BeginOriginEmitter(Event *ev)
|
void ClientGameCommandManager::BeginOriginEmitter(Event *ev)
|
||||||
{
|
{
|
||||||
|
if (current_entity) {
|
||||||
|
m_spawnthing = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Setup ending function
|
// Setup ending function
|
||||||
endblockfcn = &ClientGameCommandManager::EndOriginEmitter;
|
endblockfcn = &ClientGameCommandManager::EndOriginEmitter;
|
||||||
|
|
||||||
// Init the emitter
|
// Init the emitter
|
||||||
m_spawnthing = CreateNewEmitter();
|
m_spawnthing = CreateNewEmitter();
|
||||||
if (!m_spawnthing) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the emitter's name
|
// Get the emitter's name
|
||||||
m_spawnthing->emittername = ev->GetString(1);
|
m_spawnthing->emittername = ev->GetString(1);
|
||||||
|
@ -2905,15 +2913,16 @@ void ClientGameCommandManager::EndOriginEmitter(void)
|
||||||
//===============
|
//===============
|
||||||
void ClientGameCommandManager::BeginOriginBeamEmitter(Event *ev)
|
void ClientGameCommandManager::BeginOriginBeamEmitter(Event *ev)
|
||||||
{
|
{
|
||||||
// Setup ending function
|
|
||||||
endblockfcn = &ClientGameCommandManager::EndOriginBeamEmitter;
|
|
||||||
|
|
||||||
// Init the emitter
|
// Init the emitter
|
||||||
m_spawnthing = CreateNewEmitter();
|
if (current_entity) {
|
||||||
if (!m_spawnthing) {
|
m_spawnthing = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Setup ending function
|
||||||
|
endblockfcn = &ClientGameCommandManager::EndOriginBeamEmitter;
|
||||||
|
|
||||||
|
m_spawnthing = CreateNewEmitter();
|
||||||
// Get the emitter's name
|
// Get the emitter's name
|
||||||
m_spawnthing->emittername = ev->GetString(1);
|
m_spawnthing->emittername = ev->GetString(1);
|
||||||
|
|
||||||
|
@ -2980,14 +2989,6 @@ void ClientGameCommandManager::BeginTagSpawn(Event *ev)
|
||||||
str tagname;
|
str tagname;
|
||||||
int tagnum;
|
int tagnum;
|
||||||
|
|
||||||
// Setup ending function
|
|
||||||
endblockfcn = &ClientGameCommandManager::EndTagSpawn;
|
|
||||||
|
|
||||||
if (!m_pCurrentSfx) {
|
|
||||||
// Init the thing we are going to spawn
|
|
||||||
m_spawnthing = InitializeSpawnthing(&m_localemitter);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the tagname and orientation
|
// Get the tagname and orientation
|
||||||
tagname = ev->GetString(1);
|
tagname = ev->GetString(1);
|
||||||
tagnum = cgi.Tag_NumForName(current_tiki, tagname.c_str());
|
tagnum = cgi.Tag_NumForName(current_tiki, tagname.c_str());
|
||||||
|
@ -2995,6 +2996,15 @@ void ClientGameCommandManager::BeginTagSpawn(Event *ev)
|
||||||
throw ScriptException("Tagname '%s' does not exist", tagname.c_str());
|
throw ScriptException("Tagname '%s' does not exist", tagname.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Setup ending function
|
||||||
|
endblockfcn = &ClientGameCommandManager::EndTagSpawn;
|
||||||
|
|
||||||
|
if (!m_pCurrentSfx) {
|
||||||
|
// Init the thing we are going to spawn
|
||||||
|
m_spawnthing = &m_localemitter;
|
||||||
|
}
|
||||||
|
InitializeSpawnthing(m_spawnthing);
|
||||||
|
|
||||||
GetOrientation(tagnum, m_spawnthing);
|
GetOrientation(tagnum, m_spawnthing);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3004,7 +3014,7 @@ void ClientGameCommandManager::BeginTagSpawn(Event *ev)
|
||||||
void ClientGameCommandManager::EndTagSpawn(void)
|
void ClientGameCommandManager::EndTagSpawn(void)
|
||||||
{
|
{
|
||||||
// Okay we should have a valid spawnthing, let's create a render entity
|
// Okay we should have a valid spawnthing, let's create a render entity
|
||||||
SpawnTempModel(m_spawnthing->count);
|
SpawnEffect(m_spawnthing->count, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===============
|
//===============
|
||||||
|
@ -3015,14 +3025,6 @@ void ClientGameCommandManager::BeginTagBeamSpawn(Event *ev)
|
||||||
str tagname;
|
str tagname;
|
||||||
int tagnum;
|
int tagnum;
|
||||||
|
|
||||||
// Setup ending function
|
|
||||||
endblockfcn = &ClientGameCommandManager::EndTagBeamSpawn;
|
|
||||||
|
|
||||||
if (!m_pCurrentSfx) {
|
|
||||||
// Init the thing we are going to spawn
|
|
||||||
m_spawnthing = InitializeSpawnthing(&m_localemitter);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the tagname and orientation
|
// Get the tagname and orientation
|
||||||
tagname = ev->GetString(1);
|
tagname = ev->GetString(1);
|
||||||
tagnum = cgi.Tag_NumForName(current_tiki, tagname.c_str());
|
tagnum = cgi.Tag_NumForName(current_tiki, tagname.c_str());
|
||||||
|
@ -3030,6 +3032,15 @@ void ClientGameCommandManager::BeginTagBeamSpawn(Event *ev)
|
||||||
throw ScriptException("Tagname '%s' does not exist", tagname.c_str());
|
throw ScriptException("Tagname '%s' does not exist", tagname.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Setup ending function
|
||||||
|
endblockfcn = &ClientGameCommandManager::EndTagBeamSpawn;
|
||||||
|
|
||||||
|
if (!m_pCurrentSfx) {
|
||||||
|
// Init the thing we are going to spawn
|
||||||
|
m_spawnthing = &m_localemitter;
|
||||||
|
}
|
||||||
|
InitializeSpawnthing(m_spawnthing);
|
||||||
|
|
||||||
GetOrientation(tagnum, m_spawnthing);
|
GetOrientation(tagnum, m_spawnthing);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3116,11 +3127,11 @@ void ClientGameCommandManager::EndTagBeamSpawn(void)
|
||||||
//===============
|
//===============
|
||||||
void ClientGameCommandManager::BeginOriginBeamSpawn(Event *ev)
|
void ClientGameCommandManager::BeginOriginBeamSpawn(Event *ev)
|
||||||
{
|
{
|
||||||
// Init the emitter
|
if (!m_pCurrentSfx) {
|
||||||
m_spawnthing = CreateNewEmitter();
|
m_spawnthing = &m_localemitter;
|
||||||
if (!m_spawnthing) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
// Init the emitter
|
||||||
|
InitializeSpawnthing(m_spawnthing);
|
||||||
|
|
||||||
// Set the origin based on the entity's origin
|
// Set the origin based on the entity's origin
|
||||||
m_spawnthing->cgd.origin = current_entity->origin;
|
m_spawnthing->cgd.origin = current_entity->origin;
|
||||||
|
@ -3896,8 +3907,9 @@ void ClientGameCommandManager::TagDynamicLight(Event *ev)
|
||||||
|
|
||||||
if (!m_pCurrentSfx) {
|
if (!m_pCurrentSfx) {
|
||||||
// Spawn a single tempmodel that is a dynamic light
|
// Spawn a single tempmodel that is a dynamic light
|
||||||
m_spawnthing = InitializeSpawnthing(&m_localemitter);
|
m_spawnthing = &m_localemitter;
|
||||||
}
|
}
|
||||||
|
InitializeSpawnthing(m_spawnthing);
|
||||||
|
|
||||||
tagname = ev->GetString(1);
|
tagname = ev->GetString(1);
|
||||||
tagnum = cgi.Tag_NumForName(current_tiki, tagname.c_str());
|
tagnum = cgi.Tag_NumForName(current_tiki, tagname.c_str());
|
||||||
|
@ -3922,7 +3934,7 @@ void ClientGameCommandManager::TagDynamicLight(Event *ev)
|
||||||
} else {
|
} else {
|
||||||
m_spawnthing->cgd.lightType = 0;
|
m_spawnthing->cgd.lightType = 0;
|
||||||
}
|
}
|
||||||
SpawnTempModel(1, m_spawnthing);
|
SpawnEffect(1, m_spawnthing);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===============
|
//===============
|
||||||
|
@ -3933,17 +3945,15 @@ void ClientGameCommandManager::OriginDynamicLight(Event *ev)
|
||||||
str tagname;
|
str tagname;
|
||||||
|
|
||||||
if (!current_entity) {
|
if (!current_entity) {
|
||||||
cgi.DPrintf(
|
m_spawnthing = NULL;
|
||||||
"ClientGameCommandManager::OriginDynamicLight : Illegal "
|
|
||||||
"use of \"origindlight\"\n"
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_pCurrentSfx) {
|
if (!m_pCurrentSfx) {
|
||||||
// Spawn a single tempmodel that is a dynamic light
|
// Spawn a single tempmodel that is a dynamic light
|
||||||
m_spawnthing = InitializeSpawnthing(&m_localemitter);
|
m_spawnthing = &m_localemitter;
|
||||||
}
|
}
|
||||||
|
InitializeSpawnthing(m_spawnthing);
|
||||||
|
|
||||||
m_spawnthing->cgd.origin = current_entity->origin;
|
m_spawnthing->cgd.origin = current_entity->origin;
|
||||||
m_spawnthing->cgd.flags |= T_DLIGHT;
|
m_spawnthing->cgd.flags |= T_DLIGHT;
|
||||||
|
@ -3961,7 +3971,7 @@ void ClientGameCommandManager::OriginDynamicLight(Event *ev)
|
||||||
} else {
|
} else {
|
||||||
m_spawnthing->cgd.lightType = 0;
|
m_spawnthing->cgd.lightType = 0;
|
||||||
}
|
}
|
||||||
SpawnTempModel(1, m_spawnthing);
|
SpawnEffect(1, m_spawnthing);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===============
|
//===============
|
||||||
|
@ -5131,7 +5141,7 @@ void CG_Emitter(centity_t *cent)
|
||||||
dtime = cg.time - et->last_emit_time;
|
dtime = cg.time - et->last_emit_time;
|
||||||
while (dtime > emitter->spawnRate) {
|
while (dtime > emitter->spawnRate) {
|
||||||
dtime -= emitter->spawnRate;
|
dtime -= emitter->spawnRate;
|
||||||
commandManager.SpawnTempModel(1, emitter);
|
commandManager.SpawnEffect(1, emitter);
|
||||||
et->last_emit_time = cg.time;
|
et->last_emit_time = cg.time;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5174,7 +5184,7 @@ void ClientGameCommandManager::CGEvent(centity_t *cent)
|
||||||
ev->AddString("idle");
|
ev->AddString("idle");
|
||||||
ProcessEvent(ev);
|
ProcessEvent(ev);
|
||||||
|
|
||||||
SpawnTempModel(1);
|
SpawnEffect(1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean ClientGameCommandManager::SelectProcessEvent(Event *ev)
|
qboolean ClientGameCommandManager::SelectProcessEvent(Event *ev)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue