Ok guys. I wrote up a core that should reproduce the glitch. To reproduce the glitch, simply hold Control, press S, save your DAT file, then hold Control, press O, open your DAT file. You will notice NO objects appear on the screen. The core is set to delete all old objects after a load and load the new 1s onto the screen at the DAT file's given coordinates of position, rotation, and scale for EACH object that was saved.
TestSave.dba:
Rem Project: TestSave
Rem Created: Friday, December 17, 2010
Rem ***** Main Source File *****
sync on
sync rate 60
#include "filereq.dba"
set display mode screen width(), screen height(), screen depth(), 1
reqptr as REQUESTER_PTRDATA
InitFileReq()
#constant SAVE_OBJ 31
#constant OPEN_OBJ 24
`message box type constants
global MBOK = 0x0
global MBOKCANCEL = 0x1
global MBABORTRETRYIGNORE = 0x2
global MBYESNOCANCEL = 0x3
global MBYESNO = 0x4
global MBRETRYCANCEL = 0x5
global MBYES = 0x6
global MBNO = 0x7
global WMCLOSE = 0x10
autocam off
set ambient light 100
for x=1 to 3
make_object(x)
next x
position camera 5,1,-5
point camera object position x(3), object position y(3), object position z(3)
do
move camera (keystate(17)-keystate(31) or upkey()-downkey())*1
turn camera left (keystate(30)-keystate(32) or leftkey()-rightkey())*1
oldkeys=keys
keys=keystate(SAVE_OBJ)
oldkeyo=keyo
keyo=keystate(OPEN_OBJ)
if controlkey()
if oldkeys<>keys
if keys
string1$="Save"
endif
else
if oldkeyo<>keyo
if keyo
string1$="Open"
endif
endif
endif
endif
if string1$="Open"
fileopen=FileReqOpen("Open...",get dir$(),".dat (*.dat)|*.dat|")
if fileopen
if file exist(ReqFileName())
msgbox("WARNING!","Please Wait, loading file...",MBOK)
select ReqFileExt()
case ".dat"
dat=1
close file 1
open to read 1,ReqFilename()
read long 1,magic
if magic=1498123
for i=1 to object count()
filename$=""
for j=1 to 32
read byte 1,_byte
filename$=filename$+chr$(_byte)
next j
if object exist(i)
delete objects i,object count()
else
if file exist(filename$)
Load_Object(i,filename$)
//Position
ox#=x#
read float 1,x#
oy#=y#
read float 1,y#
oz#=z#
read float 1,z#
if (ox#<>x# and oy#<>y# and oz#<>z#)
if (x# and y# and z#)
position object i,x#,y#,z#
endif
endif
//Rotation
read float 1,x#
read float 1,y#
read float 1,z#
rotate object i,x#,y#,z#
//Scale
read float 1,x#
read float 1,y#
read float 1,z#
scale object i,x#,y#,z#
close file 1
endif
endif
next i
endif
endcase
endselect
dat=0
string1$=""
if file open(1)
msgbox("WARNING!","File loaded successfully!",MBOK)
string1$=""
endif
endif
else
string1$=""
endif
endif
if string1$="Save"
filesave=FileReqSave("Save...",get dir$(),".dat (*.dat)|*.dat|")
if ReqFileExt()=".dat"
open to write 1,ReqFilename()
open to write 3,ReqFilename()+str$(1)
write long 1,1498123
write string 3,str$(1498123)
write string 3,str$(object count())
if object count()<>0
for i=1 to object count()
if object exist(i)
filename$=str$(i)+".dbo"
if file exist(filename$) then delete file filename$
for j=1 to 32
write byte 1,asc(mid$(filename$,j))
next j
write string 3,filename$
save object filename$,i
//Position
write string 3,"POSITION:"
write float 1,object position x(i)
write float 1,object position y(i)
write float 1,object position z(i)
write string 3,str$(object position x(i))
write string 3,str$(object position y(i))
write string 3,str$(object position z(i))
//Rotation
write string 3,"ROTATION:"
write float 1,object angle x(i)
write float 1,object angle y(i)
write float 1,object angle z(i)
write string 3,str$(object angle x(i))
write string 3,str$(object angle y(i))
write string 3,str$(object angle z(i))
//Scale
write string 3,"SCALE:"
write float 1,object scale x(i)
write float 1,object scale y(i)
write float 1,object scale z(i)
write string 3,str$(object scale x(i))
write string 3,str$(object scale y(i))
write string 3,str$(object scale z(i))
endif
next i
msgbox("",ReqFileName(),MBOK)
if file exist(ReqFileName())
msgbox("WARNING!","File written successfully!",MBOK)
else
msgbox("WARNING","File does not exist...",MBOK)
endif
close file 1
close file 3
else
msgbox("WARNING!","There are no objects on the map...",MBOK)
endif
endif
string1$=""
endif
//text
ink rgb(0, 255, 0)
center text screen width()/2, screen height()/2, "Control+S to Save DAT file"
center text screen width()/2, screen height()/2+20, "Control+O to Open DAT file"
center text screen width()/2, screen height()/2+40, "W/A/S/D / Arrow keys - Move / Turn"
ink rgb(255, 255, 255)
sync
loop
for x=1 to object count()
delete objects x, object count()
next x
end
`the actual message box function
function msgbox(caption as string, msg as string, msgtype as dword)
returnval as dword
load dll "user32.dll", 1
hwnd as dword : hwnd = CALL DLL (1,"GetForegroundWindow")
returnval = call dll(1, "MessageBoxA", hwnd, msg, caption, msgtype)
delete dll 1
endfunction returnval
function Load_Object(id,file$)
if object exist(id)
load object file$,id
endif
endfunction id
function make_object(obj)
select obj
//cube
case 1
make object cube obj, 10
endcase
//cone
case 2
make object cone obj, 10
endcase
//sphere
case 3
make object sphere obj, 10
endcase
endselect
position object obj, obj*5, 1, obj*5
scale object obj, obj*10, obj*10, obj*10
rotate object obj, obj*10, obj*10, obj*10
endfunction obj
filereq.dba:
Rem *** Include File: FileReq_Include.dba ***
Rem Created: 17/01/01 14:42:40 with Patch 3.1
remstart
REQUIREMENTS:
1) reqptr as REQUESTER_PTRDATA and InitFileReq() should both be placed
at the top of your program. InitFileReq() only needs to be called once.
LIMITATIONS:
1) Cannot be used in Fullscreen Exclusive Mode. You won't see anything if
you try because the requester will open behind these displays, if that
happens then press the Escape key to cancel the requester.
2) Moving the requester will upset the DBPro display underneath it until
the next SYNC/FASTSYNC call. A bit annoying that.
remend
#CONSTANT MAXSTRINGSIZE 256
TYPE REQUESTER_PTRDATA
ReqInit as integer
DllUser32 as integer
DllComdlg32 as integer
ptrRequester as dword
ptrFilter as dword
ptrCustomFilter as dword
ptrFile as dword
ptrFileTitle as dword
ptrInitialDir as dword
ptrTitle as dword
ptrDefExt as dword
ptrTemplateName as dword
ENDTYPE
` ---------------------------------------------------------------------------
function ReqError(e$)
set current bitmap 0 : cls rgb(0,0,0) : ink rgb(255,255,255),0
print "File Requester Error!"
print e$ : print
print "Press any key to exit."
sync : wait key : end
endfunction
function GetFreeDll()
rem --- finds a free dll slot
dllnum = 256
repeat : dec dllnum,1 : until dll exist(dllnum) = 0 or dllnum = 0
endfunction dllnum
Function InitFileReq()
rem --- check if we have not initailised already
if reqptr.ReqInit = 0
reqptr.DllUser32 = GetFreeDll()
if reqptr.DllUser32 = 0 then ReqError("Unable to find free Dll slot for User32.dll")
load dll "User32.dll",reqptr.DllUser32
reqptr.DllComdlg32 = GetFreeDll()
if reqptr.DllComdlg32 = 0 then ReqError("Unable to find free Dll slot for Comdlg32.dll")
load dll "Comdlg32.dll",reqptr.DllComdlg32
if dll exist(reqptr.DllUser32) = 0 then ReqError("Unable to load User32.dll")
if dll exist(reqptr.DllComdlg32) = 0 then ReqError("Unable to load Comdlg32.dll")
rem --- store memory pointers
reqptr.ptrRequester = make memory(80)
reqptr.ptrFilter = make memory(MAXSTRINGSIZE)
reqptr.ptrCustomFilter = make memory(MAXSTRINGSIZE)
reqptr.ptrFile = make memory(MAXSTRINGSIZE)
reqptr.ptrFileTitle = make memory(MAXSTRINGSIZE)
reqptr.ptrInitialDir = make memory(MAXSTRINGSIZE)
reqptr.ptrTitle = make memory(MAXSTRINGSIZE)
reqptr.ptrDefExt = make memory(MAXSTRINGSIZE)
reqptr.ptrTemplateName = make memory(MAXSTRINGSIZE)
rem --- set values in memory (ptrRequester)
SetReqLongValue(0,76)
SetReqLongValue(2, 0)
SetReqLongValue(3,reqptr.ptrFilter)
SetReqLongValue(4,reqptr.ptrCustomFilter)
SetReqLongValue(5,255)
SetReqLongValue(6,0)
SetReqLongValue(7,reqptr.ptrFile)
SetReqLongValue(8,255)
SetReqLongValue(9,reqptr.ptrFileTitle)
SetReqLongValue(10,255)
SetReqLongValue(11,reqptr.ptrInitialDir)
SetReqLongValue(12,reqptr.ptrTitle)
SetReqLongValue(13,0)
reqptr.ReqInit = 1
endif
endfunction
function UnloadFileReq()
rem --- erase memory
delete memory reqptr.ptrRequester
delete memory reqptr.ptrFilter
delete memory reqptr.ptrCustomFilter
delete memory reqptr.ptrFile
delete memory reqptr.ptrFileTitle
delete memory reqptr.ptrInitialDir
delete memory reqptr.ptrTitle
delete memory reqptr.ptrDefExt
delete memory reqptr.ptrTemplateName
delete dll reqptr.DllUser32
delete dll reqptr.DllComdlg32
reqptr.ReqInit = 0
endfunction
` ---------------------------------------------------------------------------
function StringToMemory(ptr,s$,zerochr$)
fill memory ptr, 0, MAXSTRINGSIZE
if len(s$) = 0 then exitfunction 0
if zerochr$="" then zero = 0 else zero = asc(zerochr$)
bt as byte
index = 1
repeat
bt = asc(mid$(s$,index))
if bt <> zero then *ptr = bt
inc index,1 : inc ptr,1
until index > len(s$) or index = MAXSTRINGSIZE
endfunction 1
` ---------------------------------------------------------------------------
function ReadMemoryString(ptr)
bt as byte
s$ = "" : index = 1
repeat
bt = *ptr
if bt > 0 then s$ = s$ + chr$(bt)
inc index,1 : inc ptr,1
until bt = 0 or index = MAXSTRINGSIZE
endfunction s$
` ---------------------------------------------------------------------------
function SetReqLongValue(pos, v as dword)
ptr as dword
ptr = reqptr.ptrRequester + (pos * 4)
*ptr = v
endfunction
` ---------------------------------------------------------------------------
function PrepareReq(title$,path$,filter$)
StringToMemory(reqptr.ptrTitle, title$, "")
if path$="" or StringToMemory(reqptr.ptrInitialDir, path$, "")= 0
StringToMemory(reqptr.ptrInitialDir, "C:\", "")
endif
if filter$="" or StringToMemory(reqptr.ptrFilter, filter$, "|")= 0
StringToMemory(reqptr.ptrFilter, "All Files (*.*)|*.*", "|")
endif
` StringToMemory(reqptr.ptrCustomFilter, "", "")
StringToMemory(reqptr.ptrFile, space$(254), "")
StringToMemory(reqptr.ptrFileTitle, space$(254), "")
hwnd as dword
hwnd = call dll(reqptr.DllUser32, "GetActiveWindow")
SetReqLongValue(1, hwnd)
endfunction filter$
function FileReqOpen(title$,path$,filter$)
PrepareReq(title$,path$,filter$)
r = call dll(reqptr.DllComdlg32, "GetOpenFileNameA", reqptr.ptrRequester)
endfunction r
function FileReqSave(title$,path$,filter$)
PrepareReq(title$,path$,filter$)
r = call dll(reqptr.DllComdlg32, "GetSaveFileNameA", reqptr.ptrRequester)
endfunction r
` ---------------------------------------------------------------------------
function ReqFileName()
f$ = ReadMemoryString(reqptr.ptrFile)
endfunction f$
function ReqFileTitle()
f$ = ReadMemoryString(reqptr.ptrFileTitle)
endfunction f$
function ReqFolderName()
fn$ = ReqFileName() : ft$ = ReqFileTitle()
f$ = left$(fn$,len(fn$) - len(ft$))
endfunction f$
function ReqFileExt()
fn$ = ReqFileName()
if fn$ <> ""
` Split the filename by .
split string fn$,"."
` Make f$ equal . + the last split word
if split count() > 1
f$="."+get split word$(split count())
else
f$="."
endif
endif
endfunction f$
CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!