Videopac / Odyssey2 forum
December 09, 2022, 07:20:29 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: The forum will disappear in April 2023 please check this topic!
 
   Home   Help Login Register links videopac.nl  
Pages: 1 [2]   Go Down
  Print  
Author Topic: Wizards of Wor  (Read 13675 times)
Rene_G7400
Pedit5
I take the Videopac and leave the Canoli!
*
Posts: 2519



WWW
« Reply #15 on: January 24, 2009, 03:48:58 PM »

Do you mean using register A2 of the VDC?

Yes...I cant seem to get it to work at all.

What might be confusing is that the same register (A2) is used to set and read the collisions. You have to set it after each Vsync. For example, if you want to determine the collisions between sprite 0 and other objects, you set bit 0 of A2 after each Vsync (so write 01 to A2). At the end of each frame (or at the beginning of the next frame) you read A2. Once you've read it, it will be cleared, so you probably need to store the result somewhere. If, for example, there has been a collision with sprite 1, bit 1 of A2 will be set. (sprites numbered from 0 to 3 and bits numbered from 0 to 7.)
If you use the default Vsync routines of the BIOS (jmp 001ah at location 406h), then A2 has already been read, and the result has been stored in intram 3d.
Logged
Gorf
Attacked the Timelord
***
Posts: 187


Gorfians take no prisoners!


« Reply #16 on: January 24, 2009, 06:36:45 PM »

Do you mean using register A2 of the VDC?

Yes...I cant seem to get it to work at all.

What might be confusing is that the same register (A2) is used to set and read the collisions. You have to set it after each Vsync. For example, if you want to determine the collisions between sprite 0 and other objects, you set bit 0 of A2 after each Vsync (so write 01 to A2). At the end of each frame (or at the beginning of the next frame) you read A2. Once you've read it, it will be cleared, so you probably need to store the result somewhere. If, for example, there has been a collision with sprite 1, bit 1 of A2 will be set. (sprites numbered from 0 to 3 and bits numbered from 0 to 7.)
If you use the default Vsync routines of the BIOS (jmp 001ah at location 406h), then A2 has already been read, and the result has been stored in intram 3d.



That could be quite a problem then. That means I'd have to check for a collision
oen frame per object. The fact that it is tied to the vbl makes it less accurate
since you can only check against one particular object each frame.


Logged
Rene_G7400
Pedit5
I take the Videopac and leave the Canoli!
*
Posts: 2519



WWW
« Reply #17 on: January 25, 2009, 02:44:32 AM »

It's not really tied to Vbl, but that's how it's used normally. You could do mid-screen A2 read/set instructions if you want. I suppose you can set more than one bit of A2, but I've never tried it.
Logged
Gorf
Attacked the Timelord
***
Posts: 187


Gorfians take no prisoners!


« Reply #18 on: January 25, 2009, 02:59:46 AM »

It's not really tied to Vbl, but that's how it's used normally. You could do mid-screen A2 read/set instructions if you want. I suppose you can set more than one bit of A2, but I've never tried it.



I tried it as you described and no go, so I'll try it in line.
Logged
TedFoolery
Attacked the Timelord
***
Posts: 108


« Reply #19 on: January 25, 2009, 03:09:56 AM »

you could also skip the collision register and use some math.
If (abs(x1-x2)<3 and abs(y1-y2)<3) then a collision occured.

You then wouldn't be tied to the vbl and could test as many 'objects' as you needed.

Logged
Gorf
Attacked the Timelord
***
Posts: 187


Gorfians take no prisoners!


« Reply #20 on: January 25, 2009, 06:44:46 AM »

you could also skip the collision register and use some math.
If (abs(x1-x2)<3 and abs(y1-y2)<3) then a collision occured.

You then wouldn't be tied to the vbl and could test as many 'objects' as you needed.



That would be one way but for the grid I have an idea but it needs some ironing out.
Perhaps some of you guys can help me think this out.

The values I got below are running placement tests of characters on all
vertical, then all horizontal grid lines to find their placement and in doing
so, I've discovered the following.

All tops of horizontal grid lines land on a mutliple of 24.
All left sides of vertical grid lines land on a mutiple of 16(offset from the left screen edge +8.)
(...with all the left over bits they could have made the grids reach to the border, where the
sprites and character limts go to. go figure...anyway)

There are 9 horizontals down starting at postions(the top of the horizontal lines)
and 8 verticals down both top to bottom, with vertical not using the last value.

24,48,72, 96,120,144, 168,192,216<- last position

Now, there is no easy way to divide by 24, but 8 goes into 24, 3 times
so instead I divide by 8 or n>>3 which is 27(27/9=3) values so I use a
table with bitmasks for 3 each of 9 values. 3 * 9 = 27 Smiley a bit of a memory
waste but hang with me.

Code:
BitMaskTable:
%00000001,%00000001,%00000001
%00000000,%00000010,%00000010
%00000000,%00000100,%00000100
%00000000,%00001000,%00001000
%00000000,%00010000,%00010000
%00000000,%00100000,%00100000
%00000000,%01000000,%01000000
%10000000,%10000000,%10000000
%00000001,%00000001,%00000001 <---- bit mask for last row of horizontal gird lines

BitMaskIndex = Player.Y>>3;               // find grid bit index
BitMask = BitMaskTable[BitMaskIndex]; // bit mask for testing grid byte with


Since both vertical and horizontal grid line bits in a particular grid
line byte set from 0 to 7 or from top to bottom, this here bitmask
is the bit test for any particular grid line. I now have a value to
ANL against the grid line register value. I will use this to test to
see if this grid bit is set. This is how I find which grid line byte,
vertical or horizontal, to ANL the mask against.

There are 10 verticals across starting at postions(the leftmost of the vertical line)
and 9 horizontals across both top to bottom, with Horizontal not using the last value.

8,24,40,56,72, 88,104,120,136,152<- last position

Since 16 is a cinch for shift divides I only need to do a n>>4
I now have the byte offset into any of the vertical or horizontal
grid registers.

ByteOffset = Player.x>>4;                              // get the byte offset

if(VerticalGrids[ByteOffset] & Bitmask)
{
  forbid horizontal negative movement
}

if(VerticalGrids[ByteOffset+1] & Bitmask)
{
  forbid horizontal positive movement
}

if(HorizontalGrids[ByteOffset] & Bitmask)
{
  forbid vertical negative movement
}

if(HorizontalGrids[ByteOffset+1] & Bitmask)
{
  forbid vertical positive movement
}



Im tired.... Tongue Good nite folks


« Last Edit: January 25, 2009, 08:36:11 PM by Gorf » Logged
timdu
Freedom Fighter
****
Posts: 316



« Reply #21 on: April 06, 2012, 09:40:55 PM »

I would love to see Wizard of WOR !
Looking at KC Munchkin,  I always imagined that it could be done.
I hope work continues on this!

Logged
Pages: 1 [2]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!