/***********************************************************************
	函数名称:	IDENT_E2_ReadSTBID
	函数说明:	Read Ident ID (part of Mac Address) from E2
				(return TRUE : OK)
				(return FALSE: FAILED)
	修改记录:	日		 期 	 作 	 者 	  修定
					   ---------		 ---------		   -----

************************************************************************/
bool	IDENT_E2_ReadSTBID( uchar *pucData )
{
	sint	YWError = 0;
	//uchar	ucData[16];
	bool	iRet;

#if 0
	// Unlock Config Zone
	WriteDebug("\nUnlock Config Zone:");
	ucData[0] = 0xad;
	ucData[1] = 0x42;
	ucData[2] = 0x97;
	YWError = E2PROM_VerifyPwd(7, ucData, TRUE);
	if ( YWError == 0 )
	{
		WriteDebug("Success!!\n");
	}
	else
	{
		WriteDebug("Failed!\n");
	}
#endif
	// Read back MAC Addr
	WriteDebug("\nRead back Ident ID:");
	YWError = E2PROM_ReadConfigZone(0x19, pucData, 7);
	if ( YWError != 0 )
	{
		WriteDebug("Data Wrong!!\n");
		iRet = FALSE;
	}
	else
	{
		WriteDebug("Success!!\n");
		iRet = TRUE;
	}
#if 0
	// Lock Config Zone
	WriteDebug("\nLock Config Zone:");
	ucData[0] = 0x00;
	ucData[1] = 0x00;
	ucData[2] = 0x00;
	YWError = E2PROM_VerifyPwd(7, ucData, TRUE);
	if ( YWError == 0 )
	{
		WriteDebug("Success!!\n");
	}
	else
	{
		WriteDebug("Failed!\n");
	}
#endif
	return iRet;

}
示例#2
0
//
// R_InitData
// Locates all the lumps
//  that will be used by all views
// Must be called after W_Init.
//
void R_InitData (void)
{
    R_InitTextures ();
    sprintf (MsgText,"\nInitTextures");
    WriteDebug(MsgText);
    R_InitFlats ();
    sprintf (MsgText,"\nInitFlats");
    WriteDebug(MsgText);
    R_InitSpriteLumps ();
    sprintf (MsgText,"\nInitSprites");
    WriteDebug(MsgText);
    R_InitColormaps ();
    sprintf (MsgText,"\nInitColormaps");
    WriteDebug(MsgText);
}
示例#3
0
 void PrintDebug(const String &s)
 {
   for (uint16_t i = 0; i < s.length(); i++) 
   {
     WriteDebug(s[i]);
   }
 }
示例#4
0
 void WriteDebug(const uint8_t* buffer, size_t size)
 {
   while (size--) 
   {
     WriteDebug(*buffer++);
   }
 }
示例#5
0
 void WriteDebug(const char *str) 
 {
       if (str != NULL) 
       {
         WriteDebug((const uint8_t *)str, strlen(str));
       }
 }
示例#6
0
//
// R_InitSpriteLumps
// Finds the width and hoffset of all sprites in the wad,
//  so the sprite does not need to be cached completely
//  just for having the header info ready during rendering.
//
void R_InitSpriteLumps (void)
{
    int		i;
    patch_t	*patch;
	
    firstspritelump = W_GetNumForName ("S_START") + 1;
    lastspritelump = W_GetNumForName ("S_END") - 1;
    
    numspritelumps = lastspritelump - firstspritelump + 1;
    spritewidth = Z_Malloc (numspritelumps*4, PU_STATIC, 0);
    spriteoffset = Z_Malloc (numspritelumps*4, PU_STATIC, 0);
    spritetopoffset = Z_Malloc (numspritelumps*4, PU_STATIC, 0);
	
    for (i=0 ; i< numspritelumps ; i++)
    {
	if (!(i&63))
       {
	    sprintf (MsgText,".");
        WriteDebug(MsgText);
       }

	patch = W_CacheLumpNum (firstspritelump+i, PU_CACHE);
	spritewidth[i] = (patch->width)<<FRACBITS;
	spriteoffset[i] = (patch->leftoffset)<<FRACBITS;
	spritetopoffset[i] = (patch->topoffset)<<FRACBITS;
    }
}
示例#7
0
static void Log ( const char * format, ... )
{
#ifdef SPORT_DEBUG
  char buffer[64];
  va_list args;
  va_start (args, format);
  vsprintf (buffer,format, args);
  WriteDebug (buffer);
  va_end (args);
#endif
}
示例#8
0
 void PrintDebug(unsigned long n, uint8_t base)
 {
   if (base == 0) 
   {
     WriteDebug(n);
   }
   else 
   {
     PrintDebugNumber(n, base);
   }
 }
示例#9
0
 void PrintDebug(const __FlashStringHelper *ifsh)
 {
   PGM_P p = reinterpret_cast<PGM_P>(ifsh);
   while (1) 
   {
     unsigned char c = pgm_read_byte(p++);
     if (c == 0) 
     {
       break;
     }
     WriteDebug(c);
   }
 }
示例#10
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CChildFrame::CenterViews(void)
{
	if (!bUsingSplitter || !m_bReady)
	{
		return;
	}

	WriteDebug("childfrm::centerviews");

	CRect r;
	GetClientRect(r);
	CSize sizeView(r.Width()/2 - 3, r.Height()/2 - 3);

	sizeView.cy = max(0, sizeView.cy);
	sizeView.cx = max(0, sizeView.cx);

	m_wndSplitter->SetRowInfo(0, sizeView.cy, 0);
	m_wndSplitter->SetRowInfo(1, sizeView.cy, 0);
	m_wndSplitter->SetColumnInfo(0, sizeView.cx, 0);
	m_wndSplitter->SetColumnInfo(1, sizeView.cx, 0);
	m_wndSplitter->RecalcLayout();
	
	WriteDebug("childfrm::centerviews done");
}
示例#11
0
/*---------------------------------------------------------
  for Debug
----------------------------------------------------------*/
void Debug_ListChild(HWND hwndParent, int depth)
{
	HWND hwnd;
	char classname[80];
	int i;
	
	for(i = 0; i < depth && i < 79; i++) classname[i] = '+';
	classname[i] = 0;
	GetClassName(hwndParent, classname + i, 80 - i);
	WriteDebug(classname);
	
	hwnd = GetWindow(hwndParent, GW_CHILD);
	while(hwnd)
	{
		Debug_ListChild(hwnd, depth + 1);
		hwnd = GetWindow(hwnd, GW_HWNDNEXT);
	}
}
示例#12
0
//
// Z_DumpHeap
// Note: TFileDumpHeap( stdout ) ?
//
void
Z_DumpHeap
( int		lowtag,
  int		hightag )
{
    memblock_t*	block;
	
    sprintf (MsgText, "zone size: %i  location: %p\n",
	    mainzone->size,mainzone);
    WriteDebug(MsgText);
    
    sprintf (MsgText,"tag range: %i to %i\n",
	    lowtag, hightag);
    WriteDebug(MsgText);
	
    for (block = mainzone->blocklist.next ; ; block = block->next)
    {
	if (block->tag >= lowtag && block->tag <= hightag)
       {
	    sprintf (MsgText,"block:%p    size:%7i    user:%p    tag:%3i\n",
		    block, block->size, block->user, block->tag);
        WriteDebug(MsgText);
       }
		
	if (block->next == &mainzone->blocklist)
	{
	    // all blocks have been hit
	    break;
	}
	
	if ( (byte *)block + block->size != (byte *)block->next)
       {
	    sprintf(MsgText, "ERROR: block size does not touch the next block\n");
        WriteDebug(MsgText);
       }

	if ( block->next->prev != block)
       {
	    sprintf(MsgText, "ERROR: next block doesn't have proper back link\n");
        WriteDebug(MsgText);
       }

	if (!block->user && !block->next->user)
       {
	    sprintf(MsgText, "ERROR: two consecutive free blocks\n");
        WriteDebug(MsgText);
       }
    }
}
示例#13
0
 void PrintDebug(long n, uint8_t base)
 {
   if (base == 0) 
   {
     WriteDebug(n);
   } 
   else if (base == 10) 
   {
     if (n < 0) 
     {
       PrintDebug('-');
       n = -n;
       PrintDebugNumber(n, 10);
     }
     PrintDebugNumber(n, 10);
   } 
   else 
   {
     PrintDebugNumber(n, base);
   }
 }
示例#14
0
 void PrintDebugNumber(unsigned long n, uint8_t base) 
 {
   char buf[8 * sizeof(long) + 1]; 
   char *str = &buf[sizeof(buf) - 1];
 
   *str = '\0';
 
   if (base < 2) 
   {
     base = 10;
   }
 
   do 
   {
     unsigned long m = n;
     n /= base;
     char c = m - base * n;
     *--str = c < 10 ? c + '0' : c + 'A' - 10;
   } 
   while(n);
 
   WriteDebug(str);
 }
示例#15
0
void MainLoop()
{
	DemoData.Type=255;
	MouseString=new char[100];
	memset(MouseString,0,100);
	while (!Done)
	{
		if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg); 
		}
		else if (Keys[VK_ESCAPE]) Done=true;
		else
		{
			PlayBackFunction();
			WriteDebug("Main Loop\n\n");
			CurrentCursor=Arrow;
			glClear(0x4100);
			SwitchTo2D();

			ToolTip=LastClickedToolTip;
			memset(ItemNameString,0,256);
			//glFlush();

			glColor4f(1,1,1,1);
			if (CommandLineCommand) ErrorMessage="";
			if (CommandLineCommand && CommandLineEnter)
			{				
				CommandLineCommand=false;
				CommandLineEnter=false;
				CommandLineReading=false;
				CheckCommand();
				CommandLine="";
			}

			MainGUI.CheckGUI();
			for (int x=0; x<256; x++) Keys[x]=false;
			if (MainGUI.ItemList[3].ButtonPushed && ActualWorld) ActualWorld->CalculateParticles();

			glColor4f(highblue);
			rectangle(-1,35,1025,35);
			glColor4f(1,1,1,1);

			PolyCounter=0;
			VertexCounter=0;
			ObjMemCounter=0;
			CallCounter=0;

			/*if (TextureList)
			{
				for (TEXTURE *t=TextureList; t; t=t->Next)
				{
					ObjMemCounter+=sizeof(TEXTURE);
					ObjMemCounter+=4*t->XRes*t->XRes*8;
				}
			}

			if (Scenes)
			{
				for (SCENE *s=Scenes; s; s=s->Next)
				{
					ObjMemCounter+=s->ObjectCapacity*sizeof(OBJECT);
					for (int x=0; x<s->ObjectNum; x++)
					{
						ObjMemCounter+=s->ObjectList[x].VertexCapacity*sizeof(VERTEX);
						for (int y=0; y<s->ObjectList[x].VertexNum; y++) ObjMemCounter+=s->ObjectList[x].VertexList[y].EdgeCapacity*4;
						ObjMemCounter+=s->ObjectList[x].PolygonCapacity*sizeof(POLYGON);
						ObjMemCounter+=s->ObjectList[x].EdgeCapacity*sizeof(EDGE);
					}
				}
			}

			if (Worlds)
			{
				for (WORLD *w=Worlds;w;w=w->Next)
				{
					ObjMemCounter+=w->ObjectCapacity*sizeof(WORLDOBJECT);
					for (int x=0; x<w->ObjectNum; x++)
					if (w->ObjectList[x].EmitterData)
						{
							ObjMemCounter+=sizeof(EMITTERDATA);
							if (w->ObjectList[x].EmitterData->Particles) ObjMemCounter+=(sizeof(PARTICLE))*w->ObjectList[x].EmitterData->MaxParticles;
							if (w->ObjectList[x].EmitterData->Particles && w->ObjectList[x].EmitterData->Tail) ObjMemCounter+=256*sizeof(VECTOR3)*w->ObjectList[x].EmitterData->MaxParticles;
						}
				}
			}*/

			MainGUI.DrawGUI();

			glErrorCheck();
			
			if (!MainGUI.ItemList[3].ActiveBranch && !MainGUI.ItemList[0].ActiveBranch)
			{
				for (WORLD *a=Worlds;a;a=a->Next)
					for (int x=0; x<a->ObjectNum; x++)
						if (a->ObjectList[x].Primitive==aDDict_SPHEREEMITTER ||
							a->ObjectList[x].Primitive==aDDict_CUBEEMITTER ||
							a->ObjectList[x].Primitive==aDDict_CYLINDEREMITTER)
						a->ObjectList[x].EmitterData->LastFrameChecked=timeGetTime();
			}

			glDisable(GL_DEPTH_TEST);
			if (strcmp(ErrorMessage,"") && !ReadLine) glColor4f(1,1,0.3f,1);
			glRasterPos2i(410,21);
			if (!CommandLineReading && !ReadLine)
			{
				if (!strcmp(ErrorMessage,""))
				glPrint(ToolTip,base);
				else
				glPrint(ErrorMessage,base);
			}
			else
			{
				char *Buffer=new char [strlen(CommandLine)+100];
				sprintf(Buffer,"%s_",CommandLine);
				glPrint(Buffer,base);
				delete Buffer;
			}

			if (strlen(MouseString) /*&& !strcmp(MouseString,"")*/)
			{
				glColor4f(0,0,0,1);
				glRasterPos2i(mx+16,my+12);
				glPrint(MouseString,base);
				glColor4f(1,1,1,1);
				glRasterPos2i(mx+15,my+11);
				glPrint(MouseString,base);
			}
			memset(MouseString,0,100);

			glColor4f(0,0,0,1);
			glRasterPos2i(mx+16,my);
			glPrint(ItemNameString,base);
			glColor4f(1,1,1,1);
			glRasterPos2i(mx+15,my-1);
			glPrint(ItemNameString,base);

			glEnable(GL_DEPTH_TEST);

			glColor4f(1,1,1,1);

			SetCursor(CurrentCursor);
			SwapBuffers(hDC);
			if (WaitLeftButton) { WaitLeftButtonRelease(); WaitLeftButton=false; }
			if (WaitMiddleButton) { WaitMiddleButtonRelease(); WaitMiddleButton=false; }
			if (WaitRightButton) { WaitRightButtonRelease(); WaitRightButton=false; }

			if (CommandLineEnter) { CommandLine=""; CommandLineEnter=false; ReadLine=false;}
			if (LeftButton || RightButton || MiddleButton) SetCapture(hWnd); else ReleaseCapture();
			lastwheel=Wheel;
			Wheel=0;

			Sleep(10);
		}

	}
}
示例#16
0
//
// 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 + 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] = realpatch->columnofs[x-x1]+3;
	}
    }
	
    for (x=0 ; x<texture->width ; x++)
    {
	if (!patchcount[x])
	{
	    sprintf (MsgText,"R_GenerateLookup: column without a patch (%s)\n",
		    texture->name);
        WriteDebug(MsgText);
	    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;
	}
    }	
}
示例#17
0
//
// R_InitTextures
// Initializes the texture list
//  with the textures from the world map.
//
void R_InitTextures (void)
{
    maptexture_t*	mtexture;
    texture_t*		texture;
    mappatch_t*		mpatch;
    texpatch_t*		patch;

    int			i;
    int			j;

    int*		maptex;
    int*		maptex2;
    int*		maptex1;
    
    char		name[9];
    char*		names;
    char*		name_p;
    
    int*		patchlookup;
    
    int			totalwidth;
    int			nummappatches;
    int			offset;
    int			maxoff;
    int			maxoff2;
    int			numtextures1;
    int			numtextures2;

    int*		directory;
    
    int			temp1;
    int			temp2;
    int			temp3;

    
    // Load the patch names from pnames.lmp.
    name[8] = 0;	
    names = W_CacheLumpName ("PNAMES", PU_STATIC);
    nummappatches = *((int *)names);
    name_p = names+4;
    patchlookup = alloca (nummappatches*sizeof(*patchlookup));
    
    for (i=0 ; i<nummappatches ; i++)
    {
	strncpy (name,name_p+i*8, 8);
	patchlookup[i] = W_CheckNumForName (name);
    }
    Z_Free (names);
    
    // Load the map texture definitions from textures.lmp.
    // The data is contained in one or two lumps,
    //  TEXTURE1 for shareware, plus TEXTURE2 for commercial.
    maptex = maptex1 = W_CacheLumpName ("TEXTURE1", PU_STATIC);
    numtextures1 = *maptex;
    maxoff = W_LumpLength (W_GetNumForName ("TEXTURE1"));
    directory = maptex+1;
	
    if (W_CheckNumForName ("TEXTURE2") != -1)
    {
	maptex2 = W_CacheLumpName ("TEXTURE2", PU_STATIC);
	numtextures2 = *maptex2;
	maxoff2 = W_LumpLength (W_GetNumForName ("TEXTURE2"));
    }
    else
    {
	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);
    sprintf(MsgText,"[");
    WriteDebug(MsgText);
    for (i = 0; i < temp3; i++)
	sprintf(MsgText," ");
    WriteDebug(MsgText);
    sprintf(MsgText,"         ]");
    WriteDebug(MsgText);
    for (i = 0; i < temp3; i++)
	sprintf(MsgText,"\x8");
    WriteDebug(MsgText);
    sprintf(MsgText,"\x8\x8\x8\x8\x8\x8\x8\x8\x8\x8");	
    WriteDebug(MsgText);
	
    for (i=0 ; i<numtextures ; i++, directory++)
    {
	if (!(i&63))
       {
	    sprintf (MsgText,".");
        WriteDebug(MsgText);
       }

	if (i == numtextures1)
	{
	    // Start looking in second texture file.
	    maptex = maptex2;
	    maxoff = maxoff2;
	    directory = maptex+1;
	}
		
	offset = *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)*(mtexture->patchcount-1),
		      PU_STATIC, 0);
	
	texture->width = mtexture->width;
	texture->height = mtexture->height;
	texture->patchcount = 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 = mpatch->originx;
	    patch->originy = mpatch->originy;
	    patch->patch = patchlookup[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;
}
LRESULT CALLBACK WndProc(	HWND	hWnd,
							UINT	uMsg,
							WPARAM	wParam,
							LPARAM	lParam)
{
	switch (uMsg)						
	{
		case WM_ACTIVATE:				
		{
			Active=(!HIWORD(wParam));
			return 0;					
		}

		case WM_SYSCOMMAND:				
		{
			switch (wParam)				
			{
				case SC_SCREENSAVE:		
				case SC_MONITORPOWER:	
				return 0;				
			}
			break;						
		}

		case WM_CLOSE:					
		{
			Done = true;

			return 0;					
		}

		case WM_KEYDOWN:				
		{
			if (!CommandLineReading)
			{
				Keys[wParam] = true;

				if (wParam==VK_ESCAPE) 
				{
					char *ExitStr=new char[256];
					
					srand(timeGetTime());
					int r=(int)((rand()/(float)RAND_MAX)*6.0f);
					switch (r)
					{
					case 0: sprintf(ExitStr,"Kill 2 hours of unsaved work?\0"); break;
					case 1: sprintf(ExitStr,"Are you a true addict?\0"); break;
					case 2: sprintf(ExitStr,"Come baaaaack!\0"); break;
					case 3: sprintf(ExitStr,"Beware the dealine is getting closer by the minute!\0"); break;
					case 4: sprintf(ExitStr,"You sure you pressed the right button?\0"); break;
					case 5: sprintf(ExitStr,"Are you sure you finished the release?\0"); break;
					}

					Keys[wParam]=!(MessageBox(NULL,ExitStr, "Wanna Quit?",MB_OKCANCEL|MB_ICONEXCLAMATION)==IDCANCEL);
					delete ExitStr;
				}
			}
			else
			{

			}

			return 0;					
		}

		case WM_KEYUP:					
		{
			Keys[wParam] = false;
			return 0;
		}

		case WM_MOUSEMOVE:
		{
			POINT ap;
			GetCursorPos(&ap);
			ScreenToClient(hWnd,&ap);
			mx=ap.x;
			my=ap.y;
			return 0;
		}
        case WM_LBUTTONDOWN:
        {
			WriteDebug("Left mouse click\n");
            LeftButton=true;
			POINT ap;
			GetCursorPos(&ap);
			LeftShift=(wParam & MK_SHIFT)==0;
			LeftCtrl=(wParam & MK_CONTROL)==0;
			ScreenToClient(hWnd,&ap);
            lx=ap.x;
            ly=ap.y;
			DemoSaveEvent(DEMOSAVE_LeftButton,lx,ly,1,LeftShift,LeftCtrl);
			return 0;
        }
        
		case WM_LBUTTONUP:
        {
			DemoSaveEvent(DEMOSAVE_LeftButton,mx,my,0,LeftShift,LeftCtrl);
			WriteDebug("Left mouse release\n");
            LeftButton=false;
            LeftButtonReleased=true;
			return 0;
        }
        
		case WM_RBUTTONDOWN:
        {
            RightButton=true;
			TransformingWhenRightClicked=Transforming;
			CammovingWhenRightClicked=Cammoving;
			POINT ap;
			GetCursorPos(&ap);
			RightShift=(wParam & MK_SHIFT)==0;
			RightCtrl=(wParam & MK_CONTROL)==0;
			ScreenToClient(hWnd,&ap);
            rx=ap.x;
            ry=ap.y;
			DemoSaveEvent(DEMOSAVE_RightButton,rx,ry,1,RightShift,RightCtrl);
			return 0;
        }
        
		case WM_RBUTTONUP:
        {
			DemoSaveEvent(DEMOSAVE_RightButton,mx,my,0,RightShift,RightCtrl);
            RightButton=false;
            RightButtonReleased=true;
			TransformingWhenRightClicked=false;
			CammovingWhenRightClicked=false;
			return 0;
        }
        
		case WM_MBUTTONDOWN:
        {
            MiddleButton=true;
			TransformingWhenMidClicked=Transforming;
			POINT ap;
			GetCursorPos(&ap);
			MidShift=(wParam & MK_SHIFT)==0;
			MidCtrl=(wParam & MK_CONTROL)==0;
			ScreenToClient(hWnd,&ap);
            mbx=ap.x;
            mby=ap.y;
			DemoSaveEvent(DEMOSAVE_MiddleButton,mbx,mby,1,MidShift,MidCtrl);
			//DemoPlayback=false;
			return 0;
        }
        
		case WM_MBUTTONUP:
        {
			DemoSaveEvent(DEMOSAVE_MiddleButton,mx,my,0,MidShift,MidCtrl);
            MiddleButton=false;
            MiddleButtonReleased=true;
			TransformingWhenMidClicked=false;
			return 0;	
        }

        case 0x020A:
        {
            //fwKeys = GET_KEYSTATE_WPARAM(wParam);
            //wheel  = GET_WHEEL_DELTA_WPARAM(wParam);
			Wheel  = (int)((int)(wParam) / 7854320);
			DemoSaveEvent(DEMOSAVE_Wheel,mx,my,wParam,MidShift,MidCtrl);
			return 0;
        }

		case WM_CHAR: 
		{
			/*key = new tkey;
			key->next=keyboardbuffer;
			key->key=wParam;
			keyboardbuffer=key;*/
			DemoSaveEvent(DEMOSAVE_Key,0,0,wParam,0,0);
			
			if (CommandLineReading)
			{
				switch (wParam)
				{
				case VK_BACK:
					{
						if (strcmp(CommandLine,""))
						CommandLine[strlen(CommandLine)-1]=0;
						break;
					}

				case VK_RETURN:
					{
						CommandLineEnter=true;
						CommandLineReading=false;
						break;
					}
				case VK_ESCAPE:
					{
						if (strlen(CommandLine))
						memset(CommandLine,0,strlen(CommandLine));
						else
						{
							CommandLineEnter=true;
							CommandLineReading=false;
						}
						break;
					}

				default:
					{
						char *Buffer=new char[strlen(CommandLine)+100];
						memset(Buffer,0,strlen(CommandLine)+1);
						sprintf(Buffer,"%s%c\0",CommandLine,wParam);
						delete CommandLine;
						CommandLine=Buffer;
						break;
					}

				}
			}
			else
			{
				if (wParam==VK_RETURN) 
				{
					CommandLineReading=true;
					CommandLineCommand=true;
					CommandLine=new char[10];
					memset(CommandLine,0,10);
				}
				else
					Keys[wParam]=true;
			}
			return 0;
		}
	
	}
	return DefWindowProc(hWnd,uMsg,wParam,lParam);
}
示例#19
0
 void WriteDebug(const char *buffer, size_t size) 
 {
   WriteDebug((const uint8_t *)buffer, size);
 }
示例#20
0
 inline void WriteDebug(int n) 
 { 
   WriteDebug((uint8_t)n); 
 }
示例#21
0
 inline void WriteDebug(unsigned int n) 
 { 
   WriteDebug((uint8_t)n); 
 }
示例#22
0
 inline void WriteDebug(long n) 
 { 
   WriteDebug((uint8_t)n); 
 }
示例#23
0
 void PrintDebug(const char str[])
 {
   WriteDebug(str);
 }
示例#24
0
 void PrintDebug(char c)
 {
   WriteDebug(c);
 }