Oh - btw: I
*DID* try to "cheat" a little: I decided to build the room longhand, because the light seems to like this method better than loading .x files. I'll show you what I mean:
#CONSTANT App = "DieRoller CrapShoot"
#CONSTANT Cpr = "Copyright 2004 by Gene's Machine"
#CONSTANT Pls = "[ ...Please Wait... ]"
#CONSTANT texWood = 1
#CONSTANT texStone = 2
#CONSTANT texHexen = 3
#CONSTANT texTiles = 4
#CONSTANT texBricks = 5
#CONSTANT texBubbles = 6
#CONSTANT RoomFloor = 1
#CONSTANT RoomCeiling = 2
#CONSTANT RoomLeftWall = 3
#CONSTANT RoomRightWall = 4
#CONSTANT RoomFrontWall = 5
#CONSTANT DiceTable = 6
#CONSTANT Die1 = 7
#CONSTANT Die2 = 8
#CONSTANT windowSill1 = 11
#CONSTANT windowSill2 = 12
#CONSTANT windowSill3 = 13
#CONSTANT vertSimpleText = 1
#CONSTANT overHeadLight 1
DieRandomizer = 0
DIM d6(2)
d6(1) = 0
d6(2) = 0
RANDOMIZE (TIMER())
SET TEXT FONT "Arial"
SET TEXT SIZE 16
SET TEXT TO BOLD
SET TEXT TRANSPARENT
SYNC OFF
SYNC RATE 60
GOSUB _SetUpTheWorld:
MAKE OBJECT SPHERE 25, 3, 20, 20
COLOR OBJECT 25, RGB(127, 127, 127)
GHOST OBJECT ON 25
POSITION OBJECT 25, 0, 0, 0
LOOP MUSIC 1
SYNC
DO
` Figure out where the camera is...
xCam# = CAMERA ANGLE X (0)
yCam# = CAMERA ANGLE Y (0)
zCam# = CAMERA ANGLE Z (0)
xLight# = LIGHT POSITION X(overHeadLight)
yLight# = LIGHT POSITION Y(overHeadLight)
zLight# = LIGHT POSITION Z(overHeadLight)
` Respond to the keys...
IF UPKEY() = 1 THEN xCam# = xCam# - 1
IF DOWNKEY() = 1 THEN xCam# = xCam# + 1
IF LEFTKEY() = 1 THEN yCam# = yCam# - 2
IF RIGHTKEY() = 1 THEN yCam# = yCam# + 2
`IF SPACEKEY() = 1 THEN RollTheDice
IF KEYSTATE(74) = 1 THEN yLight# = yLight# + 1 `U
IF KEYSTATE(78) = 1 THEN yLight# = yLight# - 1 `D
IF KEYSTATE(77) = 1 THEN xLight# = xLight# + 1 `R
IF KEYSTATE(75) = 1 THEN xLight# = xLight# - 1 `L
IF KEYSTATE(72) = 1 THEN zLight# = zLight# + 1 `F
IF KEYSTATE(80) = 1 THEN zLight# = zLight# - 1 `B
IF KEYSTATE(76) = 1 THEN xLight# = 0 : yLight# = 0 : zLight# = 0 ` CENTER
` IF KEYSTATE(73) = 1 THEN POSITION OBJECT RoomFrontWall, (OBJECT POSITION X(RoomFrontWall) + 1), OBJECT POSITION Y(RoomFrontWall), OBJECT POSITION Z(RoomFrontWall)
` IF KEYSTATE(71) = 1 THEN POSITION OBJECT RoomFrontWall, (OBJECT POSITION X(RoomFrontWall) - 1), OBJECT POSITION Y(RoomFrontWall), OBJECT POSITION Z(RoomFrontWall)
` IF KEYSTATE(79) = 1 THEN POSITION OBJECT RoomFrontWall, OBJECT POSITION X(RoomFrontWall), OBJECT POSITION Y(RoomFrontWall), (OBJECT POSITION Z(RoomFrontWall) + 1)
` IF KEYSTATE(81) = 1 THEN POSITION OBJECT RoomFrontWall, OBJECT POSITION X(RoomFrontWall), OBJECT POSITION Y(RoomFrontWall), (OBJECT POSITION Z(RoomFrontWall) - 1)
POSITION LIGHT overHeadLight, xLight#, yLight#, zLight#
POSITION OBJECT 25, xLight#, yLight#, zLight#
TEXT 10, 10, STR$(xLight#) + ":" + STR$(yLight#) + ":" + STR$(zLight#)
` TEXT 10, 40, STR$(OBJECT POSITION X(RoomFrontWall)) + ":" + STR$(OBJECT POSITION Y(RoomFrontWall)) + ":" + STR$(OBJECT POSITION Z(RoomFrontWall))
`TEXT 10, 10, STR$(SCANCODE())
` 74 - Grey KeyPad "-" Key
` 78 - Grey KeyPad "+" Key
` 71 - KeyPad '7/Home'
` 72 - KeyPad '8/UP'
` 73 - KeyPad '9/PgUp'
` 75 - KeyPad '4/LEFT'
` 76 - KeyPad '5'
` 77 - KeyPad '6/RIGHT'
` 79 - KeyPad '1/End'
` 80 - KeyPad '2/DOWN'
` 81 - KeyPad '3/PgDn'
` 82 - KeyPad '0/Ins'
` 83 - KeyPad './Del'
`156 - KeyPad 'ENTER'
` 55 - KeyPad '*'
`181 - KeyPad '/'
`183 - KeyPad 'PrintScreen/SysReq'
` 70 - KeyPad 'Scroll Lock'
` 69 - KeyPad 'NumLock'
`197 - KeyPad 'Pause/Break'
` 58 - 'CapsLock'
`210 - KeyPad 'Insert'
`199 - KeyPad 'Home'
`201 - KeyPad 'PageUp'
`211 - KeyPad 'Delete'
`207 - KeyPad 'End'
`209 - KeyPad 'PageDown'
`200 - KeyPad 'UP'
`208 - KeyPad 'DOWN'
`203 - KeyPad 'LEFT'
`205 - KeyPad 'RIGHT'
` 57 - SpaceBar
` 42 - Left Shift Key
` 54 - Right Shift Key
` 29 - Left Control Key
`157 - Right Control Key
` 56 - Left Alt Key
`184 - Right Alt Key
`219 - Left Windoze Key
`220 - Right Winddoze Key
` 28 - BIG Enter Key
` 14 - BackSpace Key
` 15 - Tab Key
`221 - Windoze Menu Key
` 59 - F1 Key
` 60 - F2 Key
` 61 - F3 Key
` 62 - F4 Key
` 63 - F5 Key
` 64 - F6 Key
` 65 - F7 Key
` 66 - F8 Key
` 67 - F9 Key
` 68 - F10 Key
` 87 - F11 Key
` 88 - F12 Key
` 27, -37-37, 0
` Don't break the limits!
IF (yCam# > 40)
yCam# = 40
ENDIF
IF (yCam# < -40)
yCam# = -40
ENDIF
IF (xCam# > 35)
xCam# = 35
ENDIF
IF (xCam# < 10) ` Was 27
xCam# = 10
ENDIF
` Reposition the camera accordingly...
XROTATE CAMERA 0, xCam#
YROTATE CAMERA 0, yCam#
`ZROTATE CAMERA 0, zCam#
` Check for exit sequence...
IF (ESCAPEKEY() > 0)
EXIT
ENDIF
` Update the screen...
SYNC
LOOP
STOP MUSIC 1
END ` Application is finished...
_SetUpTheWorld:
INK RGB(255, 255, 255), RGB(0, 0, 0)
CLS
INK RGB(255, 255, 0), RGB(0, 0, 0)
CENTER TEXT (SCREEN WIDTH()/2), ((SCREEN HEIGHT()/2) - TEXT HEIGHT(App)), App
INK RGB(255, 0, 0), RGB(0, 0, 0)
CENTER TEXT (SCREEN WIDTH()/2), (SCREEN HEIGHT()/2), "LOADING..."
INK RGB(127, 0, 255), RGB(0, 0, 0)
CENTER TEXT (SCREEN WIDTH()/2), ((SCREEN HEIGHT()/2) + (TEXT HEIGHT(Pls) * 2)), Pls
SYNC
LOAD MUSIC "QuickieLoop.mp3", 1
SET MUSIC VOLUME 1, 50
` SET UP THE CAMERA
SET CURRENT CAMERA 0
SET CAMERA RANGE 1,10000
POSITION CAMERA 0, 0, 35, -85
XROTATE CAMERA 0, 27
COLOR BACKDROP 0, RGB (0, 127, 255)
BACKDROP ON 0
` Set up the scene lighting...
SET NORMALIZATION ON
SET AMBIENT LIGHT 33
COLOR AMBIENT LIGHT RGB(255,255,255)
HIDE LIGHT 0
POSITION LIGHT 0, 0, 0, 0
MAKE LIGHT overHeadLight
SET POINT LIGHT overHeadLight, 0, 0, 0
COLOR LIGHT overHeadLight, RGB (255, 255, 255)
POSITION LIGHT overHeadLight, 0, 0, 0
SET LIGHT RANGE overHeadLight, 2000
AUTOCAM OFF
` ...first, load the texture bank...
LOAD IMAGE "DeepWood.bmp", texWood, 0
LOAD IMAGE "FlagStone.bmp", texStone, 0
LOAD IMAGE "HexStones.bmp", texHexen, 0
LOAD IMAGE "FloorTiles.bmp", texTiles, 0
LOAD IMAGE "WallBricks.bmp", texBricks, 0
LOAD IMAGE "WallBubbles.bmp", texBubbles, 0
` Start by building the room...
` Put the floor down first...
MAKE OBJECT BOX RoomFloor, 250, 1, 200
SET OBJECT CULL RoomFloor, 1
SET OBJECT LIGHT RoomFloor, 1
SET OBJECT AMBIENT RoomFloor, 1
TEXTURE OBJECT RoomFloor, texStone
SCALE OBJECT TEXTURE RoomFloor, 10, 10
SET OBJECT SMOOTHING RoomFloor, 60
POSITION OBJECT RoomFloor, 0, -50, 0
`SET REFLECTION SHADING ON RoomFloor
` ...then put in the left-handed wall...
MAKE OBJECT BOX RoomLeftWall, 10, 80, 200
SET OBJECT CULL RoomLeftWall, 1
SET OBJECT LIGHT RoomLeftWall, 1
SET OBJECT AMBIENT RoomLeftWall, 1
TEXTURE OBJECT RoomLeftWall, texBricks
SCALE OBJECT TEXTURE RoomLeftWall, 9, 5
SET OBJECT SMOOTHING RoomLeftWall, 10
POSITION OBJECT RoomLeftWall, -92, 10, -50
`SET REFLECTION SHADING ON RoomLeftWall
` ...then put in the right-handed wall...
MAKE OBJECT BOX RoomRightWall, 10, 80, 200
SET OBJECT CULL RoomRightWall, 1
SET OBJECT LIGHT RoomRightWall, 1
SET OBJECT AMBIENT RoomRightWall, 1
TEXTURE OBJECT RoomRightWall, texBricks
SCALE OBJECT TEXTURE RoomRightWall, 9, 5
SET OBJECT SMOOTHING RoomRightWall, 10
POSITION OBJECT RoomRightWall, 92, 10, -50
`SET REFLECTION SHADING ON RoomLeftWall
` ...then put in the front-end wall...
MAKE OBJECT BOX RoomFrontWall, 200, 80, 10
SET OBJECT CULL RoomFrontWall, 1
SET OBJECT LIGHT RoomFrontWall, 1
SET OBJECT AMBIENT RoomFrontWall, 1
TEXTURE OBJECT RoomFrontWall, texBricks
SCALE OBJECT TEXTURE RoomFrontWall, 9, 5
SET OBJECT SMOOTHING RoomFrontWall, 10
POSITION OBJECT RoomFrontWall, 0, 10, 50
`SET REFLECTION SHADING ON RoomLeftWall
MAKE OBJECT BOX windowSill1, 25, 35, 15
`windowSill2
`windowSill3
` then put in the ceiling...
MAKE OBJECT BOX RoomCeiling, 250, 1, 200
SET OBJECT CULL RoomCeiling, 1
SET OBJECT LIGHT RoomCeiling, 1
SET OBJECT AMBIENT RoomCeiling, 1
TEXTURE OBJECT RoomCeiling, texTiles
SCALE OBJECT TEXTURE RoomCeiling, 12, 12
SET OBJECT SMOOTHING RoomCeiling, 60
POSITION OBJECT RoomCeiling, 0, 50, 0
`SET REFLECTION SHADING ON RoomFloor
`DiceTable
`Die1
`Die2
` ROTATE OBJECT Die1, 0, GetDieSpin(), 0
` ROTATE OBJECT Die2, 0, GetDieSpin(), 0
SHOW OBJECT RoomFloor
SYNC
RETURN
FUNCTION RollTheDie()
Result = 0
DieRandomizer = (DieRandomizer + 1)
IF (DieRandomizer = 5)
RANDOMIZE (TIMER())
DieRandomizer = 0
ENDIF
Result = RND(6)
ENDFUNCTION (Result)
FUNCTION GetDieSpin()
Result = 0
DieRandomizer = (DieRandomizer + 1)
IF (DieRandomizer = 5)
RANDOMIZE (TIMER())
DieRandomizer = 0
ENDIF
Result = RND(360)
ENDFUNCTION (Result)
No, it's far from complete. But when you pilot the light around the room, the textures
interact with it! So, making the room using "MAKE OBJECT ..." seems to have an advantage over loading .x files - but I could also be ignorant of something, thus hamstringing my own development cycle. (Actually, this is
exactly the case...)
Nonetheless, you'll see a rectangle built and called [
WindowSill1] --- I had intended to move it into position on the wall, and cut it out of the wall using CSG (constructive solid geometry - I know you already know, but I was making reference to avoid confusion with the DBPro [
Compile CSG] command...).
Well, Murphy's Military Law states that "
the problem with taking the easy way out is that the enemy has already mined it." No joke. There are (to my research) no CSG commands for DBPro objects created on-the-fly. So I'm back to Square 1: trying to figure out what I'm doing wrong with .x files.
Hey - it could be something as easy as the way I export the objects: I'm far from being a genius, the answers could be right there, and I'm too dumb to see 'em.
Once again, thank you guys for your time and talents: one day I might be able to provide help to others as well.
Have a terrific day!!!
LongFist
SuperProgrammer For Hire