home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
game
/
arachnid-1.1.lha
/
Arachnid
/
ReiheZeigen.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-12-27
|
3KB
|
124 lines
#include <functions.h>
extern long seconds,MRold;
extern BOOL MoveFlag;
extern APTR VisualInfo;
extern BYTE PlayStack[][10];
extern UWORD *SpielKarten[];
extern struct Screen *Scr;
extern struct Window *Wnd;
extern struct Image Image;
extern struct TextAttr topaz8;
struct Window *ZKWnd = NULL;
struct Gadget *ZKGList = NULL;
struct NewGadget ZKNGad = {
298, 110, 50, 20, (UBYTE *)"_OK", &topaz8, 0, PLACETEXT_IN, NULL, NULL};
void FehlerAus(long nr);
long RowReq();
long OpenZKWindow(long WinHeight)
{
struct Gadget *gad;
gad = CreateContext(&ZKGList);
ZKNGad.ng_VisualInfo = VisualInfo;
ZKNGad.ng_TopEdge = WinHeight-30;
gad = CreateGadget(BUTTON_KIND, gad, &ZKNGad, GT_Underscore, '_', TAG_DONE);
if(!gad)
{
FehlerAus(9);
return(9);
}
if(!(ZKWnd = OpenWindowTags(NULL,
WA_Left, 10,
WA_Top, 30,
WA_Width, 620,
WA_Height, WinHeight,
WA_IDCMP, BUTTONIDCMP|IDCMP_INACTIVEWINDOW|IDCMP_VANILLAKEY,
WA_Flags, WFLG_DRAGBAR|WFLG_SMART_REFRESH|WFLG_ACTIVATE,
WA_Gadgets, ZKGList,
WA_Title, (UBYTE *)"Reihe Anzeigen",
WA_PubScreen, Scr,
TAG_DONE )))
{
FehlerAus(7);
return(7);
}
GT_RefreshWindow(ZKWnd, NULL);
return(0);
}
void CloseZKWindow()
{
if(ZKWnd)
{
CloseWindow(ZKWnd);
ZKWnd = NULL;
}
if(ZKGList)
{
FreeGadgets(ZKGList);
ZKGList = NULL;
}
}
void ReiheZeigen()
{
long i,class,code,FirstCard,EndCard,Cards,WinHeight;
BOOL ende = FALSE;
struct IntuiMessage *message;
struct RastPort *RastPort;
struct MsgPort *UserPort;
struct Gadget *gad;
if((!MoveFlag)||(!PlayStack[0][MRold]))
{
if((MRold = RowReq()) < 0) return;
}
EndCard = PlayStack[0][MRold]+1;
for(FirstCard=1;PlayStack[FirstCard][MRold]<0;FirstCard++);
Cards = EndCard - FirstCard;
WinHeight = (Cards-1)/9*76+136;
if(OpenZKWindow(WinHeight)) return;
UserPort = ZKWnd->UserPort;
RastPort = ZKWnd->RPort;
for(i=0;i<Cards;i++)
{
Image.ImageData = SpielKarten[PlayStack[i+FirstCard][MRold]];
DrawImage(RastPort, &Image, (i%9)*67+17, (i/9)*76+20);
}
while(!ende)
{
Wait(1L << UserPort->mp_SigBit);
while(message = (struct IntuiMessage *) GT_GetIMsg(UserPort))
{
gad = (struct Gadget*)message->IAddress;
class = message->Class;
code = message->Code;
GT_ReplyIMsg(message);
switch(class)
{
case IDCMP_INACTIVEWINDOW: ActivateWindow(ZKWnd);
break;
case IDCMP_GADGETUP: ende = TRUE;
break;
case IDCMP_VANILLAKEY: if((code == 'o') || (code == 'O')) ende = TRUE;
if(code == 13) ende = TRUE;
}
}
}
CloseZKWindow();
}