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

Method DoInit

scripts/AIGame.cpp:2011–2054  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2009}
2010
2011void SuperThief::DoInit(int me) {
2012 tOSIRISMEMCHUNK ch;
2013 ch.id = 4;
2014 ch.size = sizeof(superthief_data);
2015 ch.my_id.type = OBJECT_SCRIPT;
2016 ch.my_id.objhandle = me;
2017
2018 memory = (superthief_data *)Scrpt_MemAlloc(&ch);
2019
2020 msafe_struct m;
2021 m.objhandle = me;
2022 MSafe_GetValue(MSAFE_OBJECT_SHIELDS, &m);
2023
2024 memory->next_mode_time = Game_GetTime() + ((float)rand() / (float)RAND_MAX) * 3.0f + 3.0f;
2025 memory->force_ranged_shields = m.shields / 15.0f;
2026 memory->mode = SUPERTHIEF_WAIT;
2027 memory->f_very_hurt = 0;
2028
2029 memory->num_stolen_weapons = 0;
2030 memory->cur_weapon = -1;
2031
2032 memory->mode_time = 0.0f;
2033 memory->last_frame = 0.0f;
2034 memory->time_till_fire_secondary = 1.0f + (float)rand() / (float)RAND_MAX;
2035
2036 memory->laser_obj = CreateAndAttach(me, "STEmitter", OBJ_ROBOT, 2, 0, true, true);
2037
2038 uint16_t wpn = Wpn_FindID("Laser Level 1 - Red");
2039 int snd = Sound_FindId("Laser level 1");
2040
2041 strcpy(memory->weapon, "Laser Level 1 - Red");
2042 strcpy(memory->sound, "Laser level 1");
2043
2044 memory->latency = 0.25f;
2045
2046 memory->laser_on = false;
2047
2048 memory->next_fire_flare_time = 0.0f;
2049 memory->flare_fire_index = 0;
2050
2051 Obj_WBValue(me, 1, VF_SET, WBSV_I_FIRE_SOUND, &snd, 0);
2052 Obj_WBValue(me, 1, VF_SET, WBSV_F_LATENCY, &memory->latency, 0);
2053 Obj_WBValue(me, 1, VF_SET, WBSV_US_GUNPT_WEAPON_ID, &wpn, 0);
2054}
2055
2056void SuperThief::FireFlare(int me) {
2057 msafe_struct mstruct;

Callers

nothing calls this directly

Calls 11

Obj_WBValueFunction · 0.85
Obj_ValueFunction · 0.85
Obj_GetGroundPosFunction · 0.85
Player_ValueFunction · 0.85
Obj_CreateFunction · 0.85
Obj_GetGunPosFunction · 0.85
GetObjectParentFunction · 0.85
Sound_Play3dFunction · 0.85
CreateAndAttachFunction · 0.70
vm_VectorNormalizeFunction · 0.70
GetObjectTypeFunction · 0.70

Tested by

no test coverage detected