Fixing graphical glitches

Discuss PoP1 for DOS here.
User avatar
atrueprincefanfrom18
Site Shah
Site Shah
Posts: 1785
Joined: January 21st, 2020, 2:53 pm
Contact:

Fixing graphical glitches

Post by atrueprincefanfrom18 »

Norbert wrote: July 11th, 2020, 10:13 am Potions next to gates aren't always visible, I'm guessing that's what makes it confusing.
I'm wondering if there's EXE created by someone which have all the fixes in it. Fixes I can currently think of:

1. Problem with visibility of potions near gates.
2. Problem with visibility of two gates in the same column.
3. Problem with visibility of small pillar next to the gate to the right.

Maybe someone (who is familiar and experienced with hex editing) can do all such minute fixes and get the EXE out...
Love to create new MODS :)

My complete list of mods until now!

My channel. Do consider subscribing it! :)
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Guide to Prince of Persia tricks (Large Topic)

Post by David »

atrueprincefanfrom18 wrote: July 11th, 2020, 10:45 am 1. Problem with visibility of potions near gates.
2. Problem with visibility of two gates in the same column.
3. Problem with visibility of small pillar next to the gate to the right.
This hack fixes #1, in addition to what I wrote in that post.

For #2 there is this fix, but this fix causes another glitch.
I'm trying to make a better fix.

I don't know what #3 means. Maybe post a screenshot?
User avatar
atrueprincefanfrom18
Site Shah
Site Shah
Posts: 1785
Joined: January 21st, 2020, 2:53 pm
Contact:

Re: Guide to Prince of Persia tricks (Large Topic)

Post by atrueprincefanfrom18 »

David wrote: July 11th, 2020, 11:53 am I don't know what #3 means. Maybe post a screenshot?
Check 0:30 timestamp in the video in this post. Something happens when the gate is starting to raise. Is there a fix for it?

I think it would be great if there's any EXE which fixes all the known glitches instead each modder, trying to fix the glitches one by one. It is like re-inventing the wheel...
Love to create new MODS :)

My complete list of mods until now!

My channel. Do consider subscribing it! :)
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Guide to Prince of Persia tricks (Large Topic)

Post by David »

atrueprincefanfrom18 wrote: July 11th, 2020, 10:45 am 2. Problem with visibility of two gates in the same column.
Search: 0E E8 02 04 0E E8 97 04 0E E8 DE 06
Change to: 0E E8 9B 04 0E E8 E2 06 0E E8 FA 03
(offset in unpacked v1.0: 0xB69B)

Search: 0E E8 7C 03 0E E8 5C 06 0E E8 CE 08
Change to: 0E E8 60 06 0E E8 D2 08 0E E8 74 03
(offset in unpacked v1.0: 0xB721)

Equivalents in SDLPoP:

Code: Select all

in draw_tile():
	draw_tile_anim_topright();
	draw_tile_right();
	draw_tile_anim_right();
change to:
	draw_tile_right();
	draw_tile_anim_right();
	draw_tile_anim_topright();

in redraw_needed():
			draw_tile_anim_topright();
			draw_tile_anim_right();
			draw_tile_anim();
change to:
			draw_tile_anim_right();
			draw_tile_anim();
			draw_tile_anim_topright();
atrueprincefanfrom18 wrote: July 11th, 2020, 12:30 pm
David wrote: July 11th, 2020, 11:53 am I don't know what #3 means. Maybe post a screenshot?
Check 0:30 timestamp in the video in this post. Something happens when the gate is starting to raise. Is there a fix for it?
Thank you!
By the way, the same glitch also happens if you replace the pillar with a wall. (Although who would put a wall next to a gate?)

I already found how to fix the glitch in SDLPoP:

Code: Select all

void __pascal far draw_trob() {
	word var_2;
	var_2 = get_trob_right_pos_in_drawn_room();
	set_redraw_anim(var_2, 1);
	set_redraw_fore(var_2, 1);
	set_redraw_anim(get_trob_right_above_pos_in_drawn_room(), 1);
	set_redraw_fore(get_trob_right_above_pos_in_drawn_room(), 1); // <-- add this
}
The problem is, in the DOS version it's just not possible to add new code without removing something else.
So my workaround is to change the second set_redraw_anim() call to call set_redraw_full() instead.

Search: 0E E8 F6 04
Change to: 0E E8 80 05
(offset in unpacked v1.0: 0xA010)
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Fixing graphical glitches

Post by David »

(Moved these posts into a new topic.)
User avatar
atrueprincefanfrom18
Site Shah
Site Shah
Posts: 1785
Joined: January 21st, 2020, 2:53 pm
Contact:

Re: Fixing graphical glitches

Post by atrueprincefanfrom18 »

David wrote: July 11th, 2020, 1:15 pm (Moved these posts into a new topic.)
Thanks. Can this topic be also considered as a graphical glitch and be moved into this one?

Also this one:

glitch.png

I don't know if this would be fixed by above changes specified...
Love to create new MODS :)

My complete list of mods until now!

My channel. Do consider subscribing it! :)
User avatar
atrueprincefanfrom18
Site Shah
Site Shah
Posts: 1785
Joined: January 21st, 2020, 2:53 pm
Contact:

Re: Fixing graphical glitches

Post by atrueprincefanfrom18 »

Also this one. Let's include all the known bugs and fix all of them to create a single EXE which have all the known graphical glitches fixed. So modder can pick up the EXE and start working on it instead of fixing all of them again and again...
Love to create new MODS :)

My complete list of mods until now!

My channel. Do consider subscribing it! :)
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Fixing graphical glitches

Post by David »

atrueprincefanfrom18 wrote: July 17th, 2020, 9:18 pm Also this one.
I've already posted a fix here: viewtopic.php?p=29620#p29620

I know it's not in the same thread as the original post; Emiliano Fierro made that new thread so all replies to his requests could be together.
But as a downside my replies are now separated from his original posts.
Should I move the three posts linked from the first post into the thread?
User avatar
atrueprincefanfrom18
Site Shah
Site Shah
Posts: 1785
Joined: January 21st, 2020, 2:53 pm
Contact:

Re: Fixing graphical glitches

Post by atrueprincefanfrom18 »

David wrote: July 19th, 2020, 11:32 am Should I move the three posts linked from the first post into the thread?
Yes, would be good for everyone to find all the fixes, so you should merge in my opinion.
Love to create new MODS :)

My complete list of mods until now!

My channel. Do consider subscribing it! :)
User avatar
dmitrys
Developer
Developer
Posts: 195
Joined: October 1st, 2020, 6:05 am

Re: Fixing graphical glitches

Post by dmitrys »

I found 2 glitches in SDLPoP. The first one is caused by a falling tile on top left of the pillar.
glitch1.png
I have seen dropped tiles cause line artifacts in other scenarios but this one seems to be different.

The second one is specific to the dark dungeon palette and is described here.
viewtopic.php?p=30738#p30738
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Fixing graphical glitches

Post by David »

dmitrys wrote: October 21st, 2020, 4:56 am I found 2 glitches in SDLPoP. The first one is caused by a falling tile on top left of the pillar.
With Shift+B I see the blue line is redrawn for one more frame than the pillar in SDLPoP but not in DOS PoP.

Additionally, the loose floor disappears one frame too early, in the same frame as when the blue line is drawn over the pillar.
This led me to examine closely the code which draws the loose floor. The bug was there.

Here is the fix: https://github.com/NagyD/SDLPoP/commit/ ... ba97e14312
User avatar
atrueprincefanfrom18
Site Shah
Site Shah
Posts: 1785
Joined: January 21st, 2020, 2:53 pm
Contact:

Re: Fixing graphical glitches

Post by atrueprincefanfrom18 »

Can this be fixed? It doesn't look too bad now, but I think it would be good to fix it. If you have a drop tile (I didn't test with raise) before the top pillar tile, it seems a bit weird (when the Kid stands on it).

graphical_glitch.png
graphical_glitch.png (3.91 KiB) Viewed 1963 times
Love to create new MODS :)

My complete list of mods until now!

My channel. Do consider subscribing it! :)
User avatar
dmitrys
Developer
Developer
Posts: 195
Joined: October 1st, 2020, 6:05 am

Re: Fixing graphical glitches

Post by dmitrys »

I found another glitch. It happens when a guard falls onto spikes in a different room. SDLPoP draws the guard in the same room.

Original room:
1.PNG
1.PNG (7.48 KiB) Viewed 1932 times
2.PNG
2.PNG (4.26 KiB) Viewed 1932 times
Room to the right where the guard fell:
3.PNG
3.PNG (5.1 KiB) Viewed 1932 times
Edit: I modified the "spiked()" function with code below which makes the spiked guard appear in the correct place. I wonder if that is the best solution.

Code: Select all

	if (Char.room != curr_room) {
		level.guards_tile[Char.room - 1] = -1; // remove guard from the original room
		Char.room = curr_room; // draw guard in the correct room
	}
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Fixing graphical glitches

Post by David »

atrueprincefanfrom18 wrote: October 25th, 2020, 7:07 am Can this be fixed? It doesn't look too bad now, but I think it would be good to fix it. If you have a drop tile (I didn't test with raise) before the top pillar tile, it seems a bit weird (when the Kid stands on it).
Fixed: https://github.com/NagyD/SDLPoP/commit/ ... 38158bb1ac
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Fixing graphical glitches

Post by David »

dmitrys wrote: October 31st, 2020, 12:25 am Edit: I modified the "spiked()" function with code below which makes the spiked guard appear in the correct place. I wonder if that is the best solution.

Code: Select all

	if (Char.room != curr_room) {
		level.guards_tile[Char.room - 1] = -1; // remove guard from the original room
		Char.room = curr_room; // draw guard in the correct room
	}
I tried it and it looks good to me.
However, in some cases the spiked guard disappeared when the prince fell into spikes in the same room.
But I can't reproduce it again.

Maybe it happened with this slightly different fix I tried, I'm not sure.

Code: Select all

	if (Char.room != curr_room) {
		Char.room = curr_room;
		leave_guard();
	}
Anyway, I added your fix: https://github.com/NagyD/SDLPoP/commit/ ... 8121bf8491


(By the way, I think you accidentally swapped the first and the last screenshot in your post.)
Post Reply