Platform Game DevKit thread

Pagina 2/2
1 |

Van flyguille

Prophet (3028)

afbeelding van flyguille

09-05-2016, 00:34

Ok guys, the code has one problem, the scrolling on demand routine has a bug, when the MapX axis pass from $7FFF to $8000, is to say, passing the middle of the map horizontally. Weird that it don't happens before because I fully tested it walking to the right border, but maybe the error was inserted in a later cleanup.

So, the problem is that it moves the map to the left border, 8 screens away from the action, It results in a instant game over, because all characters are dissapear by farness including players.

So, I will work in the problem.

Van flyguille

Prophet (3028)

afbeelding van flyguille

09-05-2016, 01:04

and the problem is found here...

			ex de, hl
			ld hl, (IdealMapTileOffsetX)
			ld c, h					; Save the sign for map boundaries check.
			add hl, de
			ld (IdealMapTileOffsetX), hl
			ld b, h					; Save the sign for map boundaries check.
			ex de, hl




			ld a, c					; Apply map-size-limits on ideal-visual-scope variables.
			xor b
			rla
			jp nc, .XMapOk				; Jump is most usual.

			bit 7, c
			jr nz, .XMapRight

			ld hl, 0
			ld (IdealMapTileOffsetX), hl
			jp .XMapOk

.XMapRight:		ld hl, 65536 - 256 * 16
			ld (IdealMapTileOffsetX), hl

the XOR was a bad idea..., well, it is a good idea, but bad implementation.

The idea was, if the sign of IdealMapPosition, goes from 1 to 0, it is overflowing the right border....
The other idea was, if the sign goes from 0 to 1, it is overflowing the left border....
But about the X axis, it is also true for passing the middle of the map!, and CHAN the screen gets in the far far west!.

Van flyguille

Prophet (3028)

afbeelding van flyguille

09-05-2016, 02:02

fixed adding 5 lines.

			ex de, hl
			ld hl, (IdealMapTileOffsetX)
			ld c, h					; Save the sign for map boundaries check.
			add hl, de
			ld (IdealMapTileOffsetX), hl
			ld b, h					; Save the sign for map boundaries check.
			ex de, hl




			ld a, c					; Apply map-size-limits on ideal-visual-scope variables.
			xor b
			rla
			jp nc, .XMapOk				; Jump is most usual.

			ld a, c
			rla
			xor c					; It must rule out that is not passing the middle of the map as the X axis goes the full range from 0 to $FFFF.
			and $80					; it compares if the bit6 of the original MSB is equal to bit7. If both are equal it means edge overflow, not middle pass.
			jr nz, .XMapOk

			bit 7, c
			jr nz, .XMapRight

			ld hl, 0
			ld (IdealMapTileOffsetX), hl
			jp .XMapOk

.XMapRight:		ld hl, 65536 - 256 * 16
			ld (IdealMapTileOffsetX), hl

Van flyguille

Prophet (3028)

afbeelding van flyguille

11-05-2016, 20:26

There is another fix, wasn't a bug, but it will improve the speech scripting be sorted as the help docs says.


TestIfIsRoomDoor:	ld l, (ix + Sprite.MapTx)		; Test if the player is on a room door. IN IX = player. OUT Z = is on room door, B = Map MSB.
			ld h, (ix + Sprite.MapTy)
			ld a, h
			and 1
			rrc l
			rrc l
			rla
			rlc l
			rlc l
			rla
			ld (RoomDoorSubClass), a		; Save subclass of the door.

			call GetMapTileNumber			; IN H = ty, L = tx (range 0-255tx, 0-127ty).
			ld b, a					; OUT AC = Tile number. CF = 0. OUT HL = tile address +1.

			and MapAttribs.MaskMajor
			cp MapAttribs.Major.RoomDoor
			ret z

			ld a, (ix + Sprite.MapOx)
			add a, $E0
			ld a, (ix + Sprite.MapTx)
			adc a, 0
			ld l, a
			ld h, (ix + Sprite.MapTy)

			ld a, h
			and 1
			rrc l
			rrc l
			rla
			rlc l
			rlc l
			rla
			ld (RoomDoorSubClass), a		; Save subclass of the door.

			call GetMapTileNumber			; IN H = ty, L = tx (range 0-255tx, 0-127ty).
			ld b, a					; OUT AC = Tile number. CF = 0. OUT HL = tile address +1.

			and MapAttribs.MaskMajor
			cp MapAttribs.Major.RoomDoor
			ret

Just overwrite the old routine.

Van flyguille

Prophet (3028)

afbeelding van flyguille

11-05-2016, 20:46

guest what!, that last routine, was reversed, when I did a backward copy of the source file, weeks ago.

In that last routine is missing a feature, it don't close the business after X knocks!. And that feature was included in that routine.

So, seems like I forget to rewrite it, after losing the last modifications. But just now that I am working with speechs I noticed that.

Van flyguille

Prophet (3028)

afbeelding van flyguille

11-05-2016, 21:21

this is the complete routine, with all the features

TestIfIsRoomDoor:	ld l, (ix + Sprite.MapTx)		; Test if the player is on a room door. IN IX = player. OUT Z = is on room door, B = Map MSB.
			ld h, (ix + Sprite.MapTy)
			ld a, h
			and 1
			rrc l
			rrc l
			rla
			rlc l
			rlc l
			rla
			ld (RoomDoorSubClass), a		; Save subclass of the door.

			call GetMapTileNumber			; IN H = ty, L = tx (range 0-255tx, 0-127ty).
			ld b, a					; OUT AC = Tile number. CF = 0. OUT HL = tile address +1.

			and MapAttribs.MaskMajor
			cp MapAttribs.Major.RoomDoor
			jr z, .RoomDoor

			ld a, (ix + Sprite.MapOx)
			add a, $E0
			ld a, (ix + Sprite.MapTx)
			adc a, 0
			ld l, a
			ld h, (ix + Sprite.MapTy)

			ld a, h
			and 1
			rrc l
			rrc l
			rla
			rlc l
			rlc l
			rla
			ld (RoomDoorSubClass), a		; Save subclass of the door.

			call GetMapTileNumber			; IN H = ty, L = tx (range 0-255tx, 0-127ty).
			ld b, a					; OUT AC = Tile number. CF = 0. OUT HL = tile address +1.

			and MapAttribs.MaskMajor
			cp MapAttribs.Major.RoomDoor
			ret nz

.RoomDoor:		push af					; It must countdown the knocks allowed and close the business if required.
			push bc
			push hl

			inc hl					; Next tile to the right. And it don't support roomdoors on the right border of the map.
			inc hl

			ld a, (hl)
			and MapAttribs.MaskMajor
			cp MapAttribs.Major.Nothing
			jr nz, .CloseIt

			ld a, (hl)
			and MapAttribs.MaskMinor
			and a
			jr z, .CloseIt

			sub 2
			ld (hl), a

			pop hl
			pop bc
			pop af

			ret

.CloseIt:		dec hl
			dec hl

			ld a, (hl)				; It don't support going from tile 255 to 256, anyway tile 255 by structure used for others purposes.
			and MapAttribs.MaskTileNumber		; Remove the attributes.
			ld (hl), a

			dec hl
			inc (hl)				; Change to the "Closed" related tile.

			pop hl
			pop bc
			pop af

			ret


Van Paulo Garcia

Supporter (9)

afbeelding van Paulo Garcia

06-06-2016, 01:26

Hi

I saw the news about the Platform Game devkit, but the links are down. Do you have an ETA when you are able to bring them back online? I am curious about it, and looking forward to use the software to write something for Vintage is The New Old.

If you want, I could add your files on our server while you are working on your own.

Cheers

Paulo

Pagina 2/2
1 |