1 #ifndef ENT_CHALLENGE_C
2 #define ENT_CHALLENGE_C
5 #include "world_load.h"
8 VG_STATIC
void ent_challenge_pass( world_instance
*world
,
9 ent_challenge
*challenge
){
10 if( challenge
->id_next
){
11 world
->challenge_timer
+= challenge
->filter
;
13 u32 index
= mdl_entity_id_id( challenge
->id_next
);
14 ent_challenge
*next
= mdl_arritm( &world
->ent_challenge
, index
);
15 world
->challenge_target
= next
;
17 vg_info( "pass challenge point\n" );
20 vg_success( "NYU Film school graduate SUCKAH\n" );
21 world
->challenge_target
= NULL
;
22 world
->challenge_timer
= 0.0f
;
24 if( challenge
->id_win
){
27 call
.function
= challenge
->win_event
;
28 call
.id
= challenge
->id_win
;
29 entity_call( world
, &call
);
34 VG_STATIC
void ent_challenge_call( world_instance
*world
, ent_call
*call
){
35 u32 index
= mdl_entity_id_id( call
->id
);
36 ent_challenge
*challenge
= mdl_arritm( &world
->ent_challenge
, index
);
38 if( call
->function
== 0 ){
39 if( world
->challenge_target
){
40 if( world
->challenge_target
== challenge
){
41 ent_challenge_pass( world
, challenge
);
44 vg_error( "womp womp\n" );
45 world
->challenge_target
= NULL
;
46 world
->challenge_timer
= 0.0f
;
50 else if( call
->function
== 1 ){
51 vg_info( "begin the challenge\n" );
52 world
->challenge_timer
= 0.0f
;
53 ent_challenge_pass( world
, challenge
);
57 vg_error( "Unhandled function id: %u\n", call
->function
);
61 #endif /* ENT_CHALLENGE_C */