Mercurial > touhou
comparison src/th06/ecl_vm.rs @ 697:600eb0a69b25
ecl_vm: fix RelativeJump* instructions to actually call RelativeJump.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Fri, 23 Aug 2019 02:36:59 +0200 |
parents | 7ae576a418ff |
children | 05e0425a8bc5 |
comparison
equal
deleted
inserted
replaced
696:7ae576a418ff | 697:600eb0a69b25 |
---|---|
254 // only the pointer is copied, not the value, thus we are safe | 254 // only the pointer is copied, not the value, thus we are safe |
255 SubInstruction::RelativeJumpEx(frame, ip, var_id) => { | 255 SubInstruction::RelativeJumpEx(frame, ip, var_id) => { |
256 // TODO: counter_value is a field of "enemy" in th06, to check | 256 // TODO: counter_value is a field of "enemy" in th06, to check |
257 let counter_value = self.get_i32(var_id) - 1; | 257 let counter_value = self.get_i32(var_id) - 1; |
258 if counter_value > 0 { | 258 if counter_value > 0 { |
259 SubInstruction::RelativeJump(frame, ip); | 259 self.run_instruction(SubInstruction::RelativeJump(frame, ip)); |
260 } | 260 } |
261 } | 261 } |
262 // 4 | 262 // 4 |
263 SubInstruction::SetInt(var_id, value) => { | 263 SubInstruction::SetInt(var_id, value) => { |
264 self.set_i32(var_id, value); | 264 self.set_i32(var_id, value); |
405 } | 405 } |
406 } | 406 } |
407 // 29 | 407 // 29 |
408 SubInstruction::RelativeJumpIfLowerThan(frame, ip) => { | 408 SubInstruction::RelativeJumpIfLowerThan(frame, ip) => { |
409 if self.frame.comparison_reg == -1 { | 409 if self.frame.comparison_reg == -1 { |
410 SubInstruction::RelativeJump(frame, ip); | 410 self.run_instruction(SubInstruction::RelativeJump(frame, ip)); |
411 } | 411 } |
412 } | 412 } |
413 // 30 | 413 // 30 |
414 SubInstruction::RelativeJumpIfLowerOrEqual(frame, ip) => { | 414 SubInstruction::RelativeJumpIfLowerOrEqual(frame, ip) => { |
415 if self.frame.comparison_reg != 1 { | 415 if self.frame.comparison_reg != 1 { |
416 SubInstruction::RelativeJump(frame, ip); | 416 self.run_instruction(SubInstruction::RelativeJump(frame, ip)); |
417 } | 417 } |
418 } | 418 } |
419 // 31 | 419 // 31 |
420 SubInstruction::RelativeJumpIfEqual(frame, ip) => { | 420 SubInstruction::RelativeJumpIfEqual(frame, ip) => { |
421 if self.frame.comparison_reg == 0 { | 421 if self.frame.comparison_reg == 0 { |
422 SubInstruction::RelativeJump(frame, ip); | 422 self.run_instruction(SubInstruction::RelativeJump(frame, ip)); |
423 } | 423 } |
424 } | 424 } |
425 // 32 | 425 // 32 |
426 SubInstruction::RelativeJumpIfGreaterThan(frame, ip) => { | 426 SubInstruction::RelativeJumpIfGreaterThan(frame, ip) => { |
427 if self.frame.comparison_reg == 1 { | 427 if self.frame.comparison_reg == 1 { |
428 SubInstruction::RelativeJump(frame, ip); | 428 self.run_instruction(SubInstruction::RelativeJump(frame, ip)); |
429 } | 429 } |
430 } | 430 } |
431 // 33 | 431 // 33 |
432 SubInstruction::RelativeJumpIfGreaterOrEqual(frame, ip) => { | 432 SubInstruction::RelativeJumpIfGreaterOrEqual(frame, ip) => { |
433 if self.frame.comparison_reg != -1 { | 433 if self.frame.comparison_reg != -1 { |
434 SubInstruction::RelativeJump(frame, ip); | 434 self.run_instruction(SubInstruction::RelativeJump(frame, ip)); |
435 } | 435 } |
436 } | 436 } |
437 // 34 | 437 // 34 |
438 SubInstruction::RelativeJumpIfNotEqual(frame, ip) => { | 438 SubInstruction::RelativeJumpIfNotEqual(frame, ip) => { |
439 if self.frame.comparison_reg != 0 { | 439 if self.frame.comparison_reg != 0 { |
440 SubInstruction::RelativeJump(frame, ip); | 440 self.run_instruction(SubInstruction::RelativeJump(frame, ip)); |
441 } | 441 } |
442 } | 442 } |
443 // 35 | 443 // 35 |
444 SubInstruction::Call(sub, param1, param2) => { | 444 SubInstruction::Call(sub, param1, param2) => { |
445 self.stack.push(self.frame.clone()); | 445 self.stack.push(self.frame.clone()); |