| 410 | |
| 411 | //ok |
| 412 | public static void M_MoveFrame(SubgameEntity self, GameExportsImpl gameExports) { |
| 413 | |
| 414 | mmove_t move = self.monsterinfo.currentmove; |
| 415 | self.think.nextTime = gameExports.level.time + Defines.FRAMETIME; |
| 416 | |
| 417 | // nextframe can override next state |
| 418 | if ((self.monsterinfo.nextframe != 0) |
| 419 | && (self.monsterinfo.nextframe >= move.firstframe) |
| 420 | && (self.monsterinfo.nextframe <= move.lastframe)) { |
| 421 | self.s.frame = self.monsterinfo.nextframe; |
| 422 | self.monsterinfo.nextframe = 0; |
| 423 | } else { |
| 424 | if (self.s.frame == move.lastframe) { |
| 425 | if (move.endfunc != null) { |
| 426 | move.endfunc.think(self, gameExports); |
| 427 | |
| 428 | // regrab move, endfunc is very likely to change it |
| 429 | move = self.monsterinfo.currentmove; |
| 430 | |
| 431 | // check for death |
| 432 | if ((self.svflags & Defines.SVF_DEADMONSTER) != 0) |
| 433 | return; |
| 434 | } |
| 435 | } |
| 436 | |
| 437 | if (self.s.frame < move.firstframe || self.s.frame > move.lastframe) { |
| 438 | self.monsterinfo.aiflags &= ~GameDefines.AI_HOLD_FRAME; |
| 439 | self.s.frame = move.firstframe; |
| 440 | } else { |
| 441 | if (0 == (self.monsterinfo.aiflags & GameDefines.AI_HOLD_FRAME)) { |
| 442 | self.s.frame++; |
| 443 | if (self.s.frame > move.lastframe) |
| 444 | self.s.frame = move.firstframe; |
| 445 | } |
| 446 | } |
| 447 | } |
| 448 | |
| 449 | int index = self.s.frame - move.firstframe; |
| 450 | if (move.frames[index].ai != null) |
| 451 | if (0 == (self.monsterinfo.aiflags & GameDefines.AI_HOLD_FRAME)) |
| 452 | move.frames[index].ai.ai(self, move.frames[index].dist |
| 453 | * self.monsterinfo.scale, gameExports); |
| 454 | else |
| 455 | move.frames[index].ai.ai(self, 0, gameExports); |
| 456 | |
| 457 | if (move.frames[index].think != null) |
| 458 | move.frames[index].think.think(self, gameExports); |
| 459 | } |
| 460 | |
| 461 | /** Stops the Flies. */ |
| 462 | public static EntThinkAdapter M_FliesOff = new EntThinkAdapter() { |