|
|
View previous topic - View next topic |
Author |
Message |
DeveloperX 202192397
Joined: 04 May 2003 Posts: 1626 Location: Decatur, IL, USA
|
Posted: Tue May 06, 2003 1:44 am Post subject: Very Confusing Runtime Errors .... |
[quote] |
|
Ok, I've got a problem with my level editor, I've got NO IDEA
where the problem lies, I've tried for hours to get it to work.
Maybe someone here has had this problem, and knows a solution?
Here is the code: save it to a BAS and load it into QB.
(Don't forget to load the QB.QLB library!)
Code: |
DECLARE SUB DrawTile (x!, y!)
DECLARE SUB LoadFont (Fon$)
DECLARE SUB Render ()
DECLARE SUB UI ()
DECLARE SUB DrawCursor (x%, y%)
DECLARE SUB XAsmGetMouse (cx%, dx%, bx%)
DECLARE SUB TurnOffMouse ()
DECLARE SUB TurnOnMouse ()
DECLARE SUB XAsmMouseProc (sw%)
DEFINT A-Z
'*******************************************************
' MOUSE DRIVEN LEVEL EDITOR *
' (C)2003, DEVELOPERX *
' *
' version 0.0.8 *
'*******************************************************
DIM SHARED TILE%(0 TO (16 * 16))
DEF SEG = VARSEG(TILE%(0))
BLOAD "G.PUT", TILE%(0)
DEF SEG
DIM SHARED XAsmMouseDriver(9) '- holds mouse driver ASM code
'-MOUSE DRIVER-------------------------- READ DRIVER ASM
CLEAR
RESTORE
DEF SEG = VARSEG(XAsmMouseDriver(0))
FOR XLAsmBit = 0 TO 17
READ XLAsmCode%
POKE VARPTR(XAsmMouseDriver(0)) + XLAsmBit, XLAsmCode%
NEXT XLAsmBit
'--------------------------------------------------------
'-MOUSE DRIVER----------------------------- ASSEMBLY CODE
DATA &HB8, &H00, &H00, &H55, &H8B, &HEC, &HCD, &H33, &H92
DATA &H8B, &H5E, &H06, &H89, &H07, &H5D, &HCA, &H02, &H00
'--------------------------------------------------------
SCREEN 13
Render
TurnOnMouse
DIM MouseX, MouseY, MouseButtons
TW = 16
TH = 16
Moved = 0
DO
k$ = INKEY$
XAsmGetMouse MouseY, MouseX, MouseButtons
TileX = (MouseX - (MouseX \ TW)) / TW
TileY = (MouseY - (MouseY \ TH)) / TH
IF TileX <> OldTileX THEN Moved = 1
IF TileY <> OldTileY THEN Moved = 1
IF Moved = 1 THEN
IF TileX > -1 AND TileX < 16 THEN
IF TileY > -1 AND TileY < 10 THEN
Render
LOCATE 22, 1: PRINT TileX + 1; ; TileY + 1;
TurnOffMouse
DrawCursor TileX * TW, TileY * TH
TurnOnMouse
END IF
END IF
OldTileX = TileX
OldTileY = TileY
Moved = 0
END IF
IF MouseButtons = 1 THEN
'PSET (MouseX, MouseY)
DrawTile INT(TileX * TW), INT(TileY * TH)
END IF
LOOP UNTIL k$ = CHR$(27)
TurnOffMouse
SUB DrawCursor (x, y)
PSET (x + 8, y), 2
PSET (x, y + 8), 2
PSET (x + 16, y + 8), 2
PSET (x + 8, y + 16), 2
PSET (x, y), 2
PSET (x, y + 16), 2
PSET (x + 16, y), 2
PSET (x + 16, y + 16), 2
END SUB
DEFSNG A-Z
SUB DrawTile (x, y)
PUT (x, y), TILE%
END SUB
SUB Render
FOR x = 0 TO 16 * 16 STEP 16
LINE (x, 0)-(x, 16 * 10), 20
NEXT x
FOR y = 0 TO 16 * 10 STEP 16
LINE (0, y)-(16 * 16, y), 20
NEXT y
END SUB
SUB TurnOffMouse
DEFINT A-Z
XAsmMouseProc 2
END SUB
SUB TurnOnMouse
DEFINT A-Z
'XAsmMouseProc 1
XAsmMouseProc 3
END SUB
SUB XAsmGetMouse (cx, dx, bx)
'- gets mouse coordinates & button states
POKE VARPTR(XAsmMouseDriver(4)), &H92
CALL absolute(cx, VARPTR(XAsmMouseDriver(0)))
' cx=cx / 8 'NOT FOR GFX MODES!
POKE VARPTR(XAsmMouseDriver(4)), &H91
CALL absolute(dx, VARPTR(XAsmMouseDriver(0)))
dx = dx / 2 ' adjust 25x80
POKE VARPTR(XAsmMouseDriver(4)), &H93
CALL absolute(bx, VARPTR(XAsmMouseDriver(0)))
END SUB
SUB XAsmMouseProc (sw)
'- executes an instruction for mouse driver:
' 0 - reset mouse
' 1 - show mouse pointer
' 2 - hide mouse pointer
' 3 - get coordinates
POKE VARPTR(XAsmMouseDriver(0)) + 1, sw
CALL absolute(c, VARPTR(XAsmMouseDriver(0)))
END SUB
|
use PP256 or any other app to make a 16*16 tile named G.PUT
place it into the active folder.
Any help would be greatly appreciated.
Thanks. _________________ Principal Software Architect
Rambling Indie Games, LLC
See my professional portfolio
|
|
Back to top |
|
|
janus Mage
Joined: 29 Jun 2002 Posts: 464 Location: Issaquah, WA
|
Posted: Tue May 06, 2003 1:46 am Post subject: |
[quote] |
|
Why not tell us WHAT THE ERROR MESSAGES ARE? :p
|
|
Back to top |
|
|
DeveloperX 202192397
Joined: 04 May 2003 Posts: 1626 Location: Decatur, IL, USA
|
Posted: Tue May 06, 2003 1:56 am Post subject: |
[quote] |
|
Janus wrote: | Why not tell us WHAT THE ERROR MESSAGES ARE? :p |
oops!
ok, the program runs, draws the gridmap all fine and good.. right?
well, when you click the mouse button, it closes qb.
sometimes I get a windows box saying error at address: ????:????
but others it just closes qb.
It doesn't make any sense.
btw, I thought I typed this part in the last msg, oops. _________________ Principal Software Architect
Rambling Indie Games, LLC
See my professional portfolio
|
|
Back to top |
|
|
|
Page 1 of 1 |
All times are GMT
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|