home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 2: PC
/
frozenfish_august_1995.bin
/
bbs
/
d09xx
/
d0904.lha
/
ATS
/
ats.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-26
|
5KB
|
198 lines
#define INTUI_V36_NAMES_ONLY
#include "iffp/ilbmapp.h"
struct Library *IntuitionBase = NULL;
struct Library *GfxBase = NULL;
struct Library *IFFParseBase = NULL;
struct Screen *scr = NULL;
struct Window *win = NULL;
struct IntuiMessage *msg;
struct TagItem vc[2];
struct ViewPortExtra *vpe;
UWORD pens[] = { ~0 };
struct ILBMInfo *ilbm = NULL;
LONG my_ifferror = 0L;
int i, limit;
LONG ilbmprops[] = {
ID_ILBM, ID_BMHD,
ID_ILBM, ID_CMAP,
ID_ILBM, ID_CAMG,
TAG_DONE
};
LONG ilbmcollects[] = {
TAG_DONE
};
LONG ilbmstops[] = {
ID_ILBM, ID_BODY,
TAG_DONE
};
UWORD __chip waitPointer[] =
{
0x0000, 0x0000, /* reserved, must be NULL */
0x0400, 0x07C0,
0x0000, 0x07C0,
0x0100, 0x0380,
0x0000, 0x07E0,
0x07C0, 0x1FF8,
0x1FF0, 0x3FEC,
0x3FF8, 0x7FDE,
0x3FF8, 0x7FBE,
0x7FFC, 0xFF7F,
0x7EFC, 0xFFFF,
0x7FFC, 0xFFFF,
0x3FF8, 0x7FFE,
0x3FF8, 0x7FFE,
0x1FF0, 0x3FFC,
0x07C0, 0x1FF8,
0x0000, 0x07E0,
0x0000, 0x0000, /* reserved, must be NULL */
};
UWORD __chip transpPointer[] =
{
0x0000, 0x0000, /* reserved, must be NULL */
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000, 0x0000, /* reserved, must be NULL */
};
extern UWORD __chip waitPointer[];
extern UWORD __chip transpPointer[];
void Give_Up(char *reason)
{
if(reason) printf("%s.\n",reason);
if(win) CloseWindow(win);
if(scr) CloseScreen(scr);
if(ilbm)
{
if(ilbm->ParseInfo.iff) FreeIFF(ilbm->ParseInfo.iff);
FreeMem(ilbm,sizeof(struct ILBMInfo));
}
if(IFFParseBase) CloseLibrary(IFFParseBase);
if(GfxBase) CloseLibrary(GfxBase);
if(IntuitionBase) CloseLibrary(IntuitionBase);
exit(0);
}
void main(int argc, char **argv)
{
if(argc==0)
{
printf("Cannot be run from WB.\n");
Delay(50);
}
if(argc!=2) Give_Up("Usage: prg <iff filename>");
if(!(IntuitionBase=OpenLibrary("intuition.library",0)))
Give_Up("Can not open Intuition Lib");
if(!(GfxBase=OpenLibrary("graphics.library",0)))
Give_Up("Can not open Graphics Lib");
if(!(IFFParseBase=OpenLibrary("iffparse.library",0)))
Give_Up("Can not open Iffparse Lib");
if(!(ilbm = (struct ILBMInfo *)
AllocMem(sizeof(struct ILBMInfo),MEMF_PUBLIC|MEMF_CLEAR))
)
Give_Up("Can not allocate ILBMInfo struct");
ilbm->ParseInfo.propchks = ilbmprops;
ilbm->ParseInfo.collectchks = ilbmcollects;
ilbm->ParseInfo.stopchks = ilbmstops;
if(!(ilbm->ParseInfo.iff = AllocIFF() ))
Give_Up("Can not allocate IFF handle");
if(my_ifferror=queryilbm(ilbm, argv[1]))
Give_Up(IFFerr(my_ifferror));
/* Skaf noget at vise billedet pσ. */
if(!(scr=OpenScreenTags
(
NULL,
SA_Pens, (ULONG)pens,
SA_Depth, MIN(ilbm->Bmhd.nPlanes, MAXAMDEPTH),
SA_Width, MAX(ilbm->Bmhd.pageWidth, ilbm->Bmhd.w),
SA_Height, MAX(ilbm->Bmhd.pageHeight,ilbm->Bmhd.h),
SA_DisplayID, HIRESLACE_KEY,
SA_Title, "Mon dette er en lang nok streng?",
SA_Type, CUSTOMSCREEN,
SA_Overscan, OSCAN_MAX,
TAG_DONE
) ))
Give_Up("Can not open screen");
if(!(win=OpenWindowTags
(NULL,
WA_CustomScreen, scr,
WA_Borderless, TRUE,
WA_Activate, TRUE,
WA_IDCMP, IDCMP_VANILLAKEY | IDCMP_MOUSEBUTTONS,
TAG_DONE
)
))
Give_Up("Can not open window");
ilbm->scr=scr;
ilbm->win=win;
ilbm->wrp=win->RPort;
ilbm->srp=&scr->RastPort;
ilbm->vp=&scr->ViewPort;
SetPointer(win, waitPointer, 16, 16, -6, 0);
if((my_ifferror = loadilbm(ilbm, argv[1]) ))
Give_Up(IFFerr(my_ifferror));
closeifile(&ilbm->ParseInfo);
/* Pσ dette tidspunkt mener jeg, jeg har gjort alt
relevant fra ILBMLoad.c eksemplet; dette er hvor
de venter pσ input. Sσ her kan jeg lave, hvad
jeg nu har lyst til efter at billedet ER kommet ind.
*/
vc[0].ti_Tag=VTAG_VIEWPORTEXTRA_GET;
vc[0].ti_Data=NULL;
vc[1].ti_Tag=TAG_END;
vc[1].ti_Data=NULL;
VideoControl(scr->ViewPort.ColorMap,vc);
vpe=(struct ViewPortExtra *) vc[0].ti_Data;
limit = scr->Height-
(vpe->DisplayClip.MaxY - vpe->DisplayClip.MinY);
SetPointer(win, transpPointer, 16, 16, -6, 0);
Wait(1<<win->UserPort->mp_SigBit);
ReplyMsg(GetMsg(win->UserPort));
for(i=0; i<limit; i+=2)
{
scr->ViewPort.RasInfo->RyOffset=i;
WaitTOF();
ScrollVPort(&scr->ViewPort);
}
Wait(1<<win->UserPort->mp_SigBit);
ReplyMsg(GetMsg(win->UserPort));
unloadilbm(ilbm);
Give_Up("");
}