home *** CD-ROM | disk | FTP | other *** search
- ;-------T-------T------------------------T---------------------------------;
- ;Open a screen using an external OBJect file.
- ;--------------------------------------------
- ;This demo will open a screen, based on the parameters in an external object
- ;file. This allows a VERY high level of external editing that will alter
- ;how this program behaves, without having to reassemble it.
- ;
- ;This feature is highly important as it allows up to 100% configurability of
- ;your game, which previously has only been available to applications using
- ;libraries such as MUI. However, it is even more powerful than this as
- ;graphic artists could not only create new datasets for your game, but also
- ;alter the dimensions, colours, resolution, attributes (and more) of your
- ;BOBs and screens. Support for PC relative CODE segments is also available,
- ;so any external functions could be altered and improved by programmers.
- ;This will ensure that your game has a long lasting future as it keeps up
- ;with current technology and additions to GMS.
- ;
- ;To see the object data, view OBJScreenData.s
-
- INCDIR "INCLUDES:"
- INCLUDE "exec/exec_lib.i"
- INCLUDE "games/games_lib.i"
- INCLUDE "games/games.i"
-
- CALL MACRO
- jsr _LVO\1(a6)
- ENDM
-
- SECTION "Objects!",CODE
-
- ;===========================================================================;
- ; INITIALISE DEMO
- ;===========================================================================;
-
- Start: MOVEM.L A0-A6/D1-D7,-(SP)
- move.l ($4).w,a6
- lea GMS_Name(pc),a1
- moveq #$00,d0
- CALL OpenLibrary
- move.l d0,GMS_Base
- beq .Error_GMS
-
- move.l GMS_Base(pc),a6
- sub.l a0,a0
- CALL SetUserPrefs
-
- ;---------------------------------------------------------------------------;
- ;Load in the objects file and get pointers to the structures that we need.
-
- lea OBJ_FileName(pc),a0 ;a0 = Object FileName.
- CALL LoadObjectFile ;>> = Go and load them.
- move.l d0,OBJ_Base ;MA = Save the Object Base.
- beq .Error_ObjectFile ;>> = If error.
-
- move.l OBJ_Base(pc),a0 ;a0 = Object Base.
- lea TXT_ScreenName(pc),a1 ;a1 = The name of the screen to get.
- CALL GetObject ;>> = Get our GameScreen object.
- move.l d0,Screen ;MA = Save pointer to screen struct.
- beq.s .Error_Objects ;>> = Quit if error.
-
- lea TXT_PictureName(pc),a1 ;a1 = The name of the picture to get.
- CALL GetObject ;>> = Get our Picture object.
- move.l d0,Picture ;MA = Save pointer to picture struct.
- beq.s .Error_Objects ;>> = Quit if error.
-
- ;---------------------------------------------------------------------------;
- ;Now initialise the two structures and display the picture.
-
- move.l Picture(pc),a1
- CALL LoadPic
- tst.w d0
- bne.s .Error_Picture
-
- move.l Screen(pc),a0
- move.w PIC_Width(a1),GS_PicWidth(a0)
- move.w PIC_Height(a1),GS_PicHeight(a0)
- move.w PIC_Planes(a1),GS_Planes(a0)
- move.l PIC_ScrMode(a1),GS_ScrMode(a0)
- move.w PIC_ScrType(a1),GS_ScrType(a0)
- move.l PIC_Data(a1),GS_MemPtr1(a0)
- move.l PIC_Palette(a1),GS_Palette(a0)
- CALL AddScreen
- tst.l d0
- bne.s .Error_Screen
-
- CALL ShowScreen
-
- .loop CALL WaitSVBL
- moveq #JPORT1,d0
- CALL ReadMouse
- btst #MB_LMB,d0
- beq.s .loop
-
- ;===========================================================================;
- ; RETURN TO DOS
- ;===========================================================================;
-
- .ReturnToDOS
- move.l GMS_Base(pc),a6
- move.l Picture(pc),a1
- CALL FreePic
- .Error_Picture
- move.l Screen(pc),a0
- CALL DeleteScreen
- .Error_Screen
- .Error_Objects
- move.l OBJ_Base(pc),a0
- CALL FreeObjectFile
- .Error_ObjectFile
- move.l GMS_Base(pc),a1
- move.l ($4).w,a6
- CALL CloseLibrary
- .Error_GMS
- MOVEM.L (SP)+,A0-A6/D1-D7
- moveq #$00,d0
- rts
-
- ;===========================================================================;
- ; DATA
- ;===========================================================================;
-
- GMS_Name:
- dc.b "games.library",0
- even
- GMS_Base:
- dc.l 0
-
- Screen: dc.l 0
- Picture: dc.l 0
-
- ;===========================================================================;
- ; OBJECT FILE DATA
- ;===========================================================================;
-
- TXT_ScreenName:
- dc.b "DemoScreen",0
- even
- TXT_PictureName:
- dc.b "DemoPicture",0
- even
-
- OBJ_FileName:
- dc.b "GAMESLIB:data/OBJ.Screen"
- OBJ_Base:
- dc.l 0
-