|
| 1 | +#include "xDebug.h" |
1 | 2 | #include "xEntMotion.h" |
2 | 3 | #include "xMath.h" |
3 | 4 |
|
@@ -158,3 +159,79 @@ void xEntMechForward(xEntMotion* motion) |
158 | 159 | } |
159 | 160 | } |
160 | 161 | } |
| 162 | + |
| 163 | +void xEntMechReverse(xEntMotion* motion) |
| 164 | +{ |
| 165 | + xEntMotionMechData* mech = &(motion->asset->mech); |
| 166 | + xEntMotionAsset* mkasst = motion->asset; |
| 167 | + |
| 168 | + xEntMotionRun(motion); |
| 169 | + |
| 170 | + if (motion->mech.state == 0) |
| 171 | + { |
| 172 | + motion->mech.ss = -motion->mech.ss; |
| 173 | + motion->mech.sr = -motion->mech.sr; |
| 174 | + motion->tmr = mkasst->mech.sld_tm - motion->tmr; |
| 175 | + motion->mech.state = 3; |
| 176 | + } |
| 177 | + else if (motion->mech.state == 1) |
| 178 | + { |
| 179 | + motion->mech.ss = -motion->mech.ss; |
| 180 | + motion->mech.sr = -motion->mech.sr; |
| 181 | + motion->tmr = mkasst->mech.rot_tm - motion->tmr; |
| 182 | + motion->mech.state = 4; |
| 183 | + } |
| 184 | + else if ((motion->mech.state != 2) && (motion->mech.state != 3) && (motion->mech.state != 4) && (motion->mech.state != 5) && (motion->mech.state == 6)) |
| 185 | + { |
| 186 | + motion->mech.ss = -motion->mech.ss; |
| 187 | + motion->mech.sr = -motion->mech.sr; |
| 188 | + motion->tmr = 0.0f; |
| 189 | + |
| 190 | + if ((mech->type == 0) || (mech->type == 2) || (mech->type == 4)) |
| 191 | + { |
| 192 | + motion->mech.state = 3; |
| 193 | + } |
| 194 | + else |
| 195 | + { |
| 196 | + motion->mech.state = 4; |
| 197 | + } |
| 198 | + } |
| 199 | +} |
| 200 | + |
| 201 | +static xEntMotion** dbg_xems; |
| 202 | +static U16 dbg_num; |
| 203 | +static U16 dbg_num_allocd; |
| 204 | +static S16 dbg_idx; |
| 205 | + |
| 206 | +void xEntMotionDebugCB(); |
| 207 | + |
| 208 | +// Non-matching: scheduling |
| 209 | +void xEntMotionDebugInit(U16 num_xems) |
| 210 | +{ |
| 211 | + if (num_xems != 0) |
| 212 | + { |
| 213 | + xDebugModeAdd("DBG_XENTMOTION", xEntMotionDebugCB); |
| 214 | + dbg_num = 0; |
| 215 | + dbg_xems = (xEntMotion**)xMemAlloc(gActiveHeap, num_xems << 2, 0); |
| 216 | + dbg_num_allocd = num_xems; |
| 217 | + dbg_idx = 0; |
| 218 | + } |
| 219 | +} |
| 220 | + |
| 221 | +// This scheduling is absolutely shambolic |
| 222 | +void xEntMotionDebugAdd(xEntMotion* motion) |
| 223 | +{ |
| 224 | + if (dbg_num < dbg_num_allocd) |
| 225 | + { |
| 226 | + dbg_num++; |
| 227 | + dbg_xems[dbg_num] = motion; |
| 228 | + } |
| 229 | +} |
| 230 | + |
| 231 | +void xEntMotionDebugExit() |
| 232 | +{ |
| 233 | + dbg_num = 0; |
| 234 | + dbg_xems = NULL; |
| 235 | + dbg_num_allocd = 0; |
| 236 | + dbg_idx = -1; |
| 237 | +} |
0 commit comments