Author Topic: Restoring EcoQuest 2's debug functionality  (Read 49041 times)

0 Members and 3 Guests are viewing this topic.

Offline lwc

Re: Restoring EcoQuest 2's debug functionality
« Reply #15 on: September 11, 2023, 02:27:54 AM »
Tested working in DOSBox and ScummVM, but CTRL is used for toggling between walk and the last used icon, so both these commands still toggle the cursor. I can either disable the toggle or just know to double click when placing Adam with Ctrl Click to keep the walk icon.
It's weird, for me ctrl doesn't do any toggling, so your code works perfectly for me. It actually allows to skip scenes (for example, you can just instantly move over the wall in City of Gold without solving the puzzle and just skip to the next room.

Can you add this to the shortcuts listed when clicking Shift+/ ?

Offline Kawa

Re: Restoring EcoQuest 2's debug functionality
« Reply #16 on: September 11, 2023, 02:52:02 AM »
I'm guessing a lot of people already knew this, but what I proved to myself is that you should never expect unpassed parameters to be 0. They are probably some random garbage value. Instead, always check the number of arguments with 'argc' to verify that a parameter has been passed before testing it's value.
<plug> Or use &exists if you like slightly improved readability: (if (&exists param2) (proc0_3 param2)) </plug>

Offline doomlazer

Re: Restoring EcoQuest 2's debug functionality
« Reply #17 on: September 11, 2023, 03:30:27 AM »
<plug> Or use &exists if you like slightly improved readability: (if (&exists param2) (proc0_3 param2)) </plug>

I don't think I've come across that before, but I like it!

It's weird, for me ctrl doesn't do any toggling, so your code works perfectly for me. It actually allows to skip scenes (for example, you can just instantly move over the wall in City of Gold without solving the puzzle and just skip to the next room.

Can you add this to the shortcuts listed when clicking Shift+/ ?

The toggle doesn't happen until you use an icon besides walk, then it should kick in.

I'm glad you're finding the debugger useful. I've attached an updated version below with the two mouse commands listed in Shift+/. I had to put them on a second page because there was no more room.


Edit: removed outdated attachment.
« Last Edit: September 11, 2023, 06:05:35 PM by doomlazer »

Offline lwc

Re: Restoring EcoQuest 2's debug functionality
« Reply #18 on: September 11, 2023, 12:18:05 PM »
Yes, I find it quite useful!

I see what you mean now, as previously I never chose anything other than walk, what a shame Alt can't be be used.

I think you should cancel the toggle as I never would have found out about it if you didn't reveal it here, and this is only for people with the debug files anyway.
Another option is only cancel the toggle if Ctrl is clicked for over 0.1 seconds.
What do you think?

Offline OmerMor

Re: Restoring EcoQuest 2's debug functionality
« Reply #19 on: September 11, 2023, 01:37:48 PM »
May I suggest using SluiceBox's excellent decompilation archive?

Yes, I do use it; especially when SCICompanion can't decompile ASM. It's a huge timesaver.

Unfortunately, in this case his code still has the same bug that's setting flag 1 when param2 isn't passed. Checking the number of arguments instead of param2 fixes the problem and probably should have been the test in the original source.

I was suggesting using his archive as alternative to SCI Companion's decompilation since his code is clearer. His scripts doesn't have any bug fixes.

Offline doomlazer

Re: Restoring EcoQuest 2's debug functionality
« Reply #20 on: September 11, 2023, 02:33:47 PM »
I was suggesting using his archive as alternative to SCI Companion's decompilation since his code is clearer. His scripts doesn't have any bug fixes.

Ah, that makes more sense. Sorry, my brain reads proc0_3 as setFlag now by default.

... what a shame Alt can't be be used.

I decided to look into it and I can use ALT by editing this condition in 988's ego::handleEvent:
Code: [Select]
((& temp1 $4000) ;temp1 is event type
(if (& temp1 $1000)
(if (== (pEvent modifiers?) emALT) ;if ALT
(gEgo setMotion: 0 posn: (pEvent x?)(pEvent y?)) ;move Adam to mouse x/y
else
(switch global67
(0
(self setMotion: MoveTo (pEvent x?) (+ (pEvent y?) z))
)
(1
(self setMotion: PolyPath (pEvent x?) (+ (pEvent y?) z))
)
(2
(self setMotion: PolyPath (pEvent x?) (+ (pEvent y?) z) 0 0)
)
)
(gUser prevDir: 0)
)
(pEvent claimed: 1)
else
(super handleEvent: pEvent)
)
)

I didn't even bother passing the mouse event to 98.scr, just moved Adam to the mouse.

Unlike before, this change requires using Alt + the WALK cursor to warp, which seems fine to me. It also requires including the patch file for 988.scr, which feels a little sloppy, but I don't know how else this could be done using ALT.

Please try the updated zip attached below. ty

Edit: removed outdated attachment
« Last Edit: September 11, 2023, 06:05:01 PM by doomlazer »

Offline lwc

Re: Restoring EcoQuest 2's debug functionality
« Reply #21 on: September 11, 2023, 03:56:51 PM »
it works nicely, but I agree including yet another file (988.scr) might be an overkill.
Will it not work to not toggle if the CTRL key was pressed fore more than 0.1 seconds?

Offline doomlazer

Re: Restoring EcoQuest 2's debug functionality
« Reply #22 on: September 11, 2023, 04:08:04 PM »
I think when you start trying to time user inputs it can create accessibility issues, so it is probably best avoided. The extra patch file isn't really a problem and we already require 0.scr & 98.hep in addition to the standard single patch file. What's one more?

I like using ALT because it keeps the CTRL toggling intact and it feels straight forward. Unless you feel strongly about the extra patch I think it's best to keep it as it is now.

Offline lwc

Re: Restoring EcoQuest 2's debug functionality
« Reply #23 on: September 11, 2023, 04:31:09 PM »
Yes, it's just 1 file, but you know...still, I guess I can live with it. :D

What is 998.sc called in Sluicebox' eco2' src? May I assume 0.sc is called Main.sc?
Do you think you can send a pull request there? Then it's his choice whether to approve it or not.

If you think all of this will natively work in the demo, then would you send a pull request to EricOakford' eco2demo's src?

Offline doomlazer

Re: Restoring EcoQuest 2's debug functionality
« Reply #24 on: September 11, 2023, 04:45:42 PM »
It's called Ego_988. You can reference the game.ini file to easily get the numbers/names. https://github.com/sluicebox/sci-scripts/blob/main/eco2-dos-1.000.000/game.ini

I don't think sluice intends to incorporate any fixes into his project. It's mostly a static reference I believe.

It would be trivial for EO to update the EQ2 demo code, but I think debugging in the demo has limited utility so I'll leave that to his discretion instead of doing a pull request.

I've added it to my repository of SCI debugging stuff and google might direct anyone searching for EQ2 debugging to this thread anyway, so it's probably, as my grandfather used to say, "good enough for government work". 
« Last Edit: September 11, 2023, 04:47:17 PM by doomlazer »

Offline lwc

Re: Restoring EcoQuest 2's debug functionality
« Reply #25 on: September 11, 2023, 05:20:55 PM »
In the help menu, can you change Alt - Walk to Alt + Left Mouse Button or at least Alt - Click? We can assume walking is a given.

Also, the x/y shower still toggles. Maybe it should be Alt too?

Offline doomlazer

Re: Restoring EcoQuest 2's debug functionality
« Reply #26 on: September 11, 2023, 06:04:18 PM »
I changed the help messages to:

ALT-LeftClick - Move Adam to mouse x/y
CTRL-ALT-LeftClick - Show mouse x/y

I also disabled cursor toggling for CTRL-ALT-Click, but not for CTRL-Click. Best of both worlds! Let me know if the version attached below looks good.

Offline lwc

Re: Restoring EcoQuest 2's debug functionality
« Reply #27 on: September 11, 2023, 07:02:44 PM »
Awesome, thanks!

Can you attack the source code of these 4 files for prosperity?
« Last Edit: September 11, 2023, 07:10:37 PM by lwc »

Offline doomlazer

Re: Restoring EcoQuest 2's debug functionality
« Reply #28 on: September 11, 2023, 08:38:53 PM »
Sure, source attached below.

Although I was working with files decompiled in SCICompanion, I've migrated the changes and comments to the Sluicebox version so they can be easily diffed against their counterparts.

Offline Collector

Re: Restoring EcoQuest 2's debug functionality
« Reply #29 on: September 11, 2023, 10:32:05 PM »
I am reminded of of how a debug build of the interpreter was added to the restoration of the KQ6 debuger. Not sure of how intact the debug functions/commands in EQ2 is or how feasible it might be to restore these. Not sure how useful just teleport is without being able to set flags or even get inventory items.
KQII Remake Pic


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.04 seconds with 16 queries.