home *** CD-ROM | disk | FTP | other *** search
- /*******************************************************************************
- * BlitDemons by Walt Strickler
- * This program and all its source code are in the public domain and are
- * freely distributable and usable for any purpose, private or commercial.
- ******************************************************************************/
-
-
- #include <stdio.h>
- #include <assert.h>
- #include <intuition/intuition.h>
- #include <intuition/screens.h>
- #include <libraries/dos.h>
- /* #include <exec/types.h> */ /* INCLUDED by intuition.h */
- /* #include <exec/nodes.h> */ /* INCLUDED by intuition.h */
- /* #include <graphics/gfx.h> */ /* INCLUDED by intuition.h */
- /* #include <graphics/rastport.h> */ /* INCLUDED by intuition.h */
- #include <proto/intuition.h>
- #include <proto/exec.h>
- #include <proto/graphics.h>
- #include <proto/dos.h>
-
- #define NUM_PLANES 4
- #define NUM_COLORS 16
-
- struct BDMainStruct
- {
- WORD *Display[NUM_PLANES], /* Pointers to first usable line of display */
- *Incr[NUM_PLANES], /* Pointers to incremented bitplanes */
- *Equal, /* Pointer to 'Equal' bitplane */
- *Temp; /* Pointer to 'Temp' bitplane */
- struct DoBlitNode *BDBlitNodes;
- int XSize, /* Width of area to be blitted in pixels */
- YSize, /* Height of area to be blitted lines z*/
- Mod, /* Difference between size of screen and that of window */
- LRBorder; /* Max(BorderLeft, BorderRight) */
- /* Note: Top and bottom borders are taken into account in
- * Display and YSize.
- */
- };
-
-
- /* This is the pseudo-bltnode passed to DoBlit(). Note that it does not
- * contain a struct bltnode. It contains only the information necessary
- * for one blit.
- */
- struct DoBlitNode
- {
- WORD con0,
- con1,
- afwm,
- alwm,
- *csource, *bsource, *asource, *dsource,
- bltsize,
- cmod, bmod, amod, dmod;
- };
-
-
- /* Function return #defines */
- /* InitIntui() */
- #define INTUI_OK 0
- #define NO_INTUI 1
- #define NO_GFX 2
- #define NO_SCREEN 3
- #define NO_WIN 4
-
- /* InitPlanes() Non-OK return mut. excl with InitIntui() */
- #define PLANES_OK 0
- #define PLANES_CHOKE 5
-
- /* MainLoop() Non-OK return mut. excl with InitIntui() and InitPlanes() */
- #define ML_OK 0
- #define ABOUT_CHOKE 6
-
- /* main() */
- #define INIT_BLIT_CHOKE 7
- #define WBI_CHOKE 8
-
- /* Randomize */
- #define RAND_OK 0
- #define RAND_QUIT 1
- #define RAND_ABOUT_CHOKE 2
-
- /* DisplayAbout() */
- #define DA_OK 0
- #define DA_CHOKE 1
-
- /* CheckMsg() */
- #define NO_MSG 0
- #define NEW 1
- #define QUIT 2
- #define CLOSE_WIN 3
- #define STOP 4
- #define START 5
- #define ABOUT 6
-
- /* DoMenus() */
- #define NO_MENU 0
- /* See CheckMsg() for other DoMenus() defines */
-
- /* Defines for function arguments */
- /* CheckMsg() */
- #define WAIT 0
- #define NO_WAIT 1
-
- /* BlitCompare */
- #define UP_NEIGHBOR 0
- #define LEFT_NEIGHBOR 1
- #define RIGHT_NEIGHBOR 2
- #define DOWN_NEIGHBOR 3
- #define TO_EQUAL 0
- #define TO_TEMP 1
-
-
- /*******************************************************************************
- * Some useful external items
- ******************************************************************************/
- extern struct Window *BDWindow;
- extern struct Screen *BDScreen;
-
-
- /*******************************************************************************
- * Prototypes for my functions
- ******************************************************************************/
- /* BDemon.c */
- int MainLoop(struct BDMainStruct *);
- int DisplayAbout();
- struct window *DisplayOne(struct NewWindow *, struct IntuiText *);
- int Randomize(struct BDMainStruct *, struct Window *);
- int InitPlanes(struct BDMainStruct *, struct Window *);
- void KillPlanes(struct BDMainStruct *);
- void ErrorMsgs(int);
-
- /* BDIntui.c */
- int InitIntui();
- void SetPalette();
- int CheckMsg(int);
- int DoMenus(struct IntuiMessage *);
- void ClearScreen();
- void OnStart();
- void OffStart();
- void OnStop();
- void OffStop();
- void SetBDMenu();
- void ClearBDMenu();
-
- /* BDBlit.c */
- void OneGen(struct BDMainStruct *);
- struct DoBlitNode *InitBlits(struct BDMainStruct *);
-