game: implement env_fire with TE_FLAME

This commit is contained in:
Denis Pauk 2024-10-24 23:47:40 +03:00
parent d5dad22f8d
commit 2ff7e8e6d0
8 changed files with 68 additions and 2 deletions

View file

@ -345,6 +345,7 @@ set(Game-Source
${GAME_SRC_DIR}/g_ctf.c ${GAME_SRC_DIR}/g_ctf.c
${GAME_SRC_DIR}/g_func.c ${GAME_SRC_DIR}/g_func.c
${GAME_SRC_DIR}/g_items.c ${GAME_SRC_DIR}/g_items.c
${GAME_SRC_DIR}/g_light.c
${GAME_SRC_DIR}/g_main.c ${GAME_SRC_DIR}/g_main.c
${GAME_SRC_DIR}/g_misc.c ${GAME_SRC_DIR}/g_misc.c
${GAME_SRC_DIR}/g_monster.c ${GAME_SRC_DIR}/g_monster.c

View file

@ -955,6 +955,7 @@ GAME_OBJS_ = \
src/game/g_combat.o \ src/game/g_combat.o \
src/game/g_func.o \ src/game/g_func.o \
src/game/g_items.o \ src/game/g_items.o \
src/game/g_light.o \
src/game/g_main.o \ src/game/g_main.o \
src/game/g_misc.o \ src/game/g_misc.o \
src/game/g_monster.o \ src/game/g_monster.o \

View file

@ -2099,6 +2099,7 @@ CL_FlameEffects(vec3_t origin)
count = rand() & 0xF; count = rand() & 0xF;
/* Particles going down */
for(n = 0; n < count; n++) for(n = 0; n < count; n++)
{ {
cparticle_t *p; cparticle_t *p;
@ -2119,7 +2120,7 @@ CL_FlameEffects(vec3_t origin)
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -1.0 / (1 + frandk() * 0.2); p->alphavel = -1.0 / (1 + frandk() * 0.2);
p->color = CL_CombineColors(0xff0b0700, 0xff47477b, p->color = CL_CombineColors(0xff007fef, 0xff003bb7,
(float)(randk() & 15) / 15.0); (float)(randk() & 15) / 15.0);
for (j = 0; j < 3; j++) for (j = 0; j < 3; j++)
@ -2134,6 +2135,7 @@ CL_FlameEffects(vec3_t origin)
count = rand() & 0x7; count = rand() & 0x7;
/* Particles go up */
for (n = 0; n < count; n++) for (n = 0; n < count; n++)
{ {
cparticle_t *p; cparticle_t *p;
@ -2154,7 +2156,7 @@ CL_FlameEffects(vec3_t origin)
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -1.0 / (1 + frandk() * 0.5); p->alphavel = -1.0 / (1 + frandk() * 0.5);
p->color = CL_CombineColors(0xff000000, 0xff2f2f2f, p->color = CL_CombineColors(0xff0000ff, 0xff002f2f,
(float)(randk() & 15) / 15.0); (float)(randk() & 15) / 15.0);
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
{ {

58
src/game/g_light.c Normal file
View file

@ -0,0 +1,58 @@
/*
* Copyright (C) 1997-2001 Id Software, Inc.
* Copyright (c) ZeniMax Media Inc.
*
* 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.
*
* =======================================================================
*
* Custom light effects.
*
* =======================================================================
*/
#include "header/local.h"
void
env_fire_think(edict_t *self)
{
self->nextthink = level.time + FRAMETIME;
gi.WriteByte(svc_temp_entity);
gi.WriteByte(TE_FLAME);
gi.WritePosition(self->s.origin);
gi.multicast(self->s.origin, MULTICAST_PVS);
}
/*
* QUAKED env_fire (.3 .3 1.0) (-8 -8 -8) (8 8 8)
* Flame effect. Does not emit light
*/
void
SP_env_fire(edict_t *self)
{
if (!self)
{
return;
}
self->movetype = MOVETYPE_NONE;
self->solid = SOLID_NOT;
self->think = env_fire_think;
self->nextthink = level.time + FRAMETIME;
gi.linkentity(self);
}

View file

@ -630,6 +630,7 @@ extern void enforcer_sight ( edict_t * self , edict_t * other ) ;
extern void enforcer_sight ( edict_t * self , edict_t *other ); extern void enforcer_sight ( edict_t * self , edict_t *other );
extern void enforcer_stand ( edict_t * self ) ; extern void enforcer_stand ( edict_t * self ) ;
extern void enforcer_walk ( edict_t * self ) ; extern void enforcer_walk ( edict_t * self ) ;
extern void env_fire_think ( edict_t * self ) ;
extern void fd_secret_done ( edict_t * self ) ; extern void fd_secret_done ( edict_t * self ) ;
extern void fd_secret_killed ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void fd_secret_killed ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ;
extern void fd_secret_move1 ( edict_t * self ) ; extern void fd_secret_move1 ( edict_t * self ) ;

View file

@ -589,6 +589,7 @@
{"enforcer_sight", (byte *)enforcer_sight}, {"enforcer_sight", (byte *)enforcer_sight},
{"enforcer_stand", (byte *)enforcer_stand}, {"enforcer_stand", (byte *)enforcer_stand},
{"enforcer_walk", (byte *)enforcer_walk}, {"enforcer_walk", (byte *)enforcer_walk},
{"env_fire_think", (byte *)env_fire_think},
{"face_wall", (byte *)face_wall}, {"face_wall", (byte *)face_wall},
{"fd_secret_done", (byte *)fd_secret_done}, {"fd_secret_done", (byte *)fd_secret_done},
{"fd_secret_killed", (byte *)fd_secret_killed}, {"fd_secret_killed", (byte *)fd_secret_killed},

View file

@ -36,6 +36,7 @@ extern void SP_dm_dball_speed_change(edict_t * self);
extern void SP_dm_dball_team1_start(edict_t * self); extern void SP_dm_dball_team1_start(edict_t * self);
extern void SP_dm_dball_team2_start(edict_t * self); extern void SP_dm_dball_team2_start(edict_t * self);
extern void SP_dm_tag_token(edict_t * self); extern void SP_dm_tag_token(edict_t * self);
extern void SP_env_fire ( edict_t * ent ) ;
extern void SP_func_areaportal ( edict_t * ent ) ; extern void SP_func_areaportal ( edict_t * ent ) ;
extern void SP_func_button ( edict_t * ent ) ; extern void SP_func_button ( edict_t * ent ) ;
extern void SP_func_clock(edict_t * self); extern void SP_func_clock(edict_t * self);

View file

@ -35,6 +35,7 @@
{"dm_dball_team1_start", SP_dm_dball_team1_start}, {"dm_dball_team1_start", SP_dm_dball_team1_start},
{"dm_dball_team2_start", SP_dm_dball_team2_start}, {"dm_dball_team2_start", SP_dm_dball_team2_start},
{"dm_tag_token", SP_dm_tag_token}, {"dm_tag_token", SP_dm_tag_token},
{"env_fire", SP_env_fire},
{"func_areaportal", SP_func_areaportal}, {"func_areaportal", SP_func_areaportal},
{"func_button", SP_func_button}, {"func_button", SP_func_button},
{"func_clock", SP_func_clock}, {"func_clock", SP_func_clock},