Beispiel #1
0
void DrawWeapons(void)
{
	Word i;
	Word Shadow;		/* Flag for shadowing */
	pspdef_t *psp;
	
	psp = players.psprites;	/* Get the first sprite in the array */ 
	Shadow = FALSE;			/* Assume no shadow draw mode */
	if (players.mo->flags & MF_SHADOW) {	/* Could be active? */
		i = players.powers[pw_invisibility];	/* Get flash time */
		if (i>=(5*TICKSPERSEC) || i&0x10) {	/* On a long time or if flashing... */
			Shadow = TRUE;		/* Draw as a shadow right now */
		}
	}
	i = 0;		/* Init counter */
	do {
		if (psp->StatePtr) {		/* Valid state record? */
			DrawAWeapon(psp,Shadow);	/* Draw the weapon */
		}
		++psp;		/* Next... */
	} while (++i<NUMPSPRITES);	/* All done? */
	
	i = ScreenSize+rBACKGROUNDMASK;		/* Get the resource needed */
	DrawMShape(0,0,LoadAResource(i));	/* Draw the border */
	ReleaseAResource(i);				/* Release the resource */
}
Beispiel #2
0
Word NewGameWindow(Word NewVidSize)
{
	LongWord *LongPtr;
	Byte *DestPtr;
	int i;
	
	printf("Called: %d\n", NewVidSize);
	
	if (NewVidSize == VidSize)
		return VidSize;
	
	printf("Setting Size: %d (from %d)\n", NewVidSize, VidSize);
		
	if (NewVidSize < 4) {
		w = VidXs[NewVidSize];
		h = VidYs[NewVidSize];
		v = VidVs[NewVidSize];
	} else {
		fprintf(stderr, "Invalid Vid size: %d\n", NewVidSize);
		exit(EXIT_FAILURE);
	}
	
	/* Free Image */
	
	/* Resize Window */
	
	gfxbuf = (Byte *)malloc(w * h);
	
	/* Create Image */
	
	VideoPointer = gfxbuf;
	VideoWidth = w;
	InitYTable();
	SetAPalette(rBlackPal);
	ClearTheScreen(BLACK);
	BlastScreen();
	
	LongPtr = (LongWord *) LoadAResource(VidPics[NewVidSize]);

	if (GameShapes)
		FreeSomeMem(GameShapes);
		
	GameShapes = (Byte **)AllocSomeMem(lMSB(LongPtr[0]));
	DLZSS((Byte *)GameShapes, (Byte *)&LongPtr[1], lMSB(LongPtr[0]));
	ReleaseAResource(VidPics[NewVidSize]);
	
	LongPtr = (LongWord *)GameShapes;
	DestPtr = (Byte *)GameShapes;
	for (i = 0; i < ((NewVidSize == 1) ? 57 : 47); i++) 
		GameShapes[i] = DestPtr + lMSB(LongPtr[i]);
	
	VidSize = NewVidSize;
	
	return VidSize;
}
Beispiel #3
0
static void RunDemo(Word demoname)
{
#if 0
	Word *demo;
	Word exit;

	demo = (Word *)LoadAResource(demoname);	/* Load the demo */
	exit = G_PlayDemoPtr(demo);		/* Play the demo */
	ReleaseAResource(demoname);			/* Release the demo data */
	if (exit == ga_exitdemo) {		/* Quit? */
		RunMenu();				/* Show the main menu */
	}
#endif
}
Beispiel #4
0
static void DrawAWeapon(pspdef_t *psp,Word Shadow)
{
	Short *Input;		/* Pointer to the xy offset'd shape */
//	Word Color;
	Word RezNum;
	int x,y;
	state_t *StatePtr;

	StatePtr = psp->StatePtr;		/* Get the state struct pointer */
	RezNum = StatePtr->SpriteFrame>>FF_SPRITESHIFT;	/* Get the file */
	Input = (Short *)LoadAResource(RezNum);	/* Get the main pointer */
	Input = (Short *)GetShapeIndexPtr(Input,StatePtr->SpriteFrame & FF_FRAMEMASK);
	
	((LongWord *)Input)[7] = GunXScale;		/* Set the scale factor */
	((LongWord *)Input)[10] = GunYScale;
	if (Shadow) {
		((LongWord *)Input)[13] = 0x9C81;	/* Set the shadow bits */
	} else {
		((LongWord *)Input)[13] = 0x1F00;	/* Normal PMode */
#if 0
		if (StatePtr->SpriteFrame & FF_FULLBRIGHT) {
			Color = 255;			/* Full bright */
		} else {					/* Ambient light */
			Color = players.mo->subsector->sector->lightlevel;
		}
#endif
	}
	x = Input[0];
	y = Input[1];
	x = ((psp->WeaponX+x)*(int)GunXScale)>>20;
	y = ((psp->WeaponY+SCREENGUNY+y)*(int)GunYScale)>>16;
	x+=ScreenXOffset;
	y+=ScreenYOffset+2;			/* Add 2 pixels to cover up the hole in the bottom */
	DrawMShape(x,y,&Input[2]);	/* Draw the weapon's shape */
	ReleaseAResource(RezNum);
}