Beispiel #1
0
Input::Input()
{
	InitMapping();
	InitHoldings();

	ResetKeys();
	ResetMouseButtons();
}
Beispiel #2
0
int BruteForce(int M, int *K, int *Tennis, int T, int *Array, int N)
{

   int i=0, j=0, a=0, index=0, temp_min =0, min=N;
   int *new_keys = malloc(sizeof(int) * M);

   ResetKeys(new_keys, M);

   for(i=0; i < M; i++)
   {
      if( !(i==0) && !(i==(M-1)) )
      {
	 ResetKeys(new_keys, M);
	 index = SpecialCase(new_keys, K, i, min, M);
	 if ( min > (temp_min=FindMin(new_keys,index, i, Array, N, Tennis, T)) )
	    min = temp_min;
      }
      //printf("Seed: %d \n", i);
      for(j=0; j < (M-i); j++)
      {
	 index =0;
	 ResetKeys(new_keys, M);
	 for(a=i; a<(M-j); a++)
	 {
	    new_keys[index] = K[a];
	    index++;
	    printf("%d ", new_keys[index-1]);
	 }
	 printf("\n");
	 if ( min > (temp_min=FindMin(new_keys,index, i, Array, N, Tennis, T)) )
	    min = temp_min;

	 index = 0;
      }
   }
   return min;
}
//----- (00459C8D) --------------------------------------------------------
KeyboardActionMapping::KeyboardActionMapping()
{
  uLastKeyPressed = 0;
  field_204 = 0;
  pWindow = nullptr;

  SetDefaultMapping();
  ReadMappings();

  ResetKeys();

  uNumKeysPressed = 0;

  uGameMenuUI_CurentlySelectedKeyIdx = -1;
}
Beispiel #4
0
void CCar::detach_Actor()
{
	if(!Owner()) return;
	Owner()->setVisible(1);
	CHolderCustom::detach_Actor();
	PPhysicsShell()->remove_ObjectContactCallback(ActorObstacleCallback);
	NeutralDrive();
	Unclutch();
	ResetKeys();
	m_current_rpm=m_min_rpm;
//	CurrentGameUI()->UIMainIngameWnd->CarPanel().Show(false);
	///Break();
	//H_SetParent(NULL);
	HandBreak();
	processing_deactivate();
#ifdef DEBUG
	DBgClearPlots();
#endif
}
Beispiel #5
0
void ContextHelp(short spritenum)
{
    int i,fp;
    char t,*tc;
    char x=0,y=4;
    char *name,*hightag;
    char *filebuffer;
    SPRITEp sp;
    short hitag=0;
    long size=0,tokresult=0;

    
    sp = &sprite[spritenum];

    clearmidstatbar16();

    if((fp=kopen4load("swbhelp.hlp",0)) == -1)
    {
        Msg("ERROR: Help file not found.",M_RED);
        return;
    }

    // Read in whole file
    size = kfilelength(fp);    
    filebuffer = (char *)malloc(size);
    if (filebuffer == NULL)
    {
        Msg("Not enough memory to load swhelp.hlp",M_RED);
        return;
    }

    if (kread(fp, filebuffer, size) != size)
    {
        Msg("Unexpected end of file while reading swhelp.hlp",M_RED);
        kclose(fp);
        return;
    }

    // close the file
    kclose(fp);

    // Conver filebuffer to all upper case
    //strupr(filebuffer);

    // Assign a token name to search for based on the sprite being pointed to.
    name = (char *)malloc(20);
    hightag = (char *)malloc(sizeof(short));

    // Make the token
    strcpy(name,"@TAG");
    // Make sure 500-600 SOBJ bounding tags all say the same thing.
    hitag = sp->hitag;
    if(hitag > 500 && hitag <= 600 ) hitag = 500;
    // Give help summary for unknown sprites.
    if((hitag == 0 || hitag > 1006) && sp->lotag == 0) hitag = 999;

    sprintf(hightag,"%d",hitag);
    //itoa(hitag,hightag,10);
    strcat(name,hightag);

    tc = filebuffer;
    
    if(!(tokresult = GetAToken(name,tc,size)))
    {
        // This message should never happen unless something is real wrong!
        Msg("No help available.",M_RED);
        return;
    }       

    tc += tokresult;

    do {
        tc++;
        t = *tc;
        while(t!='\n' && t!='@' && t!='#' && x<128)
        {
            tempbuf[x]=t;
            tc++;
            t = *tc;
            x++;
            if(x >= 128) break;
        }
        tempbuf[x]=0;
        x=0;
        printext16(x*4,ydim16+(y*6)+2,11,-1,tempbuf,1);
        y++;

        if(y>16)
        {
            y=18;
            printext16(x*4,ydim16+(y*6)+2,11,-1,"Hit any key to continue or Q to quit....",1);
            while (BKeyPressed() == NULL);
            if (keystatus[KEYSC_Q])
            {
                clearmidstatbar16();
                return;
            }
            ResetKeys();
            clearmidstatbar16();

            y=6;
        }

     } while(t!='@' && t!='#');
}