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

Method DoInit

scripts/aigame4.cpp:693–751  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

691}
692
693void MercEndBoss::DoInit(int me) {
694 tOSIRISMEMCHUNK ch;
695 ch.id = 4;
696 ch.size = sizeof(mercendboss_data);
697 ch.my_id.type = OBJECT_SCRIPT;
698 ch.my_id.objhandle = me;
699 int i;
700
701 memory = (mercendboss_data *)Scrpt_MemAlloc(&ch);
702 memory->flags = 0;
703 memory->mode = MERCENDBOSS_WAIT;
704
705 memory->turret_object = CreateAndAttach(me, "FinalbossBIGGUN", OBJ_BUILDING, 0, 0, true, true);
706
707 int proom;
708 vector ppos;
709 matrix porient;
710 msafe_struct mstruct;
711
712 Obj_Value(me, VF_GET, OBJV_I_ROOMNUM, &proom);
713 Obj_Value(me, VF_GET, OBJV_V_POS, &ppos);
714 Obj_Value(me, VF_GET, OBJV_M_ORIENT, &porient);
715
716 memory->wallhit_id = Obj_FindID("Finalbosswallhit");
717
718 memory->combine_object = Obj_Create(OBJ_POWERUP, Obj_FindID("FinalbossBEAMCOMBINE"), proom, &ppos, &porient, me);
719 mprintf(0, "OBJECT COMB is %d\n", memory->combine_object);
720 aObjGhostSet(1, memory->combine_object);
721
722 memory->camera = Obj_Create(OBJ_POWERUP, Obj_FindID("Invisiblepowerup"), proom, &ppos, &porient, me);
723 mstruct.objhandle = memory->camera;
724 MSafe_CallFunction(MSAFE_OBJECT_NO_RENDER, &mstruct);
725
726 for (i = 0; i < 2; i++) {
727 if (i == 0)
728 memory->emitter[i] = CreateAndAttach(me, "Finalbossemitter", OBJ_BUILDING, 1 + i, 0, true, true);
729 else
730 memory->emitter[i] = CreateAndAttach(me, "Finalbossemitterleft", OBJ_BUILDING, 1 + i, 0, true, true);
731
732 aObjGhostSet(1, memory->emitter[i]);
733 }
734
735 memory->laser_sound = -1;
736 memory->last_frame = 0.0f;
737 memory->laser_time_left = 0.0f;
738
739 memory->f_oriented = false;
740
741 memory->f_target_ghost = false;
742 memory->time_till_fire = 0.0f;
743
744 int flags = AIF_DETERMINE_TARGET;
745 AI_Value(me, VF_CLEAR_FLAGS, AIV_I_FLAGS, &flags);
746
747 memory->last_spark_time = Game_GetTime();
748 memory->time_to_next_random_sound = 0.0f;
749
750 SetMode(me, MERCENDBOSS_WAIT);

Callers

nothing calls this directly

Calls 4

Obj_ValueFunction · 0.85
Obj_CreateFunction · 0.85
aObjGhostSetFunction · 0.85
CreateAndAttachFunction · 0.70

Tested by

no test coverage detected