예제 #1
0
파일: menu.c 프로젝트: Kweepa/vicdoom
void __fastcall__ drawMenu(char canReturn)
{
  char i;
  for (i = 0; i < 198; ++i)
  {
    POKE(0x1000 + 242 + i, 32);
    POKE(0x9400 + 242 + i, 7);
  }

  if (!canReturn)
  {
    textcolor(TEXT_COLOR);
    cputsxy(3, 21, "down");
    cputsxy(15, 21, "select");
    textcolor(HILITE_COLOR);
    cputsxy(1, 21, "s");
    cputsxy(8, 21, "return");
  }

  menuSize = 4;
  if (stackDepth == 0 && !canReturn)
  {
    menuSize = 3;
  }
	 
  // draw the menu
  for (i = 0; i < menuSize; ++i)
  {
    drawMenuItem(i);
  }
  textcolor(HILITE_COLOR);
}
예제 #2
0
파일: conio.c 프로젝트: Arkuda/rpc8e-cc65
/* Set the cursor to the specified position */
void __fastcall__ gotoxy( unsigned char x, unsigned char y ) //
{
	// FIXME: Call MMU to the make sure screen is the enabled device......
	POKE( 0x300, y );	// also set row
	POKE( 0x301, x );
	POKE( 0x302, y );
}
예제 #3
0
파일: m3u.c 프로젝트: shanewfx/vlc-arib
/*****************************************************************************
 * Import_M3U: main import function
 *****************************************************************************/
int Import_M3U( vlc_object_t *p_this )
{
    demux_t *p_demux = (demux_t *)p_this;
    const uint8_t *p_peek;
    CHECK_PEEK( p_peek, 8 );
    char *(*pf_dup) (const char *);

    if( POKE( p_peek, "RTSPtext", 8 ) /* QuickTime */
     || demux_IsPathExtension( p_demux, ".m3u8" )
     || demux_IsForced( p_demux, "m3u8" ) )
        pf_dup = strdup; /* UTF-8 */
    else
    if( POKE( p_peek, "#EXTM3U", 7 )
     || demux_IsPathExtension( p_demux, ".m3u" )
     || demux_IsPathExtension( p_demux, ".vlc" )
     || demux_IsForced( p_demux, "m3u" )
     || ContainsURL( p_demux ) )
        pf_dup = FromLocaleDup; /* locale character set (?) */
    else
        return VLC_EGENERIC;

    STANDARD_DEMUX_INIT_MSG( "found valid M3U playlist" );
    p_demux->p_sys->psz_prefix = FindPrefix( p_demux );
    p_demux->p_sys->pf_dup = pf_dup;

    return VLC_SUCCESS;
}
예제 #4
0
파일: summary.c 프로젝트: Kweepa/vicdoom
void __fastcall__ summaryScreen(void)
{
  // display kills, items, secrets, time
  // like this
  // MAP NAME
  // FINISHED
  // KILLS %
  // ITEMS %
  // SECRET %
  // TIME 00:00
  // PAR 00:00
  
  char kills = p_enemy_getKillPercentage();
  char items = getItemPercentage();
  char secret = (100*getNumVisitedSecrets())/getNumSecrets();
  int time = getMapTime();
  int par = getParTime();

  // clear screen
  clearScreen();
  
  textcolor(1);
  printCentered(caLevelNames[level-1], 1);
  textcolor(2);
  printCentered("finished", 2);
  cputsxy(4, 5, "kills");
  cputsxy(4, 7, "items");
  cputsxy(4, 9, "secret");
  cputsxy(4, 12, "time");
  cputsxy(4, 14, "par");

  setTextColor(2);
  POKE(198, 0);
  rollInPercentage(kills, 0x1000+22*5+14);
  waitASecond();
  rollInPercentage(items, 0x1000+22*7+14);
  waitASecond();
  rollInPercentage(secret, 0x1000+22*9+14);
  waitASecond();
  if (time > 10*60-1)
  {
    cputsxy(13,12,"sucks");
    playSound(SOUND_PISTOL);
  }
  else
  {
    rollInTime(time, 0x1000+22*12+13);
  }
  waitASecond();
  rollInTime(par, 0x1000+22*14+13);
  waitASecond();
  printCentered("press a key", 20);
  POKE(198, 0);
  while (PEEK(198) == 0) ;

  // clear screen
  clearScreen();
}
예제 #5
0
파일: conio.c 프로젝트: Arkuda/rpc8e-cc65
/* If onoff is 1, a cursor is displayed when waiting for keyboard input. If
 * onoff is 0, the cursor is hidden when waiting for keyboard input. The
 * function returns the old cursor setting.
 */
unsigned char __fastcall__ cursor( unsigned char onoff )
{
	// FIXME: Call MMU to the make sure screen is the enabled device......
	unsigned char oldStatus = PEEK( 0x303 );
	if( onoff )
		POKE( 0x303, 2 );
	else
		POKE( 0x303, 0 );
	return oldStatus;
}
예제 #6
0
int main(void)
{
    engine_sel = ENGINE_SEL_WRAP_OPT;
    engine_state = ENGINE_RUN;

    show_hotkeys();

#ifdef MIXED_MODE
    // our program just uses the bottom 4 lines of the display
    gotoxy(0,MAXROWPAIRCNT);
    POKE(TEXTWINDOW_TOP_EDGE,MAXROWPAIRCNT);
    gr_mode(SS_PAGE2OFF, SS_MIXEDON);
#else
    gr_mode(SS_PAGE2OFF, SS_MIXEDOFF);
#endif
    glider(gr_page[0]);

    while (engine_state == ENGINE_RUN) {
        switch (engine_sel) {
            case ENGINE_SEL_WRAP_NAIVE:
                naive_wrap_engine();
                break;
            case ENGINE_SEL_NOWRAP_NAIVE:
                naive_nowrap_engine();
                break;
            case ENGINE_SEL_WRAP_OPT:
                opt_wrap_engine();
                break;
            case ENGINE_SEL_NOWRAP_OPT:
                opt_nowrap_engine();
                break;
            default:
#ifdef MIXED_MODE
                printf("bogus engine selection!\n");
#endif
                engine_state = ENGINE_STOP;
                break;
        }
    }
    
    // all done
    POKE(TEXTWINDOW_TOP_EDGE,0);
    softsw(SS_TEXTON);
    
    return EXIT_SUCCESS;
}
예제 #7
0
파일: pls.c 프로젝트: FLYKingdom/vlc-1
/*****************************************************************************
 * Import_PLS: main import function
 *****************************************************************************/
int Import_PLS( vlc_object_t *p_this )
{
    demux_t *p_demux = (demux_t *)p_this;
    const uint8_t *p_peek;
    CHECK_PEEK( p_peek, 10 );

    if( POKE( p_peek, "[playlist]", 10 ) || POKE( p_peek, "[Reference]", 10 ) ||
        demux_IsPathExtension( p_demux, ".pls" )   || demux_IsForced( p_demux, "pls" ) )
    {
        ;
    }
    else return VLC_EGENERIC;

    STANDARD_DEMUX_INIT_MSG(  "found valid PLS playlist file");
    p_demux->p_sys->psz_prefix = FindPrefix( p_demux );

    return VLC_SUCCESS;
}
예제 #8
0
파일: pls.c 프로젝트: BossKing/vlc
/*****************************************************************************
 * Import_PLS: main import function
 *****************************************************************************/
int Import_PLS( vlc_object_t *p_this )
{
    demux_t *p_demux = (demux_t *)p_this;
    const uint8_t *p_peek;
    CHECK_FILE();
    CHECK_PEEK( p_peek, 10 );

    if( POKE( p_peek, "[playlist]", 10 ) || POKE( p_peek, "[Reference]", 10 ) ||
        demux_IsPathExtension( p_demux, ".pls" )   || demux_IsForced( p_demux, "pls" ) )
    {
        ;
    }
    else return VLC_EGENERIC;

    msg_Dbg( p_demux, "found valid PLS playlist file");
    p_demux->pf_demux = Demux;
    p_demux->pf_control = Control;

    return VLC_SUCCESS;
}
예제 #9
0
파일: summary.c 프로젝트: Kweepa/vicdoom
void __fastcall__ rollInPercentage(char pc, int scr)
{
  signed char i = -4;
  POKE(scr + 3,'%');
  do
  {
    i += 4;
    if (i > pc) i = pc;
    print3DigitNumToScreen(i, scr);
    playSound(SOUND_PISTOL);
    if (PEEK(198) == 0)
    {
		  waitForRaster(2);
    }
  }
  while (i < pc);
}
예제 #10
0
파일: conio.c 프로젝트: Arkuda/rpc8e-cc65
/* Return a character from the keyboard. If there is no character available,
 * the function waits until the user does press a key. If cursor is set to
 * 1 (see below), a blinking cursor is displayed while waiting.
 */
char cgetc( void )
{
        unsigned char key;
	unsigned char pos;

	while (!kbhit())
	{
		// WAI
	}

	key = PEEK(0x306);
	pos = PEEK(0x304)+1;
	if (pos > 0x10)
		pos = 0;
	POKE(0x304,pos);
	
	return key;
}
예제 #11
0
파일: conio.c 프로젝트: Arkuda/rpc8e-cc65
void blit_fill(unsigned char x, unsigned char y, unsigned char width, unsigned char height, unsigned char fillchar)
{
	// FIXME: Call MMU to the make sure screen is the enabled device......
	
	POKE( 0x308, fillchar);
	POKE( 0x30a, x);
	POKE( 0x30b, y);
	
	POKE( 0x30c, width );
	POKE( 0x30d, height );
	
	POKE( 0x307, 1);			// blitter FILL command
	while ( PEEK( 0x307 ) == 1)
	{
		// WAI
	}

	// reset blit size to 0
	
	POKE( 0x300, 0 ); // set row to 0
	POKE( 0x301, 0 );
	POKE( 0x302, 0 );
	
}
예제 #12
0
파일: conio.c 프로젝트: Arkuda/rpc8e-cc65
/* Output one character at the current cursor position */
void __fastcall__ cputc( char c )
{
	unsigned char x;
	unsigned char y;
	unsigned char i;
	
	// FIXME: Call MMU to the make sure screen is the enabled device......
	
	// Set or unset reverse video bit, if needed.
	if( __conio_reverseVideo )
		c += 128;
	
	// Read the current cursor position.
	x = PEEK( 0x301 );
	y = PEEK( 0x302 );
	
	// Set the display memory window to the line the cursor is on.
	POKE( 0x300, y );

	// Write the character the the column the cursor is in, within the display
	//	memory window.
	if ( c != '\n')
		POKE( 0x310+x, c );
	
	// Advance the cursor, moving to the next line and scrolling the screen
	//	if needed.
	++x;
	if( x > 79 || c == '\n' )
	{
		x = 0;
		if( y >= 49 )
		{
			// Scroll...
			blit_shift(0,1,0,0,80,49);

			for (i = 0; i<80; i++)
				POKE( 0x310 + i, 0x20 );
				
		}
		else
		{	// no need to set if Y was 49. 
			++y;
			POKE( 0x302, y );
			POKE( 0x300, y );	// set row too
		}
	}
	
	// Set the cursor to the new position.
	POKE( 0x301, x );
}
예제 #13
0
파일: summary.c 프로젝트: Kweepa/vicdoom
void __fastcall__ rollInTime(int t, int scr)
{
  int i = -5;
  char ih, il;
  POKE(scr + 2,':');
  do
  {
    i += 5;
    if (i > t) i = t;
    ih = i / 60;
    il = i - 60 * ih;
    print2DigitNumToScreen(ih, scr);
    print2DigitNumToScreen(il, scr + 3);
    playSound(SOUND_PISTOL);
    if (PEEK(198) == 0)
    {
		  waitForRaster(2);
    }
  }
  while (i < t);
}
예제 #14
0
파일: conio.c 프로젝트: Arkuda/rpc8e-cc65
void blit_shift(unsigned char sx, unsigned char sy, unsigned char dx, unsigned char dy, unsigned char width, unsigned char height)
{
	// FIXME: Call MMU to the make sure screen is the enabled device......

	POKE( 0x30a, dx);
	POKE( 0x30b, dy);
	
	POKE( 0x308, sx );
	POKE( 0x309, sy );

	POKE( 0x30c, width );
	POKE( 0x30d, height );

	POKE( 0x307, 3 );		// blitter SHIFT command
	while ( PEEK( 0x307 ) == 3 )
	{
		// WAI
	}
	
}
예제 #15
0
파일: conio.c 프로젝트: Arkuda/rpc8e-cc65
/* Set the cursor to the specified X position, leave the Y position untouched */
void __fastcall__ gotox( unsigned char x ) // __fastcall__
{
	// FIXME: Call MMU to the make sure screen is the enabled device......
	POKE( 0x301, x );
}
예제 #16
0
파일: a2graph.c 프로젝트: pedgarcia/a2graph
void gr_setmode(unsigned int CRTMODE)
{
    /* note: the following constants must be hex values
     or cc65 complains that the constant is a long */
    switch(CRTMODE)
    {
        case MODE_TEXT_PAGE_1:
            POKE(0xc051,0);  /* text */
            POKE(0xc054,0);  /* page 1 */
            break;
        case MODE_TEXT_PAGE_2:
            POKE(0xc051,0);  /* text */
            POKE(0xc055,0);  /* page 2 */
            break;
        case MODE_LORES_TEXT_PAGE_1:
            POKE(0xc056,0);   /* lo res */
            POKE(0xc054,0);   /* page 1 */
            POKE(0xc050,0);   /* set graphics */
            break;
        case MODE_LORES_FULL_PAGE_1:
            POKE(0xc056,0);   /* lo res */
            POKE(0xc054,0);   /* page 1 */
            POKE(0xc050,0);   /* set graphics */
            POKE(0xc052,0);   /* full graphics */
            break;
        case MODE_LORES_FULL_PAGE_2:
            POKE(0xc056,0);   /* lo res */
            POKE(0xc055,0);   /* page 2 */
            POKE(0xc050,0);   /* set graphics */
            POKE(0xc052,0);   /* full graphics */
            break;
        case MODE_HIRES_FULL_PAGE_2:
            POKE(0xc057,0);   /* hi res */
            POKE(0xc055,0);   /* page 2 */
            POKE(0xc050,0);   /* set graphics */
            POKE(0xc052,0);   /* full graphics */
            break;
        case MODE_HIRES_FULL_PAGE_1:
        default:
            POKE(0xc057,0);   /* hi res */
            POKE(0xc054,0);   /* page 1 */
            POKE(0xc050,0);   /* set graphics */
            POKE(0xc052,0);   /* full graphics */
    }
}
예제 #17
0
파일: vdc_win.c 프로젝트: xlar54/vdc_gui
void ActivateWindow(WINDOW *window)
{
	WINCTRL *ctrl = window->control;  // control that has current focus
	int key=0;
	
	VDC_SetCursorMode(VDC_CURSORMODE_NONE);

	for(;;)
	{
		while(ctrl->InputHandler == NULL)
		{
			ctrl = ctrl->nextControl;
			
			//No controls to recieve focus. Quit program
			if (ctrl == NULL)
				ctrl = window->control;
		}

		//Clear keyboard buffer
		POKE(208,0);

		//Set the focus
		ctrl->hasFocus = TRUE;
		ctrl->RenderHandler(ctrl);

		// Wait for input
		for(;;)
		{
			//If CONTROL key is pressed, if(PEEK(211) == 4)
			
			key = kbhit();
		
			if(key != 0)
			{
				key = cgetc();
		
			//Has a keypress occurred?
			//if(PEEK(208) > 0)
			//{
			//	key = PEEK(842);

				//if F1 key, move to next control
				if(key == 133)
				{
					POKE(208,0);

					//Clear the focus
					ctrl->hasFocus = FALSE;
					ctrl->RenderHandler(ctrl);

					// if at end of control list, start back at top
					if((ctrl = ctrl->nextControl) == NULL)
						ctrl = window->control;
					break;
				}
				if(key == 134)
				{
					POKE(208,0);

					//Clear the focus
					ctrl->hasFocus = FALSE;
					ctrl->RenderHandler(ctrl);

					// if top of control list, go to last
					if(ctrl == window->control)
					{
						while(ctrl->nextControl != NULL) {
							ctrl = ctrl->nextControl;
						};
					}
					else
					{
						ctrl = ctrl->prevControl;
					}
					break;
				}

				ctrl->InputHandler(ctrl,key);

				POKE(208,0);
			}

		}

	}
}
예제 #18
0
/*
 * returning 1 will cause the currently running engine to exit
 */
uint8_t process_keys(void) 
{
    uint8_t c;

    if (kbhit() > 0) {
        c=cgetc();
        CLEARKEYBUF;
        if (c == 'p') {
#ifdef MIXED_MODE
            printf("PAUSED. Press p to Continue.\n");
#endif
            wait_for_keypress('p');
        }
        else if (c == '1') {
            engine_sel = ENGINE_SEL_WRAP_NAIVE;
            engine_state = ENGINE_RUN;
#ifdef MIXED_MODE
            printf("Naive wrap mode enabled.\n");
#endif
            return 1;
        }
        else if (c == '2') {
            engine_sel = ENGINE_SEL_NOWRAP_NAIVE;
            engine_state = ENGINE_RUN;
#ifdef MIXED_MODE
            printf("Naive nowrap mode enabled.\n");
#endif
            return 1;
        }
        else if (c == '3') {
            engine_sel = ENGINE_SEL_WRAP_OPT;
            engine_state = ENGINE_RUN;
#ifdef MIXED_MODE
            printf("Optimized wrap mode enabled.\n");
#endif
            return 1;
        }
        else if (c == '4') {
            engine_sel = ENGINE_SEL_NOWRAP_OPT;
            engine_state = ENGINE_RUN;
#ifdef MIXED_MODE
            printf("Optimized nowrap mode enabled.\n");
#endif
            return 1;
        }
        else if (tolower(c) == 'q') {
            engine_state = ENGINE_STOP;
            return 1;
        }
        else if (c == '?') {
            memcpy((uint8_t *)0x5000,0x400,0x800);
            text_mode();
            printf("\n\n\n\n\n\n\n");
            show_hotkeys();
#ifdef MIXED_MODE
            gotoxy(0,MAXROWPAIRCNT);
            POKE(TEXTWINDOW_TOP_EDGE,MAXROWPAIRCNT);
            gr_mode(SS_PAGE2OFF, SS_MIXEDON);
#else
            gr_mode(SS_PAGE2OFF, SS_MIXEDOFF);
#endif
            memcpy((uint8_t *)0x400,0x5000,0x800);
        }
        else if (tolower(c) == 'r')
            randomize(gr_page[find_page()], 400);
        else if (tolower(c) == 'g')
            gospergun(gr_page[find_page()]);
        else if (tolower(c) == 's')
            simkins(gr_page[find_page()]);
    }
    return 0;
}