This function was a PITA to match
| 2108 | |
| 2109 | // This function was a PITA to match |
| 2110 | static S32 spinCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*) |
| 2111 | { |
| 2112 | zNPCGoalBossPatSpin* spin = (zNPCGoalBossPatSpin*)rawgoal; |
| 2113 | zNPCBPatrick* pat = (zNPCBPatrick*)rawgoal->GetOwner(); |
| 2114 | S32 nextgoal = 0; |
| 2115 | |
| 2116 | if (globals.player.ControlOff & 0xffffbaff) |
| 2117 | { |
| 2118 | *trantype = GOAL_TRAN_SET; |
| 2119 | return NPC_GOAL_BOSSPATIDLE; |
| 2120 | } |
| 2121 | |
| 2122 | if (spin->stage == 6) |
| 2123 | { |
| 2124 | if (pat->AnimTimeRemain(NULL) < f2280 * dt) |
| 2125 | { |
| 2126 | nextgoal = pat->nextGoal(); |
| 2127 | *trantype = GOAL_TRAN_SET; |
| 2128 | } |
| 2129 | } |
| 2130 | else if (spin->stage == 2 && pat->bossFlags & 2) |
| 2131 | { |
| 2132 | if (pat->AnimTimeRemain(NULL) < f2280 * dt) |
| 2133 | { |
| 2134 | nextgoal = NPC_GOAL_BOSSPATTAUNT; |
| 2135 | *trantype = GOAL_TRAN_SET; |
| 2136 | } |
| 2137 | } |
| 2138 | else if (pat->bossFlags & 4 && pat->bossFlags & 8) |
| 2139 | { |
| 2140 | pat->hitPoints--; |
| 2141 | zEntEvent(pat, pat, eEventNPCHPDecremented); |
| 2142 | *trantype = GOAL_TRAN_SET; |
| 2143 | nextgoal = NPC_GOAL_BOSSPATHIT; |
| 2144 | |
| 2145 | if (!(pat->nfFlags & 0x800)) |
| 2146 | { |
| 2147 | pat->newsfish->SpeakStart(sNFComment[NF_THATS_THE_TICKET_A].soundID, 0, -1); |
| 2148 | pat->nfFlags |= 0x800; |
| 2149 | } |
| 2150 | else if (pat->numMissesInARow > 5) |
| 2151 | { |
| 2152 | pat->newsfish->SpeakStart(sNFComment[NF_CHANGE_TACTICS_FAST].soundID, 0, -1); |
| 2153 | pat->numMissesInARow = 0; |
| 2154 | } |
| 2155 | else if (pat->numPCHitsInARow > 2 || (pat->numPCHitsInARow == 2 && (xrand() & 0x80))) |
| 2156 | { |
| 2157 | pat->newsfish->SpeakStart(sNFComment[NF_ROBOT_TAKING_BEATING].soundID, 0, -1); |
| 2158 | } |
| 2159 | else |
| 2160 | { |
| 2161 | U32 picker = xrand(); |
| 2162 | |
| 2163 | if (!(picker & 0x300)) |
| 2164 | { |
| 2165 | if (picker & 0x40) |
| 2166 | { |
| 2167 | pat->newsfish->SpeakStart(sNFComment[NF_THATS_THE_TICKET_A].soundID, 0, -1); |
nothing calls this directly
no test coverage detected