leapop 0.8

Discuss other PoP1 related things here.
Locked
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

leapop 0.8

Post by Norbert »

Here's leapop, a level editor of Prince of Persia for the Apple II.

Download links for version 0.8:
- GNU/Linux (mirror)
- Windows 32-bit (mirror)
- Windows 64-bit (mirror)

I posted some screenshots here.
In a future reply post I will add some additional information about it.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: leapop 0.8

Post by Norbert »

Norbert wrote:In a future reply post I will add some additional information about it.
For those of you who are getting confused by the similarity of some of the level editors' names: the two middle characters are the port(/device/console/computer/whatever). So, leapop edits PoP1 for the Apple II, lemdop for the Mega Drive (and Sega Genesis), and legbop for the Game Boy Color.

The EXE screen (press F2 on the main screen to go there) has a bunch of extra settings. All guard settings, the prince and shadow HP, and chomper and (level 8) mouse delays. The lower the delays, the faster/sooner.
On the EXE screen, I deliberately reserved some space to add additional settings in the future. There is still room for 2 global settings and 4 per-level settings. If you have something in mind, let me know.
One of the per-level settings I have in mind is for the environment type (palace or dungeon). However, I looked at the Apple II source code and from what I can tell, these are bgset1, bgset2 and chset (offsets 0x1A8B7, 0x1A8C6 and 0x1A8D5 in the disk image), but if I modify these the game crashes.
One of the other per-level settings I have in mind is for the guard image. However, I don't know where in the source code/disk image these are.
One of the global settings I couldn't figure out is the starting minutes.

Did you know that the bubbles of Apple II's hurt potion are (vertically) higher than those of its heal potion? Maybe for players with grayscale monitors...

Next, I'll list some things mostly different from my other editors. The tiles screen shows a big preview if the user is on the same tile for at least 1 second. Also on the tiles screen, if the cursor is on the event number area, the raise and drop buttons 'highlight', and if the cursor is on the guard numbers, the program mentions the EXE screen. The tiles screen also has the bloody chompers. By the way, on the tiles screen, the tiles are in the same locations as on apoplexy's (PoP1 for DOS) tiles screen.

I'd been looking into Apple II for years. It was always a problem to find the right game disk and emulator combination. When David mentioned Adam Green's buildable version, I had finally found a usable (3.5") game disk. I usually try to add the same cross-platform emulator to both the Windows and the Linux packages of my editors, but here I've made an exception and use AppleWin. AppleWin is free and open source software, but its (recent) releases are Windows-only. This is why leapop launches AppleWin with Wine under Linux. There is no good native Apple II emulator for Linux; trust me, I've tried everything. I've already requested an easier way to launch HDD disk images with AppleWin.

I did the bulk of the coding during the past weeks. I started with my legbop source code; while Apple II is more similar to DOS than the Game Boy Color port, apoplexy has code to edit multiple ports and legbop just one. This is the first level editor where I changed with width of the application. As a result, I had to change a lot more coordinates in the code.

The last byte of Apple II levels is not a checksum. It is either 0F or 00 (or 8F for level 8). Perhaps coincidentally, these kind of match the environment types, but with a switch from level 7. Also, the level bytes that would normally be guard colors appear to be something else. This is also why the guards on the tiles screen are gray and all their colors are changed on the EXE screen.

I look forward to hearing your feedback. Does the Windows version work? Including launching AppleWin? (For now you need to manually go to specific levels with go##, see the hover tooltip.) I could only test this via Wine on Linux, which isn't ideal. On Linux I have to modify the game speed and enable audio manually.

Finally, keeping the perspective in mind, the Apple II game does not display palace wall patterns directly behind tiles. It actually displays them several pixels to the right. I have no idea why Mechner coded it this way, but it's also the reason why there's a palace wall variant that includes part of the wall pattern. Not only that, the palace environment also slightly moves the entire screen to the left. Again, no idea why.
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: leapop 0.8

Post by David »

Let's answer your long post with an even longer one... :)


I noticed that you added a popup for the tile screen that shows the hovered tile in bigger size.

Somehow they seem to suggest that this is the first level editor for any version of PoP, ever...

Or the .hu site:
28 év után elkészült egy pályaszerkesztő is.

After 28 years, a level editor was made as well.
It's especially odd that they think this, because, you know, one of the earliest PoP level editors was Hungarian: https://www.popot.org/level_editors.php?editor=POPMAP

The .de site even shows a screenshot from the DOS version but mentions leapop in its caption.

Only the https://www.vidaextra.com/pc/28-anos-de ... e-apple-ii site mentions apoplexy.
Or your name, for that matter. No, wait, the .de site also mentions your name.

It's interesting that half of those sites are Spanish.
I wonder why...

Also, some sites compare the PoP modding community to that of Doom.

Norbert wrote: One of the other per-level settings I have in mind is for the guard image. However, I don't know where in the source code/disk image these are.
I think it's the chset, from MISC.S:

Code: Select all

// level  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14
chset db 00,00,00,01,02,02,03,02,02,02,02,02,04,05,05
00 = regular guard on side A (levels 0..2)
01 = skeleton on side B (levels 3..14)
02 = regular guard on side B
03 = fat guard on side B
04 = shadow on side B
05 = Jaffar on side B

Norbert wrote: Does the Windows version work? Including launching AppleWin?
(For now you need to manually go to specific levels with go##, see the hover tooltip.)
It does, although it's a bit bothersome that I have to configure the disk image manually.
AppleWin stores its settings in the registry:
HKEY_CURRENT_USER\Software\AppleWin\CurrentVersion\Configuration -> Harddisk Enable -- Set to "1" to enable HD emulation.
HKEY_CURRENT_USER\Software\AppleWin\CurrentVersion\Preferences -> Last Harddisk Image 1 -- Should contain the full path to the PoP1.po file.
It should be possible to make a *.REG file with the desired settings and import it into the registry.

BTW, the cheat code to kill a guard is "zap", not "azap". And you're missing a colon after it.

Norbert wrote: This is the first level editor where I changed with width of the application. As a result, I had to change a lot more coordinates in the code.
That's what named constants (#defines) are good for. :)

Norbert wrote: Did you know that the bubbles of Apple II's hurt potion are (vertically) higher than those of its heal potion? Maybe for players with grayscale monitors...
Clarification: It's the *position* of the bubbles that is different.
Somehow I thought you mean that the bubbles are *taller*, i.e. two pixels are drawn under each other instead of a single pixel, or something.
It must be because of my mother language... https://en.wiktionary.org/wiki/magas#Hungarian

The difference between the bubbles might be unintended, though:

Code: Select all

(GAMEBG.S)
 txa
 and #%11100000
 cmp #EmptyPot
 beq :0
 cmp #BoostPot
 beq :tall ;special flask (taller)
 bcc :cont

 inc OFFSET ;mystery potion (blue)

:tall lda YCO
 sec
 sbc #4
 sta YCO

:cont txa
Basically, all potion types >= 2 have bubbles placed higher, and all potion types > 2 have blue bubbles.


This reminds me of two things:

#1: The Walkthrough by Eizaz Azhar mentions something similar.
Eizaz Azhar wrote: Healing Potions have RED bubbles, while Evil Potions have BLUE.
For all of you who still play this game on black and white monitors, you're going to have to guess.
There is a slight difference in bubbles, but I'm not sure which one is which.
It's written for the DOS version, though.
But maybe he was remembering the Apple II version?

#2: This might be a form of Color Blind Assist?
Accessibility guidelines often say that the benefits of making things accessible are not limited to disabled people.
It's also good, for example, for people with older hardware. In this case it's Apple II users with B/W screens.

https://static.giantbomb.com/uploads/or ... assist.jpg -- This is an example of that and more.

http://cdn.akamai.steamstatic.com/steam ... 0x1080.jpg -- In the top-right corner.
(Hey, is that an Apple in the hand on the left? :) )
(Also, the colors of the heroes are blue(ish) and orange. Eh?)
(And somehow, the configured resolution does not match the size of the screenshot.)
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: leapop 0.8

Post by Norbert »

David wrote:I noticed that you added a popup for the tile screen that shows the hovered tile in bigger size.
Yeah, I also mentioned that in my post.
David wrote:It's interesting that half of those sites are Spanish.
By the way, in the meantime, a dozen or so additional websites have written about it. Including Chinese and everything.
If you Google for leapop "Apple II" (and leapop "Prince of Persia", but not all mention the English game name) and then use Tools->All results->Verbatim you can find them.
David wrote:I think it's the chset, from MISC.S: [...]
Interesting, I'll check those out.
David wrote:It does, although it's a bit bothersome that I have to configure the disk image manually.
Yes, as I wrote, I've asked the AppleWin folks to give me those extra command-line options.
David wrote:BTW, the cheat code to kill a guard is "zap", not "azap". And you're missing a colon after it.
It needs a colon, but "azap" is correct.
The reason is that "a" itself toggles auto/manual controlling of the guard. :)
In (the default) joystick mode, with just "zap", the prince no longer makes small steps.
David wrote:That's what named constants (#defines) are good for. :)
I already use lots of #defines for this reason, of course.
In theory I could've used <nr of pixels from the border(s)> with InArea() here.
David wrote:#2: This might be a form of Color Blind Assist?
By the way, the level editors table at popot.org includes red-like and green-like colors to work around the common color-blind pair.
Alphabetical sorting put my editors at the top; I did not deliberately name them with that in mind. :)
(I don't think you think I did. ;))
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: leapop 0.8

Post by David »

Norbert wrote: One of the per-level settings I have in mind is for the environment type (palace or dungeon). However, I looked at the Apple II source code and from what I can tell, these are bgset1, bgset2 and chset (offsets 0x1A8B7, 0x1A8C6 and 0x1A8D5 in the disk image), but if I modify these the game crashes.
I have looked into this.

Code: Select all

* Level #: 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14
bgset1 db 00,00,00,00,01,01,01,02,02,02,01,01,02,02,01
bgset2 db 00,00,00,00,01,01,01,02,02,02,01,01,02,02,01
chset  db 00,00,00,01,02,02,03,02,02,02,02,02,04,05,05
Changing these does work, but there is a twist:
Graphics set 00 (of both bgset and chset) is on Side A, the others are on Side B.
Therefore:
• Levels 0..2 must use 00 in all tables, because they are on Side A.
• Levels 3..14, in contrast, must use something other than 00, because they are on Side B.
This is true even if the two sides are combined into a single file, as in your disk image.
Something still keeps track of which side is the current.

If I change level 1 to use bgset1 = 01, for example, then when I load level 1, some graphics will be garbled and the game freezes.
If I undo that and change level 1 to use bgset2 = 01 instead, then the game kicks me out into the machine code monitor. Wow! :shock:

Code: Select all

00B9-    A=01 X=40 Y=7F P=34 S=E5
*▩
The bgsets of level 3 seem to contradict this.
However, there is a check that does not load bgsets if the number is the same as for the previous level:

Code: Select all

(MASTER.S)
rdbg1 ldx newBGset1
 cpx BGset1 ;already in memory?
 beq :rts ;yes--no need to load
 stx BGset1
So if you go to level 3 from level 2, no new level graphics are loaded.

Maybe this is why the "GO" cheat code can't load level 3?
Because if you wanted to go to level 3 from a later level, then the bgset number would be different.


Hey, what's this?
If I press Ctrl+L without saving the game first, then Level 3 is loaded with 61 minutes left, and the prince moves automatically!
And if I interrupt it with any key, the game loads Level 4 with dungeon graphics, but displays "LEVEL 1".
Also, the prince starts with a running entry and he will have no sword.
If I skip to Level 2 or further levels, they are loaded correctly.

I guess the save-game area is filled with zeroes?
So Ctrl+L tries to load Level 0.
If I recall correctly, Level 0 on Side A is at the same place as Level 3 on Side B.
I guess the game assumes that Side B is needed for any level loaded with Ctrl+L. (You know, saving is enabled only from Level 3.)
So Level 3 is loaded instead, but the game still thinks it's Level 0, and thus plays the demo moves.

The solution?
The saved level should be negative (0xFF), this means there is no saved game.

Code: Select all

(TOPCTRL.S)
:cont jsr loadgame ;Load saved-game info from disk

 lda SavLevel ;Has a game been saved?
 bpl :ok ;Yes

* No game saved--start new game instead
It's stored at 0x43600 in PoP1.po.
Or just press "*" when cheats are enabled and Side B is active.
Norbert wrote: It needs a colon, but "azap" is correct.
The reason is that "a" itself toggles auto/manual controlling of the guard. :)
Oh, right. "zap" has an "a", and so another "a" is needed.
"zapa" (or Zappa?) would also work, but then you need to press the second "a" before the guard's death music starts playing, or else the keypress is not registered.
Norbert wrote: In (the default) joystick mode, with just "zap", the prince no longer makes small steps.
Actually, there are two joystick buttons, mapped to numpad Ins and Del, and also the two Alt keys.
One of them (Ins / left Alt) is assigned to the guard in "manual guard mode", but the other (Del / right Alt) is kept for the prince.

By the way, the keyboard control of PoP1 Apple (UIOJKL) lives on in PoP2 DOS.
(It's supplemented with "M,." and there is another set, the WERSDFXCV keys).
Also, in PoP2 DOS you can use Insert instead of Ctrl, and Delete instead of Shift.
Norbert wrote: By the way, the level editors table at popot.org includes red-like and green-like colors to work around the common color-blind pair.
Now that you say, I see it.

I guess accessibility is also the reason for having key equivalents for everything in your editors?
Norbert wrote: Alphabetical sorting put my editors at the top; I did not deliberately name them with that in mind. :)
(I don't think you think I did. ;))
Well, if you say so... :)

BTW, there are names that were chosen for such reasons:
The Amiga for example.
ZZT did the opposite trick.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: leapop 0.8

Post by Norbert »

David wrote:I guess accessibility is also the reason for having key equivalents for everything in your editors?
I initially supplemented the already available key equivalents in apoplexy to cover everything because of forum user floppy's 2010 post that includes "Or did you know an other editor that you can use with the keyboard? (so: Not apoplexy)". The editors created subsequently include key equivalents for both accessibility and to provide the same functionality as apoplexy.

Hey, thanks for the information about environment modification. (Where you write "Levels 0..2" and "Levels 3..14", I think you meant respectively "Levels 0..3" and "Levels 4..14", right? Because the column for level 3 says 00.) I guess it means the editor could allow switching environments for levels 4 and up. Although, I do need to check how many bytes actually change in the image, because a single change in the code may have a big impact on the disk image.

I will change the byte at offset 0x43600 to 0xFF in included disk images for future versions.
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: leapop 0.8

Post by David »

Norbert wrote: (Where you write "Levels 0..2" and "Levels 3..14", I think you meant respectively "Levels 0..3" and "Levels 4..14", right? Because the column for level 3 says 00.)
No.
Have you read this part of my post?
David wrote: The bgsets of level 3 seem to contradict this.
However, there is a check that does not load bgsets if the number is the same as for the previous level:
[...]
So if you go to level 3 from level 2, no new level graphics are loaded.
Changing level 3 to palace works fine:
level_3_as_palace.PNG
Norbert wrote: Although, I do need to check how many bytes actually change in the image, because a single change in the code may have a big impact on the disk image.
Even in this case?
Norbert wrote: I will change the byte at offset 0x43600 to 0xFF in included disk images for future versions.
Maybe you could also change it to the level currently open in the editor? For easier testing?
But as we saw, some levels won't load correctly with Ctrl+L.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: leapop 0.8

Post by Norbert »

David wrote:Have you read this part of my post?
I think my mind didn't fully process what I read because what Mechner did doesn't make sense to me. Why didn't he use 02 for level 3, and then use a check that understands that 00 and 02 are the same. Then things would be consistent, plus GO## would work for all levels...
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: leapop 0.8

Post by Norbert »

Oh, by the way, little Easter egg on the events screen: if you move the cursor on the mouse, it stands up. ;)
Locked