comparison pytouhou/vm/eclrunner.py @ 75:b3bd421bb895

Handle a few more ECL instructions
author Thibaut Girka <thib@sitedethib.com>
date Tue, 30 Aug 2011 16:30:40 +0200
parents adac26098408
children f305c0e406d6
comparison
equal deleted inserted replaced
74:adac26098408 75:b3bd421bb895
196 @instruction(9) 196 @instruction(9)
197 def set_random_float2(self, variable_id, minval, amp): 197 def set_random_float2(self, variable_id, minval, amp):
198 self._setval(variable_id, self._getval(minval) + self._getval(amp) * self._game_state.prng.rand_double()) 198 self._setval(variable_id, self._getval(minval) + self._getval(amp) * self._game_state.prng.rand_double())
199 199
200 200
201 @instruction(10)
202 def store_x(self, variable_id):
203 self._setval(variable_id, self._enemy.x)
204
205
201 @instruction(13) 206 @instruction(13)
202 def set_random_int2(self, variable_id, minval, amp): 207 def set_random_int2(self, variable_id, minval, amp):
203 self._setval(variable_id, int(self._getval(minval)) + int(self._getval(amp)) * self._game_state.prng.rand_double()) 208 self._setval(variable_id, int(self._getval(minval)) + int(self._getval(amp)) * self._game_state.prng.rand_double())
204 209
205 210
380 self._enemy.move_to(duration, x, y, z, lambda x: 2. * x - x ** 2) 385 self._enemy.move_to(duration, x, y, z, lambda x: 2. * x - x ** 2)
381 386
382 387
383 @instruction(59) 388 @instruction(59)
384 def move_to2(self, duration, x, y, z): 389 def move_to2(self, duration, x, y, z):
385 #TODO: not accurate 390 self._enemy.move_to(duration, x, y, z, lambda x: x ** 2)
386 self._enemy.move_to(duration, x, y, z, lambda x: 1.0014 * x ** 2 - 0.0012 * x)
387 391
388 392
389 @instruction(61) 393 @instruction(61)
390 def stop_in(self, duration): 394 def stop_in(self, duration):
391 self._enemy.stop_in(duration) 395 self._enemy.stop_in(duration, lambda x: x)
396
397
398 @instruction(63)
399 def stop_in_accel(self, duration):
400 self._enemy.stop_in(duration, lambda x: 1. - x)
392 401
393 402
394 @instruction(65) 403 @instruction(65)
395 def set_screen_box(self, xmin, ymin, xmax, ymax): 404 def set_screen_box(self, xmin, ymin, xmax, ymax):
396 self._enemy.screen_box = xmin, ymin, xmax, ymax 405 self._enemy.screen_box = xmin, ymin, xmax, ymax
457 def set_hitbox(self, width, height, depth): 466 def set_hitbox(self, width, height, depth):
458 self._enemy.hitbox = (width, height) 467 self._enemy.hitbox = (width, height)
459 468
460 469
461 @instruction(105) 470 @instruction(105)
462 def set_damageable(self, vulnerable): 471 def set_damageable(self, damageable):
463 self._enemy.damageable = bool(vulnerable & 1) 472 self._enemy.damageable = bool(damageable & 1)
473
474
475 @instruction(107)
476 def set_death_flags(self, death_flags):
477 self._enemy.death_flags = death_flags
464 478
465 479
466 @instruction(108) 480 @instruction(108)
467 def set_death_callback(self, sub): 481 def set_death_callback(self, sub):
468 self._enemy.death_callback = sub 482 self._enemy.death_callback = sub
519 Likewise, ReimuA's homing attacks only target “touchable” enemies. 533 Likewise, ReimuA's homing attacks only target “touchable” enemies.
520 """ 534 """
521 self._enemy.touchable = bool(value) 535 self._enemy.touchable = bool(value)
522 536
523 537
538 @instruction(120)
539 def set_automatic_orientation(self, flags):
540 #TODO: does it change anything else than the sprite's rotation?
541 self._enemy.automatic_orientation = bool(flags & 1) #TODO: name
542
543
544 @instruction(123)
545 def skip_frames(self, frames):
546 #TODO: is that all?
547 self.frame += self._getval(frames)
548
549
524 @instruction(126) 550 @instruction(126)
525 def set_remaining_lives(self, lives): 551 def set_remaining_lives(self, lives):
526 self._enemy.remaining_lives = lives 552 self._enemy.remaining_lives = lives
527 553