/***************************************************************/ /* */ /* IDEDIT.PKG */ /* */ /* plugin ItemsDistribution */ /* éditeur */ /* */ /* by Loïc Berthelot, CryoNetworks, fev 2001 */ /* */ /***************************************************************/ typeof plugin=S;; typeof class=S;; var itemsPath = "dms/3d/plugins/paintballAv/items/";; proto save=fun [ [Inst r1] ] [[S r1] [S r1] [[S r1]r1] [[S r1]r1]];; struct ItemDEdit = [ objNameLbl_ITMDE : ObjText, objName_ITMDE : ObjText, filenameLbl_ITMDE : ObjText, filename_ITMDE : ObjText, filenameBtt_ITMDE : ObjButton, textureFilenameLbl_ITMDE : ObjText, textureFilename_ITMDE : ObjText, textureFilenameBtt_ITMDE : ObjButton, scaleLbl_ITMDE : ObjText, scale_ITMDE : ObjText, timeRotationLbl_ITMDE : ObjText, timeRotation_ITMDE : ObjText, angleRotationLbl_ITMDE : ObjText, angleRotation_ITMDE : ObjText, actionDistanceLbl_ITMDE : ObjText, actionDistance_ITMDE : ObjText, timeoutLbl_ITMDE : ObjText, timeout_ITMDE : ObjText ] mkItemDEdit;; typeof itde = ItemDEdit;; fun _fileError () = _DLGMessageBox _channel nil "Error" "files must be choosen from a Scol partition!" 0; 1;; fun _setTextureFile (openbox, z, file) = if (file == nil) then nil else let _PtoScol file -> filePath in if (filePath == nil) then ( _fileError; 0; ) else ( g2d_SETcompText itde.textureFilename_ITMDE filePath; 1; );; fun _setM3dFile (openbox, z, file) = if (file == nil) then nil else let _PtoScol file -> filePath in if (filePath == nil) then ( _fileError; 0; ) else ( g2d_SETcompText itde.filename_ITMDE filePath; 1; );; fun _chooseTextureFile (obj, win) = _DLGrflopen (_DLGOpenFile _channel win itemsPath nil "bitmap (*.bmp,*.jpg)\0*.BMP;*.JPG;*.JPEG\0\0") @_setTextureFile nil;; fun _chooseM3dFile (obj, win)= _DLGrflopen (_DLGOpenFile _channel win itemsPath nil "M3D (*.m3d)\0*.m3d\0\0") @_setM3dFile nil;; fun _loadParams (params) = let getInfo params "itemDObjName" -> objName in let getInfo params "itemDFilename" -> filename in let getInfo params "itemDTextureFilename" -> textureFilename in let getInfo params "itemDScale" -> scale in let getInfo params "itemDTimeRotation" -> timeRotation in let getInfo params "itemDAngleRotation" -> angleRotation in let getInfo params "itemDActionDistance" -> actionDistance in let getInfo params "itemDTimeout" -> timeout in ( g2d_SETcompText itde.objName_ITMDE objName; g2d_SETcompText itde.filename_ITMDE filename; g2d_SETcompText itde.textureFilename_ITMDE textureFilename; g2d_SETcompText itde.scale_ITMDE scale; g2d_SETcompText itde.timeRotation_ITMDE timeRotation; g2d_SETcompText itde.angleRotation_ITMDE angleRotation; g2d_SETcompText itde.actionDistance_ITMDE actionDistance; g2d_SETcompText itde.timeout_ITMDE timeout; 1; );; /************************************************************/ /* */ /* Editor Initialisation */ /* */ /************************************************************/ fun openEdit (win, param) = g2d_init _channel win; set itde = mkItemDEdit [nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil]; set itde.objNameLbl_ITMDE = g2d_CRlabel 10 12 100 25 nil "item name : "; set itde.objName_ITMDE = g2d_CRline 120 10 200 25 nil ""; set itde.filenameLbl_ITMDE = g2d_CRlabel 10 57 100 25 nil "m3d file : "; set itde.filename_ITMDE = g2d_CRline 120 55 250 25 nil ""; set itde.filenameBtt_ITMDE = g2d_CRrollOverText [390 55] 30 25 nil ".."; _CBbutton itde.filenameBtt_ITMDE @_chooseM3dFile win; set itde.textureFilenameLbl_ITMDE = g2d_CRlabel 10 102 100 25 nil "m3d texture file : "; set itde.textureFilename_ITMDE = g2d_CRline 120 100 250 25 nil ""; set itde.textureFilenameBtt_ITMDE = g2d_CRrollOverText [390 100] 30 25 nil ".."; _CBbutton itde.textureFilenameBtt_ITMDE @_chooseTextureFile win; set itde.scaleLbl_ITMDE = g2d_CRlabel 10 147 100 25 nil "scale : "; set itde.scale_ITMDE = g2d_CRline 120 145 50 25 nil ""; set itde.timeRotationLbl_ITMDE = g2d_CRlabel 10 192 100 25 nil "rotation delay (ms) : "; set itde.timeRotation_ITMDE = g2d_CRline 120 190 50 25 nil ""; set itde.angleRotationLbl_ITMDE = g2d_CRlabel 220 192 100 25 nil "rotation angle : "; set itde.angleRotation_ITMDE = g2d_CRline 320 190 50 25 nil ""; set itde.actionDistanceLbl_ITMDE = g2d_CRlabel 10 237 100 30 nil "action distance : "; set itde.actionDistance_ITMDE = g2d_CRline 120 235 50 25 nil ""; set itde.timeoutLbl_ITMDE = g2d_CRlabel 220 237 100 30 nil "item appearance timeout : "; set itde.timeout_ITMDE = g2d_CRline 320 235 50 25 nil ""; _loadParams strextr param; 1;; fun save(l)= [ nil /* registerF */ nil /* register */ ("plugin"::plugin::nil)::nil /* supplemental Dat */ ("action"::(strcat class ".showObjects")::nil):: ("action"::(strcat class ".hideObjects")::nil):: ("event"::(strcat class ".indicate")::nil):: nil ];; fun destroyEdit () = _DSbutton itde.textureFilenameBtt_ITMDE; _DSbutton itde.filenameBtt_ITMDE; 1;; fun closeEdit()= let _GETtext itde.objName_ITMDE -> objName in let _GETtext itde.filename_ITMDE -> filename in let _GETtext itde.textureFilename_ITMDE -> textureFilename in let _GETtext itde.scale_ITMDE -> scale in let _GETtext itde.timeRotation_ITMDE -> timeRotation in let _GETtext itde.angleRotation_ITMDE -> angleRotation in let _GETtext itde.actionDistance_ITMDE -> actionDistance in let _GETtext itde.timeout_ITMDE -> timeout in ( destroyEdit; strbuild ("plugin"::plugin::nil):: ("itemDObjName"::objName::nil):: ("itemDFilename"::filename::nil):: ("itemDTextureFilename"::textureFilename::nil):: ("itemDScale"::scale::nil):: ("itemDTimeRotation"::timeRotation::nil):: ("itemDAngleRotation"::angleRotation::nil):: ("itemDActionDistance"::actionDistance::nil):: ("itemDTimeout"::timeout::nil)::nil; );; fun IniPlug(file)= set plugin=file; set class=getInfo strextr _getpack _checkpack file "name"; PlugRegister class @save nil @openEdit @closeEdit;;