当前位置: 首页>>代码示例>>C++>>正文


C++ I_Error函数代码示例

本文整理汇总了C++中I_Error函数的典型用法代码示例。如果您正苦于以下问题:C++ I_Error函数的具体用法?C++ I_Error怎么用?C++ I_Error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了I_Error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AddEventToStreamBuffer

// ----------------------
// AddEventToStreamBuffer
//
// Put the given event into the given stream buffer at the given location
// pMe must point to an event filled out in accordance with the
// description given in GetTrackEvent
//
// Returns FALSE on sucess or TRUE on an error condition
// Handles its own error notification by displaying to the appropriate
// output device (either our debugging window, or the screen).
// ----------------------
static int AddEventToStreamBuffer(LPTEMPEVENT pMe, LPCONVERTINFO lpciInfo)
{
	DWORD      tkNow, tkDelta;
	MIDIEVENT *pmeEvent;

	pmeEvent = (MIDIEVENT *)(lpciInfo->mhBuffer.lpData
	                        + lpciInfo->dwStartOffset
	                        + lpciInfo->dwBytesRecorded);

	// When we see a new, empty buffer, set the start time on it...
	if (!lpciInfo->dwBytesRecorded)
		lpciInfo->tkStart = tkCurrentTime;

	// Use the above set start time to figure out how much longer we should fill
	// this buffer before officially declaring it as "full"
	if (tkCurrentTime - lpciInfo->tkStart > dwBufferTickLength)
	{
		if (lpciInfo->bTimesUp)
		{
			lpciInfo->bTimesUp = FALSE;
			return CONVERTERR_BUFFERFULL;
		}
		else
			lpciInfo->bTimesUp = TRUE;
	}

	tkNow = tkCurrentTime;

	// Delta time is absolute event time minus absolute time
	// already gone by on this track
	tkDelta = pMe->tkEvent - tkCurrentTime;

	// Event time is now current time on this track
	tkCurrentTime = pMe->tkEvent;

	if (pMe->abEvent[0] < MIDI_SYSEX)
	{
		// Channel message. We know how long it is, just copy it.
		// Need 3 DWORD's: delta-t, stream-ID, event
		if (lpciInfo->dwMaxLength-lpciInfo->dwBytesRecorded < 3*sizeof (DWORD))
		{
			// Cleanup from our write operation
			return CONVERTERR_BUFFERFULL;
		}

		pmeEvent->dwDeltaTime = tkDelta;
		pmeEvent->dwStreamID = 0;
		pmeEvent->dwEvent = (pMe->abEvent[0])
		                    | (((DWORD)pMe->abEvent[1]) << 8)
		                    | (((DWORD)pMe->abEvent[2]) << 16)
		                    | MEVT_F_SHORT;

		//faB: control the volume with our own volume percentage
		if (((pMe->abEvent[0] & 0xF0) == MIDI_CTRLCHANGE) &&
			(pMe->abEvent[1] == MIDICTRL_VOLUME))
		{
			// If this is a volume change, generate a callback so we can grab
			// the new volume for our cache
			// BP: this seems like this is useless and cause many many many bugs !
			//pmeEvent->dwEvent |= MEVT_F_CALLBACK;
		}
		lpciInfo->dwBytesRecorded += 3 *sizeof (DWORD);
	}
	else if ((pMe->abEvent[0] == MIDI_SYSEX) ||
			(pMe->abEvent[0] == MIDI_SYSEXEND))
	{
		if (devparm) // Tails
			I_OutputMsg("NOTE: Ignoring SysEx for now.\n");
	}
	else
	{
		DWORD   dwCurrentTempo;

		// Better be a meta event.
		//  BYTE        byEvent
		//  BYTE        byEventType
		//  VDWORD      dwEventLength
		//  BYTE        pLongEventData[dwEventLength]
		//
		if (!(pMe->abEvent[0] == MIDI_META))
		{
			I_Error("AddEventToStreamBuffer: not a META event\n");
		}

		// The only meta-event we care about is change tempo
		//
		if (pMe->abEvent[1] != MIDI_META_TEMPO)
			return CONVERTERR_METASKIP;

//.........这里部分代码省略.........
开发者ID:Pupswoof117,项目名称:SRB2-Public,代码行数:101,代码来源:mid2strm.c

示例2: IdentifyVersion

//
// IdentifyVersion
// Checks availability of IWAD files by name,
// to determine whether registered/commercial features
// should be executed (notably loading PWAD's).
//
void IdentifyVersion (void)
{

    char*	doom1wad;
    char*	doomwad;
    char*	doomuwad;
    char*	doom2wad;

    char*	doom2fwad;
    char*	plutoniawad;
    char*	tntwad;

#ifdef NORMALUNIX
    char *home;
    char *doomwaddir;
    doomwaddir = getenv("DOOMWADDIR");
    if (!doomwaddir)
	doomwaddir = ".";

    // Commercial.
    doom2wad = malloc(strlen(doomwaddir)+1+9+1);
    sprintf(doom2wad, "%s/doom2.wad", doomwaddir);

    // Retail.
    doomuwad = malloc(strlen(doomwaddir)+1+8+1);
    sprintf(doomuwad, "%s/doomu.wad", doomwaddir);
    
    // Registered.
    doomwad = malloc(strlen(doomwaddir)+1+8+1);
    sprintf(doomwad, "%s/doom.wad", doomwaddir);
    
    // Shareware.
    doom1wad = malloc(strlen(doomwaddir)+1+9+1);
    sprintf(doom1wad, "%s/doom1.wad", doomwaddir);

     // Bug, dear Shawn.
    // Insufficient malloc, caused spurious realloc errors.
    plutoniawad = malloc(strlen(doomwaddir)+1+/*9*/12+1);
    sprintf(plutoniawad, "%s/plutonia.wad", doomwaddir);

    tntwad = malloc(strlen(doomwaddir)+1+9+1);
    sprintf(tntwad, "%s/tnt.wad", doomwaddir);


    // French stuff.
    doom2fwad = malloc(strlen(doomwaddir)+1+10+1);
    sprintf(doom2fwad, "%s/doom2f.wad", doomwaddir);

    home = getenv("HOME");
    if (!home)
      I_Error("Please set $HOME to your home directory");
    sprintf(basedefault, "%s/.doomrc", home);
#endif

    if (M_CheckParm ("-shdev"))
    {
	gamemode = shareware;
	devparm = true;
	D_AddFile (DEVDATA"doom1.wad");
	D_AddFile (DEVMAPS"data_se/texture1.lmp");
	D_AddFile (DEVMAPS"data_se/pnames.lmp");
	strcpy (basedefault,DEVDATA"default.cfg");
	return;
    }

    if (M_CheckParm ("-regdev"))
    {
	gamemode = registered;
	devparm = true;
	D_AddFile (DEVDATA"doom.wad");
	D_AddFile (DEVMAPS"data_se/texture1.lmp");
	D_AddFile (DEVMAPS"data_se/texture2.lmp");
	D_AddFile (DEVMAPS"data_se/pnames.lmp");
	strcpy (basedefault,DEVDATA"default.cfg");
	return;
    }

    if (M_CheckParm ("-comdev"))
    {
	gamemode = commercial;
	devparm = true;
	/* I don't bother
	if(plutonia)
	    D_AddFile (DEVDATA"plutonia.wad");
	else if(tnt)
	    D_AddFile (DEVDATA"tnt.wad");
	else*/
	    D_AddFile (DEVDATA"doom2.wad");
	    
	D_AddFile (DEVMAPS"cdata/texture1.lmp");
	D_AddFile (DEVMAPS"cdata/pnames.lmp");
	strcpy (basedefault,DEVDATA"default.cfg");
	return;
    }
//.........这里部分代码省略.........
开发者ID:1833183060,项目名称:DOOM,代码行数:101,代码来源:d_main.c

示例3: SOCK_Send

static void SOCK_Send(void)
{
	ssize_t c = ERRSOCKET;
	socklen_t d4 = (socklen_t)sizeof(struct sockaddr_in);
#ifdef HAVE_IPV6
	socklen_t d6 = (socklen_t)sizeof(struct sockaddr_in6);
#endif
	socklen_t d, da = (socklen_t)sizeof(mysockaddr_t);
	size_t i, j;

	if (!nodeconnected[doomcom->remotenode])
		return;

	if (doomcom->remotenode == BROADCASTADDR)
	{
		for (i = 0; i < mysocketses; i++)
		{
			for (j = 0; j < broadcastaddresses; j++)
			{
				if (myfamily[i] == broadcastaddress[j].any.sa_family)
				{
					if (broadcastaddress[i].any.sa_family == AF_INET)
						d = d4;
#ifdef HAVE_IPV6
					if (broadcastaddress[i].any.sa_family == AF_INET6)
						d = d6;
#endif
					else
						d = da;

					c = sendto(mysockets[i], (char *)&doomcom->data, doomcom->datalength, 0,
						&broadcastaddress[j].any, d);
				}
			}
		}
		return;
	}
	else if (nodesocket[doomcom->remotenode] == BADSOCKET)
	{
		for (i = 0; i < mysocketses; i++)
		{
			if (myfamily[i] == clientaddress[doomcom->remotenode].any.sa_family)
			{
				if (clientaddress[doomcom->remotenode].any.sa_family == AF_INET)
					d = d4;
#ifdef HAVE_IPV6
				else if (clientaddress[doomcom->remotenode].any.sa_family == AF_INET6)
					d = d6;
#endif
				else
					d = da;

				sendto(mysockets[i], (char *)&doomcom->data, doomcom->datalength, 0,
					&clientaddress[doomcom->remotenode].any, d);
			}
		}
		return;
	}
	else
	{
		if (clientaddress[doomcom->remotenode].any.sa_family == AF_INET)
			d = d4;
#ifdef HAVE_IPV6
		if (clientaddress[doomcom->remotenode].any.sa_family == AF_INET6)
			d = d6;
#endif
		else
			d = da;

		c = sendto(nodesocket[doomcom->remotenode], (char *)&doomcom->data, doomcom->datalength, 0,
			&clientaddress[doomcom->remotenode].any, d);
	}

	if (c == ERRSOCKET && errno != ECONNREFUSED && errno != EWOULDBLOCK)
		I_Error("SOCK_Send, error sending to node %d (%s) #%u: %s", doomcom->remotenode,
			SOCK_GetNodeAddress(doomcom->remotenode), errno, strerror(errno));
}
开发者ID:RedEnchilada,项目名称:SRB2,代码行数:77,代码来源:i_tcp.c

示例4: I_Error

void AActor::Serialize (FArchive &arc)
{
	Super::Serialize (arc);
	if (arc.IsStoring ())
	{
		arc << x
			<< y
			<< z
			<< pitch
			<< angle
			<< roll
			<< (int)sprite
			<< frame
			<< effects
			<< floorz
			<< ceilingz
			<< radius
			<< height
			<< momx
			<< momy
			<< momz
			<< (int)type
			<< tics
			<< state
			<< flags
			<< flags2
			<< health
			<< movedir
			<< visdir
			<< movecount
			<< target->netid
			<< lastenemy->netid
			<< reactiontime
			<< threshold
			<< player
			<< lastlook
			<< tracer->netid
			<< tid
			<< goal->netid
			<< (unsigned)0
			<< translucency
			<< waterlevel;
		spawnpoint.Serialize (arc);
	}
	else
	{
		unsigned dummy;
		arc >> x
			>> y
			>> z
			>> pitch
			>> angle
			>> roll
			>> (int&)sprite
			>> frame
			>> effects
			>> floorz
			>> ceilingz
			>> radius
			>> height
			>> momx
			>> momy
			>> momz
			>> (int&)type
			>> tics
			>> state
			>> flags
			>> flags2
			>> health
			>> movedir
			>> visdir
			>> movecount
			>> target->netid
			>> lastenemy->netid
			>> reactiontime
			>> threshold
			>> player
			>> lastlook
			>> tracer->netid
			>> tid
			>> goal->netid
			>> dummy
			>> translucency
			>> waterlevel;

		DWORD trans;
		arc >> trans;
		spawnpoint.Serialize (arc);
		if(type >= NUMMOBJTYPES)
			I_Error("Unknown object type in saved game");
		if(sprite >= NUMSPRITES)
			I_Error("Unknown sprite in saved game");
		info = &mobjinfo[type];
		touching_sectorlist = NULL;
		LinkToWorld ();
		AddToHash ();
	}
}
开发者ID:JohnnyonFlame,项目名称:odamex,代码行数:98,代码来源:p_mobj.cpp

示例5: load_bmp_v3

int load_bmp_v3 (IMAGEDATA *im, uint8 *data)
{
  uint8  byte;
  uint16 word;
  uint32 dword, data_offset;
  uint32 compression, size;
  uint32 scan_len, data_len;
  int x, y;

  /* go through header */
  dword = read_little_32 (&data);
  dword = read_little_32 (&data);
  data_offset = read_little_32 (&data);

  /* load info struct */
  /* header size */
  dword = read_little_32 (&data);
  if (dword != 40)
  {
    I_Error ("load_bmp(): Unexpected header size, expected 40 got %d", word);
    return (-1);
  }
  dword = read_little_32 (&data);
  im->width = dword;
  dword = read_little_32 (&data);
  im->height = dword;
  /* image planes, always 1 */
  word = read_little_16 (&data);
  /* bits per pixel */
  word = read_little_16 (&data);
  im->colordepth = word;
  /* compression method */
  dword = read_little_32 (&data);
  compression = dword;
  dword = read_little_32 (&data);
  size = dword;
  if (!size)
  {
    I_Message ("-W- Uh oh, image size is 0, guessing\n");
    size = im->height * im->width * im->colordepth / 8;
  }
//  else
//    I_Message ("Size is %d\n", size);

  /* horz resolution */
  dword = read_little_32 (&data);
  /* vert resolution */
  dword = read_little_32 (&data);
  /* colors */
  dword = read_little_32 (&data);
  im->numcolors = dword;
  /* significant colors */
  dword = read_little_32 (&data);

  /* Palette on 1, 4 or 8 bit displays */
  if (im->colordepth != 24)
  {
    if (im->numcolors == 0)
    {
      /* Hmm, if numcolors is 0, guess using the start of data */
      im->numcolors = (data_offset - 54) / 4;
    }

    im->palette = (RGBQUAD *) malloc (im->numcolors * sizeof (RGBQUAD));
    for (x = 0; x < im->numcolors; x++)
    {
      dword = read_little_32 (&data);
      im->palette[x].red = (dword >> 16) & 0x0ff;
      im->palette[x].green = (dword >> 8) & 0x0ff;
      im->palette[x].blue = (dword >> 0) & 0x0ff;
    }
  }
  else
开发者ID:jeske,项目名称:hz,代码行数:73,代码来源:bmp.cpp

示例6: W_LumpLength

int W_LumpLength (int lump)
{
	if (lump >= numlumps)
		I_Error ("W_LumpLength: %i >= numlumps",lump);
	return lumpinfo[lump].size;
}
开发者ID:BruceJawn,项目名称:flash-doom,代码行数:6,代码来源:w_wad.c

示例7: D_SRB2Main

//
// D_SRB2Main
//
void D_SRB2Main(void)
{
	INT32 p;
	char srb2[82]; // srb2 title banner
	char title[82];

	INT32 pstartmap = 1;
	boolean autostart = false;

	// keep error messages until the final flush(stderr)
#if !defined (PC_DOS) && !defined (_WIN32_WCE) && !defined(NOTERMIOS)
	if (setvbuf(stderr, NULL, _IOFBF, 1000))
		I_OutputMsg("setvbuf didnt work\n");
#endif

#ifdef GETTEXT
	// initialise locale code
	M_StartupLocale();
#endif

	// get parameters from a response file (eg: srb2 @parms.txt)
	M_FindResponseFile();

	// MAINCFG is now taken care of where "OBJCTCFG" is handled
	G_LoadGameSettings();

	// Test Dehacked lists
	DEH_Check();

	// identify the main IWAD file to use
	IdentifyVersion();

#if !defined (_WIN32_WCE) && !defined(NOTERMIOS)
	setbuf(stdout, NULL); // non-buffered output
#endif

#if defined (_WIN32_WCE) //|| defined (_DEBUG) || defined (GP2X)
	devparm = M_CheckParm("-nodebug") == 0;
#else
	devparm = M_CheckParm("-debug") != 0;
#endif

	// for dedicated server
#if !defined (_WINDOWS) //already check in win_main.c
	dedicated = M_CheckParm("-dedicated") != 0;
#endif

	strcpy(title, "Sonic Robo Blast 2");
	strcpy(srb2, "Sonic Robo Blast 2");
	D_MakeTitleString(srb2);

#ifdef PC_DOS
	D_Titlebar(srb2, title);
#endif

#if defined (__OS2__) && !defined (HAVE_SDL)
	// set PM window title
	snprintf(pmData->title, sizeof (pmData->title),
		"Sonic Robo Blast 2" VERSIONSTRING ": %s",
		title);
	pmData->title[sizeof (pmData->title) - 1] = '\0';
#endif

	if (devparm)
		CONS_Printf(M_GetText("Development mode ON.\n"));

	// default savegame
	strcpy(savegamename, SAVEGAMENAME"%u.ssg");

	{
		const char *userhome = D_Home(); //Alam: path to home

		if (!userhome)
		{
#if ((defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)) && !defined (__CYGWIN__) && !defined (DC) && !defined (PSP) && !defined(GP2X)
			I_Error("Please set $HOME to your home directory\n");
#elif defined (_WIN32_WCE) && 0
			if (dedicated)
				snprintf(configfile, sizeof configfile, "/Storage Card/SRB2DEMO/d"CONFIGFILENAME);
			else
				snprintf(configfile, sizeof configfile, "/Storage Card/SRB2DEMO/"CONFIGFILENAME);
#else
			if (dedicated)
				snprintf(configfile, sizeof configfile, "d"CONFIGFILENAME);
			else
				snprintf(configfile, sizeof configfile, CONFIGFILENAME);
#endif
		}
		else
		{
			// use user specific config file
#ifdef DEFAULTDIR
			snprintf(srb2home, sizeof srb2home, "%s" PATHSEP DEFAULTDIR, userhome);
			snprintf(downloaddir, sizeof downloaddir, "%s" PATHSEP "DOWNLOAD", srb2home);
			if (dedicated)
				snprintf(configfile, sizeof configfile, "%s" PATHSEP "d"CONFIGFILENAME, srb2home);
			else
//.........这里部分代码省略.........
开发者ID:ilag11111,项目名称:SRB2,代码行数:101,代码来源:d_main.c

示例8: R_DrawPlanes

//-----------------------------------------------------------------------------
//
// R_DrawPlanes
// At the end of each frame.
//
void R_DrawPlanes(void)
{
    int i;
    visplane_t *pl;

#ifdef RANGECHECK
    if (ds_p > &drawsegs[MAXDRAWSEGS])
        I_Error ("R_DrawPlanes: drawsegs overflow (%i)",
                 ds_p - drawsegs);

    if (lastvisplane > &visplanes[MAXVISPLANES])
        I_Error ("R_DrawPlanes: visplane overflow (%i)",
                 lastvisplane - visplanes);

    if (lastopening > &openings[MAXOPENINGS])
        I_Error ("R_DrawPlanes: opening overflow (%i)",
                 lastopening - openings);
#endif

    if (showrplanestats)
    {
#ifdef __riscos
        extern void _kernel_oswrch (int);
        _kernel_oswrch (31);
        _kernel_oswrch (0);
        _kernel_oswrch (0);
#endif
        printf ("Drawsegs = %u/%u, Visplanes = %u/%u, Openings = %u/%u\n",
                ds_p - drawsegs, MAXDRAWSEGS,
                lastvisplane - visplanes, MAXVISPLANES,
                lastopening - openings, MAXOPENINGS);
    }

    for (pl = visplanes ; pl < lastvisplane ; pl++)
    {
        if (pl->minx <= pl->maxx)
        {
            int picnum = pl->picnum;

            // sky flat
            if (picnum == skyflatnum || (picnum & PL_SKYFLAT))
            {
                int	 x;
                int	 texture;
                int	 offset;
                angle_t  an, flip;
                rpatch_t *tex_patch;

                // killough 10/98: allow skies to come from sidedefs.
                // Allows scrolling and/or animated skies, as well as
                // arbitrary multiple skies per level without having
                // to use info lumps.
                an = viewangle;

                if (picnum & PL_SKYFLAT)
                {
                    // Sky Linedef
                    const line_t *l = &lines[picnum & ~PL_SKYFLAT];

                    // Sky transferred from first sidedef
                    const side_t *s = *l->sidenum + sides;

                    // Texture comes from upper texture of reference sidedef
                    texture = texturetranslation[s->toptexture];

                    // Horizontal offset is turned into an angle offset,
                    // to allow sky rotation as well as careful positioning.
                    // However, the offset is scaled very small, so that it
                    // allows a long-period of sky rotation.
                    an += s->textureoffset;

                    // Vertical offset allows careful sky positioning.
                    dc_texturemid = s->rowoffset - 28 * FRACUNIT;

                    // We sometimes flip the picture horizontally.
                    //
                    // DOOM always flipped the picture, so we make it optional,
                    // to make it easier to use the new feature, while to still
                    // allow old sky textures to be used.
                    flip = l->special==272 ? 0u : ~0u;
                }
                else	// Normal DOOM sky, only one allowed per level
                {
                    dc_texturemid = skytexturemid;	// Default y-offset
                    texture = skytexture;			// Default texture
                    flip = 0;				// DOOM flips it
                }

                // Sky is always drawn full bright,
                //  i.e. colormaps[0] is used.
                // Because of this hack, sky is not affected
                //  by INVUL inverse mapping.
                dc_colormap = (fixedcolormap ? fixedcolormap : colormaps);

                dc_ylim = textureheight[texture];
//.........这里部分代码省略.........
开发者ID:jeffdoggett,项目名称:Doom,代码行数:101,代码来源:r_plane.c

示例9: R_Subsector

//
// R_Subsector
// Determine floor/ceiling planes.
// Add sprites of things in sector.
// Draw one or more line segments.
//
void R_Subsector (int num)
{
	int 		 count;
	seg_t*		 line;
	subsector_t *sub;
	sector_t     tempsec;				// killough 3/7/98: deep water hack
	int          floorlightlevel;		// killough 3/16/98: set floor lightlevel
	int          ceilinglightlevel;		// killough 4/11/98

#ifdef RANGECHECK
    if (num>=numsubsectors)
		I_Error ("R_Subsector: ss %i with numss = %i",
				 num,
				 numsubsectors);
#endif

	sub = &subsectors[num];
	frontsector = sub->sector;
	count = sub->numlines;
	line = &segs[sub->firstline];

	// killough 3/8/98, 4/4/98: Deep water / fake ceiling effect
	frontsector = R_FakeFlat(frontsector, &tempsec, &floorlightlevel,
						   &ceilinglightlevel, false);	// killough 4/11/98

	basecolormap = frontsector->colormap->maps;

	ceilingplane = P_CeilingHeight(camera) > viewz ||
		frontsector->ceilingpic == skyflatnum ||
		(frontsector->heightsec && 
		!(frontsector->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC) && 
		frontsector->heightsec->floorpic == skyflatnum) ?
		R_FindPlane(frontsector->ceilingplane,		// killough 3/8/98
					frontsector->ceilingpic == skyflatnum &&  // killough 10/98
						frontsector->sky & PL_SKYFLAT ? frontsector->sky :
						frontsector->ceilingpic,
					ceilinglightlevel,				// killough 4/11/98
					frontsector->ceiling_xoffs,		// killough 3/7/98
					frontsector->ceiling_yoffs + frontsector->base_ceiling_yoffs,
					frontsector->ceiling_xscale,
					frontsector->ceiling_yscale,
					frontsector->ceiling_angle + frontsector->base_ceiling_angle
					) : NULL;

	// killough 3/7/98: Add (x,y) offsets to flats, add deep water check
	// killough 3/16/98: add floorlightlevel
	// killough 10/98: add support for skies transferred from sidedefs
	floorplane = P_FloorHeight(camera) < viewz || // killough 3/7/98
		(frontsector->heightsec &&
		!(frontsector->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC) &&
		frontsector->heightsec->ceilingpic == skyflatnum) ?
		R_FindPlane(frontsector->floorplane,
					frontsector->floorpic == skyflatnum &&  // killough 10/98
						frontsector->sky & PL_SKYFLAT ? frontsector->sky :
						frontsector->floorpic,
					floorlightlevel,				// killough 3/16/98
					frontsector->floor_xoffs,		// killough 3/7/98
					frontsector->floor_yoffs + frontsector->base_floor_yoffs,
					frontsector->floor_xscale,
					frontsector->floor_yscale,
					frontsector->floor_angle + frontsector->base_floor_angle
					) : NULL;

	// [RH] set foggy flag
	foggy = level.fadeto_color[0] || level.fadeto_color[1] || level.fadeto_color[2] || level.fadeto_color[3]
				|| frontsector->colormap->fade;

	// killough 9/18/98: Fix underwater slowdown, by passing real sector
	// instead of fake one. Improve sprite lighting by basing sprite
	// lightlevels on floor & ceiling lightlevels in the surrounding area.
	R_AddSprites (sub->sector, (floorlightlevel + ceilinglightlevel) / 2, FakeSide);

	// [RH] Add particles
	if (r_particles)
	{
		for (WORD i = ParticlesInSubsec[num]; i != NO_PARTICLE; i = Particles[i].nextinsubsector)
			R_ProjectParticle(Particles + i, subsectors[num].sector, FakeSide);
	}		

	if (sub->poly)
	{ // Render the polyobj in the subsector first
		int polyCount = sub->poly->numsegs;
		seg_t **polySeg = sub->poly->segs;
		while (polyCount--)
			R_AddLine (*polySeg++);
	}
	
	while (count--)
		R_AddLine (line++);
}
开发者ID:davidsgalbraith,项目名称:odamex,代码行数:96,代码来源:r_bsp.cpp

示例10: return

void *(Z_Realloc)(void *ptr, int size, int tag, void *user, const char *file, int line) {
    memblock_t *block;
    memblock_t *newblock;
    unsigned char *data;
    void *result;

    if(!ptr) {
        return (Z_Malloc)(size, tag, user, file, line);
    }

    if(size == 0) {
        (Z_Free)(ptr, file, line);
        return NULL;
    }

    if(tag < 0 || tag >= PU_MAX) {
        I_Error("Z_Realloc: tag out of range: %i (%s:%d)", tag, file, line);
    }

    if(user == NULL && tag >= PU_PURGELEVEL) {
        I_Error("Z_Realloc: an owner is required for purgable blocks (%s:%d)", file, line);
    }

    block = (memblock_t*)((byte *)ptr - sizeof(memblock_t));

    newblock = NULL;

    if(block->id != ZONEID) {
        I_Error("Z_Realloc: Reallocated a pointer without ZONEID (%s:%d)", file, line);
    }

    Z_RemoveBlock(block);

    block->next = NULL;
    block->prev = NULL;

    if(block->user) {
        *block->user = NULL;
    }

    if(!(newblock = (memblock_t*)realloc(block, sizeof(memblock_t) + size))) {
        if(Z_ClearCache(sizeof(memblock_t) + size)) {
            newblock = (memblock_t*)realloc(block, sizeof(memblock_t) + size);
        }
    }

    if(!newblock) {
        I_Error("Z_Realloc: failed on allocation of %u bytes (%s:%d)", size, file, line);
    }

    newblock->tag = tag;
    newblock->id = ZONEID;
    newblock->user = user;
    newblock->size = size;

    Z_InsertBlock(newblock);

    data = (unsigned char*)newblock;
    result = data + sizeof(memblock_t);

    if(user != NULL) {
        *newblock->user = result;
    }

#ifdef ZONEFILE
    Z_LogPrintf("* %p = Z_Realloc(ptr=%p, n=%lu, tag=%d, user=%p, source=%s:%d)\n",
                result, ptr, size, tag, user, file, line);
#endif

    return result;
}
开发者ID:gabrielbaez,项目名称:Doom64EX,代码行数:71,代码来源:z_zone.c

示例11: SHORT

//
// V_DrawPatchFlipped 
// Masks a column based masked pic to the screen.
// Flips horizontally, e.g. to mirror face.
//
void
V_DrawPatchFlipped
( int		x,
  int		y,
  int		scrn,
  patch_t*	patch ) 
{ 

    int				count;
    int				col; 
    postColumn_t*	column; 
    byte*			source; 
    int				w; 
	 
    y -= SHORT(patch->topoffset); 
    x -= SHORT(patch->leftoffset); 
#ifdef RANGECHECK 
    if (x<0
	||x+SHORT(patch->width) >ORIGINAL_WIDTH
	|| y<0
	|| y+SHORT(patch->height)>ORIGINAL_HEIGHT
	|| (unsigned)scrn>4)
    {
      I_PrintfE("Patch origin %d,%d exceeds LFB\n", x,y );
      I_Error ("Bad V_DrawPatch in V_DrawPatchFlipped");
    }
#endif 
 
    if (!scrn)
	V_MarkRect (x, y, SHORT(patch->width), SHORT(patch->height)); 

    col = 0; 
	int destx = x;
	int desty = y;

    w = SHORT(patch->width); 

    for ( ; col<w ; x++, col++ ) 
    { 
		column = (postColumn_t *)((byte *)patch + LONG(patch->columnofs[w-1-col])); 

		destx = x;
	 
		// step through the posts in a column 
		while (column->topdelta != 0xff ) 
		{ 
			source = (byte *)column + 3; 
			desty = y + column->topdelta;
			count = column->length; 
				 
			while (count--) 
			{
				int scaledx, scaledy;
				scaledx = destx * GLOBAL_IMAGE_SCALER;
				scaledy = desty * GLOBAL_IMAGE_SCALER;
				byte src = *source++;

				for ( int i = 0; i < GLOBAL_IMAGE_SCALER; i++ ) {
					for ( int j = 0; j < GLOBAL_IMAGE_SCALER; j++ ) {
						::g->screens[scrn][( scaledx + j ) + ( scaledy + i ) * SCREENWIDTH] = src;
					}
				}

				desty++;
			} 
			column = (postColumn_t *)(  (byte *)column + column->length + 4 );
		} 
    }			 
} 
开发者ID:469486139,项目名称:DOOM-3-BFG,代码行数:74,代码来源:v_video.cpp

示例12: R_InitTextures


//.........这里部分代码省略.........
    {
        maptex2 = NULL;
        numtextures2 = 0;
        maxoff2 = 0;
    }
    numtextures = numtextures1 + numtextures2;
        
    textures = Z_Malloc (numtextures*4, PU_STATIC, 0);
    texturecolumnlump = Z_Malloc (numtextures*4, PU_STATIC, 0);
    texturecolumnofs = Z_Malloc (numtextures*4, PU_STATIC, 0);
    texturecomposite = Z_Malloc (numtextures*4, PU_STATIC, 0);
    texturecompositesize = Z_Malloc (numtextures*4, PU_STATIC, 0);
    texturewidthmask = Z_Malloc (numtextures*4, PU_STATIC, 0);
    textureheight = Z_Malloc (numtextures*4, PU_STATIC, 0);

    totalwidth = 0;
    
    //  Really complex printing shit...
    temp1 = W_GetNumForName ("S_START");  // P_???????
    temp2 = W_GetNumForName ("S_END") - 1;
    temp3 = ((temp2-temp1+63)/64) + ((numtextures+63)/64);
    printf("[");
    for (i = 0; i < temp3; i++)
        printf(" ");
    printf("         ]");
    for (i = 0; i < temp3; i++)
        printf("\x8");
    printf("\x8\x8\x8\x8\x8\x8\x8\x8\x8\x8");   
        
    for (i=0 ; i<numtextures ; i++, directory++)
    {
        if (!(i&63))
            printf (".");

        if (i == numtextures1)
        {
            // Start looking in second texture file.
            maptex = maptex2;
            maxoff = maxoff2;
            directory = maptex+1;
        }
                
        offset = LONG(*directory);

        if (offset > maxoff)
            I_Error ("R_InitTextures: bad texture directory");
        
        mtexture = (maptexture_t *) ( (byte *)maptex + offset);

        texture = textures[i] =
            Z_Malloc (sizeof(texture_t)
                      + sizeof(texpatch_t)*(SHORT(mtexture->patchcount)-1),
                      PU_STATIC, 0);
        
        texture->width = SHORT(mtexture->width);
        texture->height = SHORT(mtexture->height);
        texture->patchcount = SHORT(mtexture->patchcount);

        memcpy (texture->name, mtexture->name, sizeof(texture->name));
        mpatch = &mtexture->patches[0];
        patch = &texture->patches[0];

        for (j=0 ; j<texture->patchcount ; j++, mpatch++, patch++)
        {
            patch->originx = SHORT(mpatch->originx);
            patch->originy = SHORT(mpatch->originy);
            patch->patch = patchlookup[SHORT(mpatch->patch)];
            if (patch->patch == -1)
            {
                I_Error ("R_InitTextures: Missing patch in texture %s",
                         texture->name);
            }
        }               
        texturecolumnlump[i] = Z_Malloc (texture->width*2, PU_STATIC,0);
        texturecolumnofs[i] = Z_Malloc (texture->width*2, PU_STATIC,0);

        j = 1;
        while (j*2 <= texture->width)
            j<<=1;

        texturewidthmask[i] = j-1;
        textureheight[i] = texture->height<<FRACBITS;
                
        totalwidth += texture->width;
    }

    Z_Free (maptex1);
    if (maptex2)
        Z_Free (maptex2);
    
    // Precalculate whatever possible.  
    for (i=0 ; i<numtextures ; i++)
        R_GenerateLookup (i);
    
    // Create translation table for global animation.
    texturetranslation = Z_Malloc ((numtextures+1)*4, PU_STATIC, 0);
    
    for (i=0 ; i<numtextures ; i++)
        texturetranslation[i] = i;
}
开发者ID:Misha-Mainenko,项目名称:kolibrios-llvm,代码行数:101,代码来源:r_data.c

示例13: R_GenerateLookup

//
// R_GenerateLookup
//
void R_GenerateLookup (int texnum)
{
    texture_t*          texture;
    byte*               patchcount;     // patchcount[texture->width]
    texpatch_t*         patch;  
    patch_t*            realpatch;
    int                 x;
    int                 x1;
    int                 x2;
    int                 i;
    short*              collump;
    unsigned short*     colofs;
        
    texture = textures[texnum];

    // Composited texture not created yet.
    texturecomposite[texnum] = 0;
    
    texturecompositesize[texnum] = 0;
    collump = texturecolumnlump[texnum];
    colofs = texturecolumnofs[texnum];
    
    // Now count the number of columns
    //  that are covered by more than one patch.
    // Fill in the lump / offset, so columns
    //  with only a single patch are all done.
    patchcount = (byte *)alloca (texture->width);
    memset (patchcount, 0, texture->width);
    patch = texture->patches;
                
    for (i=0 , patch = texture->patches;
         i<texture->patchcount;
         i++, patch++)
    {
        realpatch = W_CacheLumpNum (patch->patch, PU_CACHE);
        x1 = patch->originx;
        x2 = x1 + SHORT(realpatch->width);
        
        if (x1 < 0)
            x = 0;
        else
            x = x1;

        if (x2 > texture->width)
            x2 = texture->width;
        for ( ; x<x2 ; x++)
        {
            patchcount[x]++;
            collump[x] = patch->patch;
            colofs[x] = LONG(realpatch->columnofs[x-x1])+3;
        }
    }
        
    for (x=0 ; x<texture->width ; x++)
    {
        if (!patchcount[x])
        {
            printf ("R_GenerateLookup: column without a patch (%s)\n",
                    texture->name);
            return;
        }
        // I_Error ("R_GenerateLookup: column without a patch");
        
        if (patchcount[x] > 1)
        {
            // Use the cached block.
            collump[x] = -1;    
            colofs[x] = texturecompositesize[texnum];
            
            if (texturecompositesize[texnum] > 0x10000-texture->height)
            {
                I_Error ("R_GenerateLookup: texture %i is >64k",
                         texnum);
            }
            
            texturecompositesize[texnum] += texture->height;
        }
    }   
}
开发者ID:Misha-Mainenko,项目名称:kolibrios-llvm,代码行数:82,代码来源:r_data.c

示例14: Mid2StreamConvertToBuffer

// -------------------------
// Mid2StreamConvertToBuffer
//
// This function converts MIDI data from the track buffers setup by a previous
// call to Mid2StreamConverterInit().  It will convert data until an error is
// encountered or the output buffer has been filled with as much event data
// as possible, not to exceed dwMaxLength. This function can take a couple
// bit flags, passed through dwFlags. Information about the success/failure
// of this operation and the number of output bytes actually converted will
// be returned in the CONVERTINFO structure pointed at by lpciInfo.
// -------------------------
int Mid2StreamConvertToBuffer(DWORD dwFlags, LPCONVERTINFO lpciInfo)
{
	static LPINTRACKSTATE pInTrack, pInTrackFound;
	static DWORD          dwStatus;
	static DWORD          tkNext;
	static TEMPEVENT      teTemp;

	int     nChkErr;
	DWORD   idx;

	lpciInfo->dwBytesRecorded = 0;

	if (dwFlags & CONVERTF_RESET)
	{
		dwProgressBytes = 0;
		dwStatus = 0;
		ZeroMemory(&teTemp, sizeof (TEMPEVENT));
		pInTrack = pInTrackFound = NULL;
	}

	// If we were already done, then return with a warning...
	if (dwStatus & CONVERTF_STATUS_DONE)
	{
		if (bMidiLooped)
		{
			Mid2StreamRewindConverter();
			dwProgressBytes = 0;
			dwStatus = 0;
		}
		else
			return CONVERTERR_DONE;
	}
	// The caller is asking us to continue, but we're already hosed because we
	// previously identified something as corrupt, so complain louder this time.
	else if (dwStatus & CONVERTF_STATUS_STUCK)
		return CONVERTERR_STUCK;
	else if (dwStatus & CONVERTF_STATUS_GOTEVENT)
	{
		// Turn off this bit flag
		dwStatus ^= CONVERTF_STATUS_GOTEVENT;

		// Don't add end of track event 'til we're done
		//
		if (teTemp.abEvent[0] == MIDI_META &&
			teTemp.abEvent[1] == MIDI_META_EOT)
		{
		}
		else if ((nChkErr = AddEventToStreamBuffer(&teTemp, lpciInfo))
		         != CONVERTERR_NOERROR)
		{
			if (nChkErr == CONVERTERR_BUFFERFULL)
			{
				// Do some processing and tell caller that this buffer's full
				dwStatus |= CONVERTF_STATUS_GOTEVENT;
				return CONVERTERR_NOERROR;
			}
			else if (nChkErr == CONVERTERR_METASKIP)
			{
				// We skip by all meta events that aren't tempo changes...
			}
			else
			{
				I_Error("Unable to add event to stream buffer.");
			}
		}
	}

	for (; ;)
	{
		pInTrackFound = NULL;
		tkNext = 0xFFFFFFFFL;

		// Find nearest event due
		//
		for (idx = 0, pInTrack = ifs.pTracks; idx < ifs.nTracks; ++idx, ++pInTrack)
		{
			if ((!(pInTrack->fdwTrack & ITS_F_ENDOFTRK)) && (pInTrack->tkNextEventDue < tkNext))
			{
				tkNext = pInTrack->tkNextEventDue;
				pInTrackFound = pInTrack;
			}
		}

		// None found?  We must be done, so return to the caller with a smile.
		//
		if (!pInTrackFound)
		{
			dwStatus |= CONVERTF_STATUS_DONE;
			// Need to set return buffer members properly
//.........这里部分代码省略.........
开发者ID:Pupswoof117,项目名称:SRB2-Public,代码行数:101,代码来源:mid2strm.c

示例15: W_AddFile

void W_AddFile (char *filename)
{
    wadinfo_t		header;
    lumpinfo_t*		lump_p;
    unsigned		i;
    FILE	       *handle;
    int			length;
    int			startlump;
    filelump_t*		fileinfo;
    filelump_t		singleinfo;
    int			storehandle;
    
    // open the file and add to directory

    // handle reload indicator.
    if (filename[0] == '~')
    {
	filename++;
	reloadname = filename;
	reloadlump = numlumps;
    }
		
    if ( (handle = fopen (filename,"rb")) == NULL)
    {
	printf (" couldn't open %s\n",filename);
	return;
    }

    printf (" adding %s\n",filename);
    startlump = numlumps;
	
    if (I_strncasecmp (filename+strlen(filename)-3 , "wad", 3 ) )
    {
	// single lump file
	fileinfo = &singleinfo;
	singleinfo.filepos = 0;
	singleinfo.size = LONG(filelength(handle));
	ExtractFileBase (filename, singleinfo.name);
	numlumps++;
    }
    else 
    {
	// WAD file
	fread (&header, 1, sizeof(header), handle);
	if (strncmp(header.identification,"IWAD",4))
	{
	    // Homebrew levels?
	    if (strncmp(header.identification,"PWAD",4))
	    {
		I_Error ("Wad file %s doesn't have IWAD "
			 "or PWAD id\n", filename);
	    }
	    
	    // ???modifiedgame = true;		
	}
	header.numlumps = LONG(header.numlumps);
	header.infotableofs = LONG(header.infotableofs);
	length = header.numlumps*sizeof(filelump_t);
	fileinfo = alloca (length);
	fseek (handle, header.infotableofs, SEEK_SET);
	fread (fileinfo, 1, length, handle);
	numlumps += header.numlumps;
    }

    
    // Fill in lumpinfo
    lumpinfo = realloc (lumpinfo, numlumps*sizeof(lumpinfo_t));

    if (!lumpinfo)
	I_Error ("Couldn't realloc lumpinfo");

    lump_p = &lumpinfo[startlump];
	
    storehandle = reloadname ? -1 : (int)handle;
	
    for (i=startlump ; i<numlumps ; i++,lump_p++, fileinfo++)
    {
	lump_p->handle = storehandle;
	lump_p->position = LONG(fileinfo->filepos);
	lump_p->size = LONG(fileinfo->size);
	strncpy (lump_p->name, fileinfo->name, 8);
    }
	
    if (reloadname)
	fclose (handle);
}
开发者ID:FieldSoft-HelloClyde,项目名称:devkitPro,代码行数:86,代码来源:w_wad.c


注:本文中的I_Error函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。