game: Add target_sky and target_music

Based on code https://github.com/id-Software/quake2-rerelease-dll.git

Required to stop sky rotation.
This commit is contained in:
Denis Pauk 2023-10-23 00:18:30 +03:00
parent 91ffbeea08
commit d8b8a78d37
4 changed files with 79 additions and 0 deletions

View file

@ -93,6 +93,8 @@ void SP_target_laser(edict_t *self);
void SP_target_help(edict_t *ent); void SP_target_help(edict_t *ent);
void SP_target_lightramp(edict_t *self); void SP_target_lightramp(edict_t *self);
void SP_target_earthquake(edict_t *ent); void SP_target_earthquake(edict_t *ent);
void SP_target_music(edict_t *ent);
void SP_target_sky(edict_t *ent);
void SP_target_character(edict_t *ent); void SP_target_character(edict_t *ent);
void SP_target_string(edict_t *ent); void SP_target_string(edict_t *ent);
@ -269,6 +271,8 @@ static spawn_t spawns[] = {
{"target_help", SP_target_help}, {"target_help", SP_target_help},
{"target_lightramp", SP_target_lightramp}, {"target_lightramp", SP_target_lightramp},
{"target_earthquake", SP_target_earthquake}, {"target_earthquake", SP_target_earthquake},
{"target_music", SP_target_music},
{"target_sky", SP_target_sky},
{"target_character", SP_target_character}, {"target_character", SP_target_character},
{"target_string", SP_target_string}, {"target_string", SP_target_string},
{"target_mal_laser", SP_target_mal_laser}, {"target_mal_laser", SP_target_mal_laser},

View file

@ -1423,3 +1423,70 @@ SP_target_earthquake(edict_t *self)
self->noise_index = gi.soundindex("world/quake.wav"); self->noise_index = gi.soundindex("world/quake.wav");
} }
} }
void
target_music_use(edict_t *self, edict_t *other, edict_t *activator)
{
if (!self)
{
return;
}
gi.configstring(CS_CDTRACK, va("%i", self->sounds));
}
void
SP_target_music(edict_t* self)
{
if (!self)
{
return;
}
self->use = target_music_use;
}
void
target_sky_use(edict_t *self, edict_t *other, edict_t *activator)
{
float rotate;
int32_t autorotate;
if (!self)
{
return;
}
if (self->map && self->map[0])
{
gi.configstring(CS_SKY, self->map);
}
rotate = self->accel;
autorotate = self->style;
gi.configstring(CS_SKYROTATE, va("%f %d", rotate, autorotate));
gi.configstring(CS_SKYAXIS, va("%f %f %f",
self->movedir[0], self->movedir[1], self->movedir[2]));
}
void
SP_target_sky(edict_t* self)
{
if (!self)
{
return;
}
self->use = target_sky_use;
if (st.sky && st.sky[0])
{
self->map = st.sky;
}
VectorCopy(st.skyaxis, self->movedir);
self->accel = st.skyrotate;
self->style = st.skyautorotate;
}

View file

@ -1120,6 +1120,10 @@ extern void InitTrigger ( edict_t * self ) ;
extern void SP_target_earthquake ( edict_t * self ) ; extern void SP_target_earthquake ( edict_t * self ) ;
extern void target_earthquake_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void target_earthquake_use ( edict_t * self , edict_t * other , edict_t * activator ) ;
extern void target_earthquake_think ( edict_t * self ) ; extern void target_earthquake_think ( edict_t * self ) ;
extern void SP_target_sky ( edict_t * self ) ;
extern void target_sky_use ( edict_t * self , edict_t * other , edict_t * activator ) ;
extern void SP_target_music ( edict_t * self ) ;
extern void target_music_use ( edict_t * self , edict_t * other , edict_t * activator ) ;
extern void SP_target_lightramp ( edict_t * self ) ; extern void SP_target_lightramp ( edict_t * self ) ;
extern void target_lightramp_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void target_lightramp_use ( edict_t * self , edict_t * other , edict_t * activator ) ;
extern void target_lightramp_think ( edict_t * self ) ; extern void target_lightramp_think ( edict_t * self ) ;

View file

@ -1122,6 +1122,10 @@
{"SP_target_earthquake", (byte *)SP_target_earthquake}, {"SP_target_earthquake", (byte *)SP_target_earthquake},
{"target_earthquake_use", (byte *)target_earthquake_use}, {"target_earthquake_use", (byte *)target_earthquake_use},
{"target_earthquake_think", (byte *)target_earthquake_think}, {"target_earthquake_think", (byte *)target_earthquake_think},
{"SP_target_music", (byte *)SP_target_music},
{"target_music_use", (byte *)target_music_use},
{"SP_target_sky", (byte *)SP_target_sky},
{"target_sky_use", (byte *)target_sky_use},
{"SP_target_lightramp", (byte *)SP_target_lightramp}, {"SP_target_lightramp", (byte *)SP_target_lightramp},
{"target_lightramp_use", (byte *)target_lightramp_use}, {"target_lightramp_use", (byte *)target_lightramp_use},
{"target_lightramp_think", (byte *)target_lightramp_think}, {"target_lightramp_think", (byte *)target_lightramp_think},