nuclide/Source/gs-entbase/client/sprite.cpp
Marco Hladik 9ce909e291 - Added Rewolf decore_* entities from the demo
- Added early Rewolf Health/Armor HUD variants
- Added original scoreboard from the early Half-Life versions for valve/scihunt/rewolf
- Fixed some skybox behaviour to only apply to BSP30
- Changed the env_message and game_text display to use "creditsfont" instead of the conchars
- Tweaked damage radius and prediction for some entities and weapons
- Added world_items
- Added item_healthkit
- Added item_battery
- Fixed level transition logic
- impulse 101 now fills up health and armor/suit in mod valve
- Some tweaks to Damage_Apply so that healing can be performed without funky visuals
- Added stub monsters for valve/rewolf that'll soon support scripted sequences
- Tweaked chat system to get rid of quotation marks around messages
- Added support for changing the window caption to reflect the mod you're playing
- Lots of small little things in terms of cleanup
2019-03-19 20:01:24 +01:00

74 lines
1.5 KiB
C++

/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
class sprite
{
float framerate;
int loops;
int maxframe;
virtual void() think;
};
void sprite::think(void)
{
if (frame >= (maxframe-1)) {
if (loops == 0) {
remove(this);
} else {
frame = 0;
}
} else {
frame += 1;
}
nextthink = time + (1 / framerate);
}
void Sprite_Animated(void)
{
spawnfunc_sprite();
sprite me = (sprite)self;
me.origin[0] = readcoord();
me.origin[1] = readcoord();
me.origin[2] = readcoord();
me.modelindex = readfloat();
me.framerate = readfloat();
me.scale = readfloat();
me.alpha = readfloat();
me.effects = readfloat();
me.colormod[0] = readfloat();
me.colormod[1] = readfloat();
me.colormod[2] = readfloat();
me.drawmask = MASK_ENGINE;
me.nextthink = time + (1 / me.framerate);
me.maxframe = modelframecount(me.modelindex);
me.loops = 1; /* repeats */
setorigin(me, me.origin);
}
void Sprite_ParseEvent(void)
{
sprite spr = spawn(sprite);
spr.origin[0] = readcoord();
spr.origin[1] = readcoord();
spr.origin[2] = readcoord();
spr.modelindex = readfloat();
spr.framerate = readfloat();
spr.scale = readfloat();
spr.alpha = readfloat();
spr.effects = readfloat();
spr.colormod[0] = readfloat();
spr.colormod[1] = readfloat();
spr.colormod[2] = readfloat();
spr.drawmask = MASK_ENGINE;
spr.nextthink = time + (1 / spr.framerate);
spr.maxframe = modelframecount(spr.modelindex);
spr.loops = 0; /* does not repeat */
setorigin(spr, spr.origin);
}