nuclide/src/gs-entbase/client/baseentity.cpp

86 lines
2 KiB
C++
Raw Normal View History

/*
* Copyright (c) 2016-2019 Marco Hladik <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
2019-03-13 20:56:43 +00:00
string __fullspawndata;
class CBaseEntity
{
2019-03-13 20:56:43 +00:00
string targetname;
string target;
2019-03-13 20:56:43 +00:00
void() CBaseEntity;
virtual void() Init;
virtual void() Initialized;
2019-03-13 20:56:43 +00:00
virtual void(string, string) SpawnKey;
};
void CBaseEntity::SpawnKey(string strField, string strKey)
{
switch (strField) {
2019-03-13 20:56:43 +00:00
case "targetname":
targetname = strKey;
break;
case "target":
target = strKey;
break;
case "origin":
origin = stov(strKey);
setorigin(this, origin);
2019-03-13 20:56:43 +00:00
break;
case "angles":
angles = stov(strKey);
2019-03-13 20:56:43 +00:00
break;
case "model":
model = strKey;
break;
case "style":
style = stof(strKey);
2019-03-13 20:56:43 +00:00
break;
case "color":
color = stov(strKey);
2019-03-13 20:56:43 +00:00
break;
case "movetype":
movetype = stof(strKey);
2019-03-13 20:56:43 +00:00
break;
case "solid":
solid = stof(strKey);
2019-03-13 20:56:43 +00:00
break;
case "scale":
scale = stof(strKey);
2019-03-13 20:56:43 +00:00
break;
default:
//dprint(sprintf("Unknown field %s, value %s\n", strField, strKey));
}
}
void CBaseEntity::Init(void)
{
for (int i = 0; i < (tokenize(__fullspawndata) - 1); i += 2) {
//dprint(sprintf("SpawnData: %s %s\n", argv(i), argv(i+1)));
SpawnKey(argv(i), argv(i+1));
}
Initialized();
}
void CBaseEntity::Initialized(void)
{
2019-03-13 20:56:43 +00:00
}
void CBaseEntity::CBaseEntity(void)
{
}