tetracorp / k240

Exploring K240, a project to disassemble the 1994 Commodore Amiga game, K240
https://tetracorp.github.io/k240/
5 stars 1 forks source link

K240 - New bug and possible solutions #13

Open drDragonSmoke opened 1 year ago

drDragonSmoke commented 1 year ago

This bug occurs or the "Click on Target Asteroid" screen and the "Click on Target Fleet" screen when they are accessed through the Fleet screen. When you click on the buttons to move a fleet to an asteroid, to attack an asteroid, or to intercept another fleet, you will be taken to the "Click on Target Asteroid" or "Click in Target Fleet" screen. Here, you will notice that the date keeps ticking on the lower right-hand corner (time progresses), but all ships, fleets and asteroids are frozen in place.

By not making a selection on this screen, you can effectively freeze all ships in space as a stalling tactic while waiting for builds to complete or credits to roll in. You can even press a F hotkey to return to asteroid view and manage your colonies and build ships while everything is space remains frozen in place.

Other ways of arriving at the "Click on Target Asteroid" screen:

None of these ways seem to be trigger the bug. The first two lead to a "Click on Target Asteroid" screen where ships/asteroids are frozen and time is paused. The latter two lead to a "Click on Target Asteroid" screen where ships/asteroids move and time progresses. Both normal conditions.

Possible solutions: I tried to insert "ST flgPaused" underneath ;12132: to pause the time when on the screen, but this had unintended consequences for the other above-mentioned ways of arriving at the screen. It was also easy to circument by using a F hotkey to switch to asteroid view and simply opening the right-click menu and closing it to activate time progressing again, while space remained frozen in place.

I'm currently looking for a way to activate movement of ships/fleets/asteroids on the screen, ie. the way it works when arriving at it from the sattelite silo or ore teleporter. Any tips or pointers would be greatly appreciated.

drDragonSmoke commented 1 year ago

After hacking and slashing at the _FleetWin: I identified flg2E09E as the flag that makes the screen skip daily ship movement. I put in the following at the end of the window, so it won't unpause the screen:

_0C2D6:
    TST.B   flg2E09E
    BEQ.S   _unpause
    ST  flgPaused
    BRA _keeppause
_unpause:
    SF  flgPaused   ;0c2d6: 51f90002e458
_keeppause:
    RTS         ;0c2dc: 4e75

This successfully pauses date progression, so that both ship movement and time is frozen.

There was still the pesky problem about being able to use F keys to exit the screen and simply unpausing the time in asteroid view. I dealt with this by using the flg2E09E flag to skip this particular F key code segment:

; hotkeys f1-f10
    CMPI.B  #$50,D0         ;11ed4: 0c000050
    BMI.S   _11EEA          ;11ed8: 6b10
    CMPI.B  #$5a,D0         ;11eda: 0c00005a
    BPL.S   _11EEA          ;11ede: 6a0a
    TST.B   flg2E09E
    BNE.S   _11EEA
    JSR _Hotkeys_02590      ;11ee0: 4eb900002590
    BRA.W   _11BCC          ;11ee6: 6000fce4
_11EEA:

This makes it so the F keys don't work on the fleet targeting screen. There are a few other nearly identical F key code segments, but this one seem to to the trick. More testing needed. Comments always appreciated.