MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / DoFrame

Method DoFrame

scripts/aigame4.cpp:790–1081  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

788}
789
790void MercEndBoss::DoFrame(int me) {
791 float frame;
792 float shields;
793
794 Obj_Value(me, VF_GET, OBJV_F_ANIM_FRAME, &frame);
795 Obj_Value(memory->turret_object, VF_GET, OBJV_F_SHIELDS, &shields);
796
797 if (memory->mode == MERCENDBOSS_MATTER || memory->mode == MERCENDBOSS_ENERGY) {
798 int target;
799 int type;
800 AI_Value(me, VF_GET, AIV_I_TARGET_HANDLE, &target);
801 Obj_Value(target, VF_GET, OBJV_I_TYPE, &type);
802 int flags = 0;
803
804 if (type == OBJ_PLAYER) {
805 Player_Value(target, VF_GET, PLYV_I_FLAGS, &flags);
806 }
807
808 if (type == OBJ_PLAYER && (flags & PLAYER_FLAGS_DEAD)) {
809 memory->f_target_ghost = true;
810 memory->time_till_fire = 3.0f;
811
812 int flags = DWBF_ENABLED;
813 Obj_WBValue(me, 0, VF_CLEAR_FLAGS, WBV_I_DYNAMIC_FLAGS, &flags);
814 Obj_WBValue(me, 4, VF_CLEAR_FLAGS, WBV_I_DYNAMIC_FLAGS, &flags);
815 Obj_WBValue(memory->turret_object, 0, VF_CLEAR_FLAGS, WBV_I_DYNAMIC_FLAGS, &flags);
816 Obj_WBValue(memory->turret_object, 1, VF_CLEAR_FLAGS, WBV_I_DYNAMIC_FLAGS, &flags);
817 } else if (memory->f_target_ghost) {
818 memory->time_till_fire -= Game_GetFrameTime();
819 if (memory->time_till_fire <= 0.0f) {
820 memory->time_till_fire = 0.0f;
821 memory->f_target_ghost = false;
822
823 int flags = DWBF_ENABLED;
824 Obj_WBValue(me, 0, VF_SET_FLAGS, WBV_I_DYNAMIC_FLAGS, &flags);
825 Obj_WBValue(me, 4, VF_SET_FLAGS, WBV_I_DYNAMIC_FLAGS, &flags);
826 Obj_WBValue(memory->turret_object, 0, VF_SET_FLAGS, WBV_I_DYNAMIC_FLAGS, &flags);
827 Obj_WBValue(memory->turret_object, 1, VF_SET_FLAGS, WBV_I_DYNAMIC_FLAGS, &flags);
828 }
829 }
830 } else if (memory->f_target_ghost) {
831 memory->time_till_fire = 0.0f;
832 memory->f_target_ghost = false;
833
834 int flags = DWBF_ENABLED;
835 Obj_WBValue(me, 0, VF_SET_FLAGS, WBV_I_DYNAMIC_FLAGS, &flags);
836 Obj_WBValue(me, 4, VF_SET_FLAGS, WBV_I_DYNAMIC_FLAGS, &flags);
837 Obj_WBValue(memory->turret_object, 0, VF_SET_FLAGS, WBV_I_DYNAMIC_FLAGS, &flags);
838 Obj_WBValue(memory->turret_object, 1, VF_SET_FLAGS, WBV_I_DYNAMIC_FLAGS, &flags);
839 }
840
841 if (memory->mode == MERCENDBOSS_WAIT) {
842 } else if (memory->mode == MERCENDBOSS_INTRO) {
843 if (memory->mode_time > 4.0f && memory->mode_time < 9.0f) {
844 if (!memory->f_oriented) {
845 int flags = AISR_RANGED_ATTACK;
846 AI_Value(me, VF_SET_FLAGS, AIV_I_STATUS_REG, &flags);
847 } else {

Callers

nothing calls this directly

Calls 9

Obj_ValueFunction · 0.85
Player_ValueFunction · 0.85
Obj_WBValueFunction · 0.85
Game_CreateRandomSparksFunction · 0.85
Sound_Play3dFunction · 0.85
Obj_BurningFunction · 0.85
aShowHUDMessageFunction · 0.85
aLightningCreateFunction · 0.85
Obj_CreateFunction · 0.85

Tested by

no test coverage detected