fig02

rova target

Feb 19th, 2020
373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.56 KB | None | 0 0
  1. void func_8093A0A8(void *this, s32 arg1)
  2. {
  3.     void *otherRova;
  4.     void *temp_a0;
  5.     void *pillarXYZ;
  6.  
  7.     otherRova = (void *) this->unk118; //other rova
  8.     this->unk5F8 = (u8)1;
  9.     this->unk4 = (s32) (this->unk4 | 1);
  10.     this->unk14C = &func_8093A2AC;
  11.     temp_a0 = &this->0x568;
  12.     temp_a0->unk-A0 = 0.0f;
  13.     func_800A534C(temp_a0, 0x6000000 + 0x6f28, 0xc1200000); //animation related
  14.     //arena bounds: x: -359 to 359 z: -359 to 359
  15.     if (Math_Rand_ZeroOne() < 0.5f) //50/50 coin toss
  16.     {
  17.         if (otherRova != 0) //if another rova exists (if its phase 1)
  18.         {
  19.             if (otherRova->unk14C == &func_8093B1AC) //if the other rova is shooting
  20.             {
  21.                 //set next x pos to other-rova-x plus or minus 100 units
  22.                 this->targetX_4B0 = (f32) (Math_Rand_CenteredFloat(0x43480000) + otherRova->x);
  23.  
  24.                 //set next y pos between 0 and 200 + 340
  25.                 this->targetY_4B4 = (f32) (Math_Rand_ZeroFloat(0x43480000) + 340.0f);
  26.  
  27.                 //set next z pos to other-rova-z plus or minus 100 units
  28.                 this->targetZ_4B8 = (f32) (Math_Rand_CenteredFloat(0x43480000) + otherRova->z);
  29.  
  30.                 //set animation timer to 50 + a number between 0 and 50. range of 50-100 frames
  31.                 this->timer_178 = (s16) ((s32) Math_Rand_ZeroFloat(0x42480000) + 0x32);
  32.                 return;
  33.             }
  34.         }
  35.     }
  36.     if (Math_Rand_ZeroOne() < 0.5f) //50/50 coin toss
  37.     {
  38.         //set next x pos plus or minus 200 units
  39.         this->targetX_4B0 = Math_Rand_CenteredFloat(0x44480000);
  40.  
  41.         //set next y pos between 0 and 200 + 340
  42.         this->targetY_4B4 = (f32) (Math_Rand_ZeroFloat(0x43480000) + 340.0f);
  43.  
  44.         //set next z pos plus or minus 200 units
  45.         this->targetZ_4B8 = Math_Rand_CenteredFloat(0x44480000);
  46.  
  47.         //set animation timer to 50 + a number between 0 and 50. range of 50-100 frames
  48.         this->timer_178 = (s16) ((s32) Math_Rand_ZeroFloat(0x42480000) + 0x32);
  49.         return;
  50.     }
  51.     //generate random number between 0.0 and 3.99. truncate and use result to index list of pillar positions
  52.     pillarXYZ = (((s32) ((s32) Math_Rand_ZeroFloat(3.99f) << 0x10) >> 0x10) * 0xc) + &D_8094A8AC;
  53.  
  54.     //set target x, y, and z to pillar
  55.     this->targetX_4B0 = pillarXYZ->x;
  56.     this->targetY_4B4 = pillarXYZ->y;
  57.     this->targetZ_4B8 = pillarXYZ->z;
  58.  
  59.     this->timer_178 = 0xc8; //flying timer. when this reaches 0 rova will shoot if no other rova is shooting
  60.     this->canShoot_15E = 1; //can shoot, this case is guranteed
  61.     }
  62.  
  63. }
Advertisement
Add Comment
Please, Sign In to add comment