[Decompilation] [th01] Shootout lasers: Broken reset function

Whoops, 4406c3d did not actually decompile it yet.

Part of P0181, funded by Ember2528.
This commit is contained in:
nmlgc 2022-01-21 17:01:42 +01:00
parent 091f19f69b
commit d9228e0320
2 changed files with 33 additions and 17 deletions

View File

@ -88,6 +88,33 @@ public:
// Directly sets [done] if the laser collides with the player.
void update_hittest_and_render(void);
// Tries to unblit the entire laser, but fails hilariously.
void unput_and_reset(void) {
if(alive) {
// Two ZUN bugs here:
//
// 1) Surely this should have unblitted from the start to the end
// of the ray instead? Except that this class doesn't explicitly
// store that end point… so the best alternative would be the
// target point. But given that we use our own blitting routine,
// who knows how accurate that actually is?
//
// 2) graph_r_line_unput() takes screen_x_t and vram_y_t, not
// LaserPixels truncated to 16-bits :zunpet: As a result, this
// call effectively unblit random 32-bit pixel chunks.
//
// Not that it matters a lot. This function is only called at the
// end of a boss battle, immediately before transitioning to the
// tally screen. Still, not doing anything would have been the
// better choice.
graph_r_line_unput(
ray_start_left.v, ray_start_y.v, origin_left.v, origin_y.v
);
alive = false;
}
}
};
extern CShootoutLaser shootout_lasers[SHOOTOUT_LASER_COUNT];
@ -98,3 +125,9 @@ extern CShootoutLaser shootout_lasers[SHOOTOUT_LASER_COUNT];
shootout_lasers[i].id = id; \
} \
}
#define shootout_lasers_unput_and_reset_broken(i) { \
for(i = 0; i < SHOOTOUT_LASER_COUNT; i++) { \
shootout_lasers[i].unput_and_reset(); \
} \
}

View File

@ -6,23 +6,6 @@ shootout_laser_unput_and_reset_broken macro @@slot:req
imul bx, size CShootoutLaser
cmp _shootout_lasers[bx].SL_alive, 0
jz short @@skip
; Two ZUN bugs here:
;
; 1) Surely this should have unblitted from the start to the end of the
; ray instead? Except that CShootoutLaser doesn't explicitly store that
; end point... so the best alternative would be the target point. But
; given that CShootoutLaser has its own blitting routine, who knows how
; accurate that actually is?
;
; 2) graph_r_line_unput() takes screen_x_t and vram_y_t, not LaserPixels
; truncated to 16-bits :zunpet: As a result, these calls effectively
; unblit random 32-bit pixel chunks.
;
; Not that it matters a lot. This function is only called at the end of a
; boss battle, immediately before transitioning to the tally screen.
; Still, not doing anything would have been the better choice.
mov bx, @@slot
imul bx, size CShootoutLaser
push word ptr _shootout_lasers[bx].SL_origin_y