Example #1
0
int v_display_status_line (const char *line)
{
    	draw_status(line);
#ifdef	DBL_DRAW
	sdl_flip();
    	draw_status(line);
#endif
	return 0;
}
Example #2
0
/*----------------------------------------------------------------------------*/
int 
update_check_end () 
{
  int       b_cap, w_cap;
  char     *mes;

  YT_GOBAN *goban = pa->goban;
  GO_WORK  *work  = (GO_WORK*) goban->mywork;
  int old_move = STONE_NEXT(goban->posi->stone);

  work_get_captures (work, TRUE, &b_cap, &w_cap, old_move);

  if  (b_cap==0 && w_cap==0)
    return FALSE;

  // есть захват - конец игре!
  if      (b_cap>0)  {
    rating_plus (); 
    mes = main_youwins;
  }
  else if (w_cap>0)  {
    rating_minus () ;
    mes = main_youlose;
  }
  else YERROR ("update_check_end");

  draw_status (mes);
  pa->game_end = TRUE;

  return TRUE;
}
Example #3
0
static void battery_state_handler(BatteryChargeState state) {
  // Report the current charge percentage
  s_battery = state.charge_percent;
  s_battery_charging = state.is_charging;
  draw_status();
  draw_lastupdate();
}
Example #4
0
// ------------------------------------------------------------------------------------------------
//
//
void CUI_Savescreen::draw(Drawable *S)
{
  if (clear) {

    if (S->lock() == 0) {

      S->fillRect(col(1),row(12),RESOLUTION_X,424,COLORS.Background);
      S->unlock();
      clear=0;
    }
  }

  S->copy(CurrentSkin->bmSave, LOADORSAVE_IMAGE_X, LOADORSAVE_IMAGE_Y);

  if (S->lock() == 0) {

    UI->draw(S);

    if (!is_saving) draw_status(S);

    printtitle(11, "File Save", COLORS. Text, COLORS.Background, S) ;

    need_refresh = 0;
    updated=2;
    S->unlock();
  }
}
Example #5
0
void CUI_Config::draw(Drawable *S) {
    char buf[1024];
    if (S->lock()==0) {
        sprintf(buf,"\n|U|Current Settings in memory:\n");
        if(tb->text != NULL)
        {
            free(tb->text);
            tb->text = NULL;
        }
        sprintf(buf+strlen(buf),"\n|U|    Full Screen |L|[|H|%s|L|]",zt_config_globals.full_screen?"On":"Off");
//        sprintf(buf+strlen(buf),"\n|U|    Fade In/Out |L|[|H|%s|L|]",zt_config_globals.do_fade?"On":"Off");
        sprintf(buf+strlen(buf),"\n|U| Auto-Open MIDI |L|[|H|%s|L|]",zt_config_globals.auto_open_midi?"On":"Off");

        tb->text = _strdup(buf);
        UI->draw(S);
        draw_status(S);
        status(S);
        printtitle(11,"Global Configuration",COLORS.Text,COLORS.Background,S);
        print(row(2),col(14),"   Full Screen",COLORS.Text,S);
        print(row(2),col(16),"    Key Repeat",COLORS.Text,S);
        print(row(2),col(18),"      Key Wait",COLORS.Text,S);
        print(row(2),col(20),"          Skin",COLORS.Text,S);
//        print(row(2),col(26)," .ZT directory",COLORS.Text,S);

        printtitle(32,"Current Global Settings",COLORS.Text,COLORS.Background,S);

        need_refresh = 0; updated=2;
        S->unlock();
    }
}
Example #6
0
void CUI_Sysconfig::draw(Drawable *S) {
    if (S->lock()==0) {
        UI->draw(S);
        draw_status(S);
        status(S);
        printtitle(11,"System Configuration",COLORS.Text,COLORS.Background,S);
        print(row(4),col(14),"     Prebuffer",COLORS.Text,S);
        print(row(4),col(16)," Panic on stop",COLORS.Text,S);
        print(row(4),col(18)," MIDI-IN Slave",COLORS.Text,S);
        print(row(4),col(20),"Auto-open MIDI",COLORS.Text,S);

        print(row(4),col(22),"   Full Screen",COLORS.Text,S);
        //print(row(4),col(24),"  Step Editing",COLORS.Text,S);
        print(row(4),col(24),"    Key Repeat",COLORS.Text,S);
        print(row(4),col(26),"      Key Wait",COLORS.Text,S);
        print(row(4+37+8),col(14),"Skin Selection",COLORS.Text,S);

        print(row(4),col(30),"MIDI Out Device Selection",COLORS.Text,S);
        print(row(4+37),col(30),"MIDI In Device Selection",COLORS.Text,S);

        print(row(5),col(47),"Latency ",COLORS.Text,S);
        print(row(5),col(49),"Reverse Bank Select ",COLORS.Text,S);
        print(row(5),col(51),"Device Alias",COLORS.Text,S);
        
        need_refresh = 0; 
        updated=2;
        S->unlock();
    }
}
Example #7
0
int parse_command(char *string, int length) {
	char *command;
	char *origstring = string;
	int parsed=0;

#ifdef DEBUG
	fprintf (logfile, "%s\n", string);
	fflush (logfile);
#endif

	parsed = strlen(string)+1;
	
	if (strcmp(string,"QUIT")==0) {
		return 1;
	}	

	command = strtok(string," ");

	if (strcmp(command,"TEXT")==0) {
		char *line = strtok(NULL,"\0");
		int length = strlen(line);		
		while (length>50) {
			draw_text(line,50);
			line+=50;
			length-=50;
		}
		draw_text(line,length);
	} else if (strcmp(command,"STATUS")==0) {
		draw_status(strtok(NULL,"\0"),0);
	} else if (strcmp(command,"SUCCESS")==0) {
		draw_status(strtok(NULL,"\0"),TEXT_FOREGROUND);
	} else if (strcmp(command,"FAILURE")==0) {
		draw_status(strtok(NULL,"\0"),RED);
	} else if (strcmp(command,"PROGRESS")==0) {
		draw_progress(atoi(strtok(NULL,"\0")));
	} else if (strcmp(command,"CLEAR")==0) {
		text_clear();
	} else if (strcmp(command,"TIMEOUT")==0) {
		timeout=(atoi(strtok(NULL,"\0")));
	} else if (strcmp(command,"QUIT")==0) {
		return 1;
	}

	return 0;
}
Example #8
0
File: draw.c Project: sirpengi/rirc
void
redraw(void)
{
	if (draw & D_CHAT)   draw_chat();
	if (draw & D_CHANS)  draw_chans();
	if (draw & D_INPUT)  draw_input();
	if (draw & D_STATUS) draw_status();
	draw = 0;
}
Example #9
0
void CUI_Help::draw(Drawable *S) {
    if (S->lock()==0) {
        UI->draw(S);
        draw_status(S);
        printtitle(11,"Help",COLORS.Text,COLORS.Background,S);
        need_refresh = 0; updated=2;
        ztPlayer->num_orders();
        S->unlock();
    }
}
Example #10
0
File: main.c Project: outsky/tetris
static void draw(void)
{
    center();
    draw_playgrd();
    draw_preview();
    draw_linerecord();
    draw_blockrecord();
    draw_status();
    draw_cur();
    fflush(stdout);
}
void CUI_Midimacroeditor::draw(Drawable *S) {
    if (S->lock()==0) {
        UI->draw(S);
        draw_status(S);
        printtitle(11,"Midimacro Editor",COLORS.Text,COLORS.Background,S);
        print(col(12),row(BASE_Y),"name",COLORS.Text,S);
        need_refresh = 0; updated=2;
        ztPlayer->num_orders();
        S->unlock();
    }
}
Example #12
0
void INFO_PANEL::redraw_status(SDL_Surface* scr) { // XXX: BUGGED
	if(relY+statusY < 0 && relY+statusY+status_surf->h > 0) {
		SDL_Rect clip = gfx.SetClip(relX+statusX, 0-relY+statusY, status_surf->w, relY+statusY+ibg->h); 
		gfx.AddSurface(relX+statusX, 0, bkgImage, scr, &clip);
		SDL_Rect clip2 = gfx.SetClip(statusX, statusY, status_surf->w, status_surf->h);
		gfx.AddSurface(relX+statusX, 0, ibg, scr, &clip);
	} else 
	if(relY+statusY >= 0) {
		SDL_Rect clip = gfx.SetClip(relX+statusX, 0-relY+statusY, status_surf->w, relY+statusY+ibg->h); 
		gfx.AddSurface(relX+statusX, relX+relY, bkgImage, scr, &clip);
		SDL_Rect clip2 = gfx.SetClip(statusX, statusY, status_surf->w, status_surf->h);
		gfx.AddSurface(relX+statusX, relX+relY, ibg, scr, &clip);
	}
	draw_status(scr);
}
Example #13
0
void INFO_PANEL::draw(SDL_Surface* scr, bool upd) {
	if(relY < 0) {
		SDL_Rect clip = gfx.SetClip(0, 0-relY, ibg->w, ibg->h+relY); 
		gfx.AddSurface(relX, 0, ibg, scr, &clip);
	} else {
		gfx.AddSurface(relX, relY, ibg, scr, NULL);
	}
	draw_status(scr, false);
	draw_button(scr, false, false);
	if (upd)
		if(relY < 0)
			gfx.Update(scr, relX, 0, ibg->w, ibg->h+relY);
		else
			gfx.Update(scr, relX, relY, ibg->w, ibg->h);
}
Example #14
0
void
redraw(channel *c)
{
	if (!draw) return;

	if (draw & D_RESIZE) resize();

	if (draw & D_BUFFER) draw_buffer(c);
	if (draw & D_CHANS)  draw_chans(c);
	if (draw & D_INPUT)  draw_input(c);
	if (draw & D_STATUS) draw_status(c);

	draw = 0;

	fflush(stdout);
}
Example #15
0
void
curses_update_status(struct nh_player_info *pi)
{
    if (pi)
        player = *pi;

    if (!game_is_running)
        return; /* called before the game is running */

    draw_status(&player, ui_flags.statusheight >= 3);

    /* prevent the cursor from flickering in the status line */
    wmove(mapwin, player.y, player.x);

    if (statuswin)
        wnoutrefresh(statuswin);
}
Example #16
0
void CUI_Loadscreen::draw(Drawable *S) {
    if (clear) {
        if (S->lock() == 0) {
            S->fillRect(col(1),row(12),CONSOLE_WIDTH,424,COLORS.Background);
            S->unlock();
            clear=0;
        }
    }
    S->copy(CurrentSkin->bmLoad, 275, 267);
    if (S->lock()==0) {
        UI->draw(S); 
        if (!is_loading)
            draw_status(S);
        printtitle(11,"File Load",COLORS.Text,COLORS.Background,S);
        need_refresh = 0; updated=2;
        S->unlock();
    }
}
Example #17
0
void
redraw(channel *c)
{
	if (!draw) return;

	if (draw & D_RESIZE) resize();

	struct state const* st = get_state();

	//TODO: pass st to other draw functions
	if (draw & D_BUFFER) draw_buffer(c);
	if (draw & D_CHANS)  draw_nav(st);
	if (draw & D_INPUT)  draw_input(c);
	if (draw & D_STATUS) draw_status(c);

	draw = 0;

	fflush(stdout);
}
Example #18
0
void reset_terminal(void){
	clear_terminal();
	
	set_display_attribute(BAR_COLOUR);
	draw_horizontal_line(1,1,WIDTH);
	set_display_attribute(BAR_COLOUR);
	draw_vertical_line(40,1,HEIGHT);
	
	move_cursor(TITLE_X,TITLE_Y);
	printf_P(PSTR("FROGGER"));
	
	draw_lives();
	draw_score();
	draw_level();
	draw_time(16);
	display_scores();
	draw_status(0);
	draw_frog();
	
	set_display_attribute(8);
}
Example #19
0
void draw_ui(C64 *TheC64) {
	int i;

	//printf("draw_ui %d/%d/%d\n", status_enabled, options_enabled, keyboard_enabled);
	if(status_enabled) draw_status();
	if(options_enabled) {
		if(!emu_paused) {
			TheC64->Pause();
			emu_paused=1;
		}
		draw_options(TheC64);
		return;
	} else {
		if(emu_paused) {
			TheC64->Resume();
			emu_paused=0;
		}
	}
	if(keyboard_enabled) {
		draw_keyboard(TheC64);
		draw_cursor();
	}
}
Example #20
0
void
status(char *fmt, ...) {
   va_list ap;
   char buf[4096], *p;
   static int c_perm= 0;
   int perm= 0;

   if (fmt[0] == '+') { fmt++; perm= 1; }
   if (!fmt[0] && c_perm && !perm) return;
   c_perm= perm;

   va_start(ap, fmt);
   buf[0]= 128;         // Select white on black
   vsprintf(buf+1, fmt, ap);
   p= strchr(buf, 0);
   *p++= 0x80;          // Restore white on black
   *p++= '\n';          // Blank to end of line
   *p= 0;

   if (status_str) free(status_str);
   status_str= StrDup(buf);
   draw_status();
}
Example #21
0
/*----------------------------------------------------------------------------*/
int 
computer_move (int stone) 
{

  if (pa->game_end) return FALSE;

  GO_GAMER *gamer;
  if (stone == STONE_WHITE) gamer = pa->gamer_w;
  else                      gamer = pa->gamer_b;

  // ход компутера
  if (!gamer_todo_move (gamer, stone)) {
    //?? TRUE !!
    draw_status ("сдались !");
    pa->game_end = TRUE;
    //pa->rating  += pa->rat; 
    rating_plus (); 

    return FALSE;
  }

  return TRUE;
}
// draws the tree in OpenGL trying to spread the nodes over the screen
void Node::draw_subtree(GLfloat parent_x, GLfloat parent_y, int number_children,
                        GLfloat parent_space) {
  GLfloat separation = parent_space / (number_children);

  // std::cout << "depth:   " << depth_ << "    separation:   " << separation
  //           << "    parent space:   " << parent_space
  //           << "    number of children:   " << number_children << std::endl;

  GLfloat x = (GLfloat)(
      parent_x +
      (((GLfloat)children_number_) - ((GLfloat)number_children - 1) / 2) *
          separation);

  GLfloat y = (GLfloat)(parent_y - SPACE_HEIGHT);

  draw_node(x, y, this->get_node_type());
  draw_connector(parent_x, parent_y, x, y);
  draw_status(x, y, node_status_);
  draw_string(x - CURSOR_WIDTH, y + 2.1 * CURSOR_WIDTH,
              get_node_name().c_str());

  if (this->get_node_type() == ACTION)
    draw_string(x - CURSOR_WIDTH, y + 2.2 * NODE_WIDTH,
                get_ros_node_name().c_str());

  if (highlighted_)
    draw_cursor(x, y);

  if (number_children_ > 0) {
    first_child_->draw_subtree(x, y, number_children_, separation);
  }
  if (next_brother_ != NULL) {
    next_brother_->draw_subtree(parent_x, parent_y, number_children,
                                parent_space);
  }
}
Example #23
0
void talk( void )
{
knocked:

    if (&caveguy == 2)
    {
        int &me;
        &me = &current_sprite;
        script_attach(1000);
        freeze(1);
        wait(500);
        playsound(45, 12000, 0,0,0);
        wait(500);
        say_stop("Hello, anyone in there?", 1);
        wait(500);
        say_stop("Hello?!?", 1);
        wait(300);
        say_stop("`0Who wants to know?", &me);
        wait(300);
        say_stop("I .. I'm Dink Smallwood, I'm trying to help...", 1);
        wait(200);
        say_stop("a poor guy who is imprisoned in the dungeon south of here.", 1);
        wait(300);
        say_stop("`0Young Maulwood, people get trapped in places they shouldn't go all the time.", &me);
        wait(200);
        say_stop("`0Why should I care what happens to this man?", &me);
        wait(500);
        sp_dir(1, 2);
        wait(500);
        sp_dir(1, 4);
        wait(500);
        say_stop("It's Smallwood sir, and he says...", 1);
        wait(200);
        say_stop("he was imprisoned by agents of the Cast and that the lock can only be broken with magic!", 1);
        wait(300);
        say_stop("`0Are you high?", &me);
        wait(300);
        say_stop("No.", 1);
        say_stop("`0Oh.", &me);
        wait(200);
        say_stop("`0Well, if those Cast members are involved I'd best help.", &me);
        wait(200);
        say_stop("`0Come in.", &me);
        fade_down();
        fill_screen(0);
//move Dink
        &player_map = 38;
        sp_x(1, 261);
        sp_y(1, 350);
        load_screen();
        draw_screen();
        draw_status();
        fade_up();
        kill_this_task();
        return;
    }
    if (&caveguy == 3)
    {
        int &me;
        &me = &current_sprite;
        script_attach(1000);
        freeze(1);
        playsound(45, 12000, 0,0,0);
        wait(700);
        say_stop("Hey, I'm back!", 1);
        wait(300);
        say_stop("`0Ah, yes Smallwand, come in ..", &me);
        fade_down();
        fill_screen(0);
//move Dink
        &player_map = 38;
        sp_x(1, 261);
        sp_y(1, 350);
        load_screen();
        draw_screen();
        draw_status();
        fade_up();
        kill_this_task();
        return;
    }

    freeze(1);
    wait(500);
    playsound(45, 12000, 0,0,0);
    wait(500);
    say_stop("Hello, anyone home?", 1);
    unfreeze(1);

}
Example #24
0
void main(void)
{
int &old_result;
Playsound(18, 22050, 0,0,0);
freeze(1);
help:

        choice_start();
        "Load a previously saved game"
        "Restart"
        "Quit to system"
        "Help"
        "Continue"
        "View/change gamepad buttons"
        choice_end();


if (&result == 1)
  {
        choice_start();
        "&savegameinfo"
        "&savegameinfo"
        "&savegameinfo"
        "&savegameinfo" 
        "&savegameinfo" 
        "&savegameinfo" 
        "&savegameinfo" 
        "&savegameinfo" 
        "&savegameinfo" 
        "&savegameinfo" 
        "Nevermind"
        choice_end();
if (&result == 11) goto help;

if (game_exist(&result) == 0)
  {

  unfreeze(1);
  wait(2000);  
  Say("Wow, this loaded game looks so familiar.", 1);
  kill_this_task();
    return;
   }

init("load_sequence_now graphics\dink\walk\ds-w1- 71 43 38 72 -14 -9 14 9");
init("load_sequence_now graphics\dink\walk\ds-w2- 72 43 37 69 -13 -9 13 9");
init("load_sequence_now graphics\dink\walk\ds-w3- 73 43 38 72 -14 -9 14 9");
init("load_sequence_now graphics\dink\walk\ds-w4- 74 43 38 72 -12 -9 12 9");

init("load_sequence_now graphics\dink\walk\ds-w6- 76 43 38 72 -13 -9 13 9");
init("load_sequence_now graphics\dink\walk\ds-w7- 77 43 38 72 -12 -10 12 10");
init("load_sequence_now graphics\dink\walk\ds-w8- 78 43 37 69 -13 -9 13 9");
init("load_sequence_now graphics\dink\walk\ds-w9- 79 43 38 72 -14 -9 14 9");

init("load_sequence_now graphics\dink\idle\ds-i2- 12 250 33 70 -12 -9 12 9");
init("load_sequence_now graphics\dink\idle\ds-i4- 14 250 30 71 -11 -9 11 9");
init("load_sequence_now graphics\dink\idle\ds-i6- 16 250 36 70 -11 -9 11 9");
init("load_sequence_now graphics\dink\idle\ds-i8- 18 250 32 68 -12 -9 12 9");

init("load_sequence_now graphics\dink\hit\normal\ds-h2- 102 75 60 72 -19 -9 19 9");
init("load_sequence_now graphics\dink\hit\normal\ds-h4- 104 75 61 73 -19 -10 19 10");
init("load_sequence_now graphics\dink\hit\normal\ds-h6- 106 75 58 71 -18 -10 18 10");
init("load_sequence_now graphics\dink\hit\normal\ds-h8- 108 75 61 71 -19 -10 19 10");


  unfreeze(1);
  load_game(&result);
 &update_status = 1;
 draw_status();

  kill_this_task();
  }
Example #25
0
int editor( int elevel ){
  int lock = -1;
  char obj = EMPTY;
  int level = elevel;
  int curs_x, curs_y;
  char map[MAP_HSIZE][MAP_WSIZE];

  erase();

  attrset(COLOR_PAIR(GB));
  mvprintw(0, 5, "CAVEZ of PHEAR "VERSION );
  attrset(COLOR_PAIR(WB));
  mvprintw(0, 35, "EDITOR" );
  attrset(COLOR_PAIR(CB));
  mvprintw( 24, 2, "0(EMPTY) 1(#) 2(O) 3(*) 4(:) 5($) 6(@) 7(%) 8(M) 9(Z)" );
  attrset(COLOR_PAIR(WB));
  mvprintw( 24, 60, "h(HELP) q(QUIT)" );
  attrset(COLOR_PAIR(MB) | A_NORMAL);
  mvprintw(0, 60, "OBJECT:");
  attrset(COLOR_PAIR(COLOR_MAGENTA) | A_NORMAL);
  mvprintw(0, 71, "LOCK:");
  attrset(A_NORMAL);

  curs_set( TRUE );
  nodelay( stdscr, TRUE );

  load_elevel( map, level, &curs_y, &curs_x );

  int run = 1;
  while( run ){
    switch( tolower( getch() ) ){

    case KEY_UP   : curs_y--      ; break;
    case KEY_DOWN : curs_y++      ; break;
    case KEY_LEFT : curs_x--      ; break;
    case KEY_RIGHT: curs_x++      ; break;

    case '0'      : obj = EMPTY   ; break;
    case '1'      : obj = DIRT    ; break;
    case '2'      : obj = STONE   ; break;
    case '3'      : obj = DIAMOND ; break;
    case '4'      : obj = WALL    ; break;
    case '5'      : obj = MONEY   ; break;
    case '6'      : obj = BOMB    ; break;
    case '7'      : obj = BOMBPK  ; break;
    case '8'      : obj = MONSTER ; break;
    case '9'      : obj = PLAYER  ; break;
    case 'l'      : lock *= -1    ; break;
    case 'h'      : ehelp()       ; break;
    case 27       : run = false   ; break;
    case 10       : map[curs_y][curs_x] = obj;           break;
    case ' '      : map[curs_y][curs_x] = obj; curs_x++; break;
    case 's'      : save( map, level )       ;           break;
    case 'r'      : load_elevel( map, level, &curs_y, &curs_x ); break;
    case 'a'      : memset( map, obj, sizeof(char) * MAP_HSIZE * MAP_WSIZE ); break;
    case 'q'      :
      curs_set( FALSE );
      if( msgbox( "Quit editor == 'q' ? yes : no " ) == 'q' ) run = false;
      curs_set( TRUE );
      break;
    case 'p': 
      int i, ii;
      for( i = 0; i < MAP_HSIZE; ++i) {
        for(ii = 0; ii < MAP_WSIZE; ++ii){
          if (i % 2 == 0 || ii % 2 == 0) {
            map[i][ii] = WALL;
          } else {
            map[i][ii] = EMPTY;
          }
        }
      }

      generate( map, MAP_WSIZE, MAP_HSIZE );

      for( i = 0; i < MAP_HSIZE; i++ )
        for( ii = 0; ii < MAP_WSIZE; ii++ ){
          if( map[ i  ][ ii ] == VISIT ) map[ i  ][ ii ] = EMPTY;
        }

      break;
    default       :                 break;
    } // switch( ch )

    if( curs_y >= MAP_HSIZE ) curs_y = 0;
    if( curs_y <  0         ) curs_y = MAP_HSIZE - 1;
    if( curs_x >= MAP_WSIZE ) curs_x = 0;
    if( curs_x <  0         ) curs_x = MAP_WSIZE - 1;

    if( lock == 1 ) map[curs_y][curs_x] = obj;

    draw_editor( map, HZ );
    draw_status( obj, lock );
    move( curs_y + MAP_Y, curs_x + MAP_X );
  }   // while( run )

  nodelay( stdscr, FALSE );
  curs_set( FALSE );
  return 0;
}
Example #26
0
void NETHER::draw(int width,int height)
{
	float lightpos2[4]={0,0,1000,0};
	float tmpls[4]={1.0F,1.0F,1.0F,1.0};
	float tmpld[4]={0.6F,0.6F,0.6F,1.0};
	float tmpla[4]={0.2F,0.2F,0.2F,1.0};
    float ratio;
	int split = int((width*25.0F)/32.0F);
	int splity = 0;

	if (show_radar) splity = int((height*2.0F)/15.0F)+1;
			   else splity = 0;

	/* Enable Lights, etc.: */ 
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);	// Really Nice Perspective Calculations
	glEnable(GL_LIGHT0);
	glLightfv(GL_LIGHT0,GL_AMBIENT,tmpla);
	glLightfv(GL_LIGHT0,GL_DIFFUSE,tmpld);
	glLightfv(GL_LIGHT0,GL_SPECULAR,tmpls);
	glEnable(GL_LIGHTING);
	glEnable(GL_COLOR_MATERIAL);
	glShadeModel( GL_SMOOTH );
	glCullFace( GL_BACK );
	glFrontFace( GL_CCW );
    glEnable( GL_CULL_FACE );
	glEnable( GL_SCISSOR_TEST );  
	glEnable( GL_DEPTH_TEST );
	glDepthFunc( GL_LEQUAL );
	glClearStencil(0);
	
	/* Draw the GAME screen: */ 
	glLightfv(GL_LIGHT0,GL_POSITION,lightpos);
    glClearColor(0,0,0,0.0);
    glViewport(0,splity,split,height-splity);
	ratio=float(split)/float(height-splity);
    glMatrixMode( GL_PROJECTION );
    glLoadIdentity( );
    gluPerspective( 30.0, ratio, 1.0, 1024.0 );
	glScissor(0,splity,split,height-splity);
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
	draw_game(false);
	if (shadows) {
		/* Set STENCIL Buffer: */ 
		glStencilMask(1);
		glEnable(GL_STENCIL_TEST);
		glDepthMask(GL_FALSE);
		glColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE);
		glStencilFunc(GL_ALWAYS,1,1);
		glStencilOp(GL_KEEP,GL_KEEP,GL_REPLACE);
		draw_game(true);
		glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);

		/* Draw shadow poligon: */ 
		glDepthFunc(GL_ALWAYS);
		glDisable(GL_CULL_FACE);

		glColor4f(0.0,0.0,0.0,0.4f);
		glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
		glEnable(GL_BLEND);

		glStencilFunc(GL_NOTEQUAL,0,1);
		glStencilOp(GL_KEEP,GL_KEEP,GL_KEEP);
		glMatrixMode(GL_PROJECTION);
		glPushMatrix();
		glLoadIdentity();
		glBegin(GL_TRIANGLE_STRIP);
		glVertex3f(-1.0, 1.0,0.0);
		glVertex3f(-1.0,-1.0,0.0);
		glVertex3f( 1.0, 1.0,0.0);
		glVertex3f( 1.0,-1.0,0.0);
		glEnd();
		glPopMatrix();

		glDisable(GL_BLEND);

		glDepthMask(GL_TRUE);
		glDepthFunc(GL_LEQUAL);
		glEnable(GL_CULL_FACE);
		glDisable(GL_STENCIL_TEST);
	} /* if */ 

	if (game_started>0) {
		glMatrixMode( GL_PROJECTION );
		glLoadIdentity( );
		gluPerspective( 30.0, ratio, 1.0, 1024.0 );
		gluLookAt(0,0,30,0,0,0,0,1,0);
		glClear(GL_DEPTH_BUFFER_BIT);
		glMatrixMode(GL_MODELVIEW);
		glLoadIdentity();

		if (game_started>40) glTranslatef(0,0,(game_started-40)*2);
		if (game_started<20) glTranslatef(0,0,(20-game_started)*2);
		message_tile[0]->draw(1.0,1.0,1.0);
	} /* if */ 

	if (game_finished>100) {
		glMatrixMode( GL_PROJECTION );
		glLoadIdentity( );
		gluPerspective( 30.0, ratio, 1.0, 1024.0 );
		gluLookAt(0,0,30,0,0,0,0,1,0);
		glClear(GL_DEPTH_BUFFER_BIT);
		glMatrixMode(GL_MODELVIEW);
		glLoadIdentity();

		if (game_finished<120) glTranslatef(0,0,(120-game_finished)*2);
		if (game_finished>240) glTranslatef(0,0,(game_finished-240)*2);
		if (statistics[0][0]==0) message_tile[2]->draw(1.0,1.0,1.0);
						    else message_tile[1]->draw(1.0,1.0,1.0);
	} /* if */ 

	/* Draw the RADAR screen: */ 
	if (show_radar && redrawradar<=1) {

		glLightfv(GL_LIGHT0,GL_POSITION,lightpos2);
		glClearColor(0.0,0.0,0,0);
		glViewport(0,0,split,splity);
		glMatrixMode( GL_PROJECTION );
		glLoadIdentity( );
		glOrtho(0,float(split),0,float(splity),-100,100);
		glScissor(0,0,split,splity);
		glScalef(width/640.0,height/480.0,1);
		draw_radar();
	} /* if */ 
	redrawradar--;
	if (redrawradar<0) redrawradar=3;

	/* Draw the STATUS screen: */ 
	if (redrawmenu!=0) {
		redrawmenu--;

		glLightfv(GL_LIGHT0,GL_POSITION,lightpos2);
		glClearColor(0,0,0.2,0);
		glViewport(split,0,width-split,height);
		glMatrixMode( GL_PROJECTION );
		glLoadIdentity( );
		glOrtho(0,float(width-split),0,height,-100,100);
		glScissor(split,0,width-split,height);
		glScalef(width/640.0,height/480.0,1);
		draw_status();

/*
		glMatrixMode(GL_MODELVIEW);
		glPushMatrix();
		glLoadIdentity();
		glTranslatef(70.0,10.0,0);
		glColor3f(1.0f,1.0f,1.0f);
		scaledglprintf(0.1f,0.1f,"FPS: %i",frames_per_sec);
		glPopMatrix();
*/
 
	} /* if */ 
} /* NETHER::draw */ 
Example #27
0
void main( void )
{
 if (&caveguy == 5)
 {
  script_attach(1000);
  //preload_seq(740);  <-- for sucking.
preload_seq(375);
  preload_seq(168);
  int &junk;
  int &dude;
  int &evil;
  int &evil2;
  int &evil3;
  freeze(1);
  &dude = create_sprite(551, 157, 0, 0, 0);
  sp_brain(&dude, 0);
  sp_base_walk(&dude, 370);
  sp_speed(&dude, 2);
  sp_timing(&dude, 0);
  //set starting pic
  sp_pseq(&dude, 371);
  sp_pframe(&dude, 1);
  //Now EVIL
  &evil = create_sprite(-20, 130, 0, 0, 0);
  sp_brain(&evil, 0);
  sp_base_walk(&evil, 300);
  sp_speed(&evil, 1);
  sp_timing(&evil, 0);
  //set starting pic
  sp_pseq(&evil, 303);
  sp_pframe(&evil, 1);
  //Now EVIL's friend
  &evil2 = create_sprite(-20, 210, 0, 0, 0);
  sp_brain(&evil2, 0);
  sp_base_walk(&evil2, 300);
  sp_speed(&evil2, 1);
  sp_timing(&evil2, 0);
  //set starting pic
  sp_pseq(&evil2, 303);
  sp_pframe(&evil2, 1);
  //And the third EVIL
  &evil3 = create_sprite(300, 470, 0, 0, 0);
  sp_brain(&evil3, 0);
  sp_base_walk(&evil3, 300);
  sp_speed(&evil3, 1);
  sp_timing(&evil3, 0);
  //set starting pic
  sp_pseq(&evil3, 307);
  sp_pframe(&evil3, 1);
  Playmidi("1004.mid");
  say_stop("`5Ok, let's get going before they come.", &dude);
  wait(500);
  say_stop("`5This way.", &dude);
  move(&dude, 4, 500, 1);
  wait(50);
  move(1, 4, 550, 1);
  wait(150);
  say("`4Not so fast.", &evil);
  move(&evil, 6, 100, 1);
  wait(850);
  move(&evil3, 8, 380, 1);
  move_stop(&evil2, 6, 67, 1);
  say_stop("`4We have a small matter to discuss with your friend.", &evil);
  say("`4Hahahaaahaha", &evil);
  say("`4Haha ha ha", &evil2);
  say_stop("`4Ha ha haaa", &evil3);
  wait(800);
  sp_dir(&dude, 3);
  say_stop("`5It's okay Dink, I can take 'em.", &dude);
  wait(250);
  say("`5Allright.", &dude);
  move_stop(&dude, 4, 400, 1);
  sp_dir(&dude, 1);
  say_stop("`5Which one of you is first?", &dude);
  wait(250);
  say("`4Haha ha ha", &evil2);
  wait(500);
  say_stop("`4Ha ha haaa", &evil3);
  wait(500);
  say_stop("`4I am!!", &evil);
  move_stop(&evil, 2, 157, 1);
  move_stop(&evil, 6, 170, 1);
  wait(500);
  //say("`4I'm attacking now...", &evil);
  &junk = create_sprite(240, 157, 11, 506, 1);
  sp_seq(&junk, 506); 
  sp_dir(&junk, 6);
  sp_speed(&junk, 6);
  sp_flying(&junk, 1);
  wait(390);
  sp_active(&junk, 0);
  &junk = create_sprite(390, 157, 7, 168, 1);
  sp_seq(&junk, 168);
  sp_pseq(&dude, 375);
  sp_pframe(&dude, 1);

  say_stop("`5Ahhhhhh!", &dude);
  wait(50);
  sp_active(&junk, 0);
  //Kill guy too

  say("Noooo!!", 1);
  move(1, 4, 450, 1);
  wait(500);
  say("`4Haha ha ha", &evil2);
  say_stop("`4Ha ha haaa", &evil3);
  wait(500);
  say_stop("`4Our work is done here.", &evil);
  wait(500);
  say_stop("`4You may live, if you forget all that you've seen here.", &evil);
  wait(250);
  say_stop("Forget ...", 1);
  wait(500);
  say_stop("I'll forget allright.", 1);
  wait(250);
  move(&evil, 4, -20, 1);
  wait(360);
  move(&evil2, 4, -20, 1);
  move_stop(&evil3, 4, 180, 1);
  move_stop(&evil3, 2, 470, 1);
  sp_active(&evil, 0);
  sp_active(&evil2, 0);
  sp_active(&evil3, 0);
  wait(250);
  say_stop("Forget to remove my foot from your ASS!!", 1);
  wait(500);
  say_stop("Are you okay?", 1);
  wait(500);
  say_stop("`5I just got hit by a fireball", &dude);
  wait(500);
  say_stop("`5I'm going to die!", &dude);
  wait(250);
  say_stop("I'm sorry I wasn't fast enough.", 1);
  wait(500);
  say_stop("`5It's not your fault", &dude);
  wait(500);
  say_stop("`5Just .. just be careful... also, take this...", &dude);
  wait(500);
  say_stop("Alright.. what is it?", 1);
  wait(500);
  say_stop("`5The Mordavia scroll.  It contains magic I needed to...", &dude);
  say_stop("`5Ahhhhhh.", &dude);
  wait(1000);
  say_stop("Ah man...", 1);
  sp_active(&dude, 0);
  &caveguy = 6;
  add_magic("item-p1", 438,14);
  &story = 7;
  unfreeze(1);
  //Fade
  fade_down();
  fill_screen(0);
  //move Dink
  &player_map = 625;
  sp_x(1, 268);
  sp_y(1, 173);
  sp_dir(1, 8);
  load_screen();
  draw_screen();
  draw_status();
  fade_up();
  kill_this_task();
 }
}
Example #28
0
void main(int argc,char **argv)
{
  int i,nowait=FALSE;

  setup_struct();

  if(argc != 1)
  {
    for(i=1;i<argc;i++)
    {
      if(strcmp(argv[i],"-map") == 0) sm->mapdraw = TRUE;
      else if((strcmp(argv[i],"-server") == 0) || (strcmp(argv[i],"-s") == 0))
      {
        i++;
        sm->sologame = FALSE;
        if(strlen(argv[i]) > 255)
        {
          fprintf(stderr,"Hostname too int!!\n");
          exit(1);
        }
        strcpy(sm->hostname,argv[i]);
      }
      else if((strcmp(argv[i],"-help") == 0) || (strcmp(argv[i],"-h") == 0))
      {
        usage(stdout);
        exit(0);
      }
      else if(strcmp(argv[i],"-name") == 0)
      {
        i++;
        if(strlen(argv[i]) >= MAXNAME)
        {
          fprintf(stderr,"Name too int. Maximum is %d character.\n",MAXNAME-1);
          exit(1);
        }
        strcpy(sm->ownname,argv[i]);
      }
      else if(strcmp(argv[i],"-tiny") == 0)
        sm->outputsize = 14;
      else if(strcmp(argv[i],"-small") == 0)
        sm->outputsize = 13;
      else if(strcmp(argv[i],"-huge") == 0)
        sm->outputsize = 11;
      else if(strcmp(argv[i],"-big") == 0)
        sm->outputsize = -1;
      else if(strcmp(argv[i],"-mono") == 0)
        sm->monomode = TRUE;
      else if((strcmp(argv[i],"-gray") == 0) || (strcmp(argv[i],"-grey") == 0))
        sm->graymode = TRUE;
      else if(strcmp(argv[i],"-dither") == 0)
        sm->dithermode = TRUE;
      else if(strcmp(argv[i],"-nowait") == 0)
        nowait = TRUE;
      else if(strcmp(argv[i],"-camera") == 0)
        sm->camera = TRUE;
      else if(strcmp(argv[i],"-direct") == 0)
        sm->directdraw = TRUE;
      else if(strcmp(argv[i],"-sound") == 0)
        sm->usesound = TRUE;
      else if(!strcmp(argv[i],"-privatecmap"))
        sm->privatecmap = TRUE;
      else if(!strcmp(argv[i],"-noshmem"))
        sm->noshmem = TRUE;
      else if(!strcmp(argv[i],"-texture"))
      {
        sm->texturemode = TRUE;
        sm->privatecmap = TRUE;
      }
      else if(strcmp(argv[i],"-comment") == 0)
      {
        i++;
        if(strlen(argv[i]) >= MAXCOMMENT)
        {
          fprintf(stderr,"Comment too int. Maximum is %d character.\n",MAXCOMMENT-1);
          exit(1);
        }
        strcpy(sm->owncomment,argv[i]);
      }
      else
      {
        usage(stderr);
        exit(1);
      }
    }
  }
#ifndef USE_SOUND
  if(sm->usesound)
    fprintf(stderr,"You haven't compiled netmaze with USE_SOUND.\n");
#endif

  if(sm->sologame && sm->usesound)
  {
    sm->usesound = FALSE;
    fprintf(stderr,"It's not possible to use sound in the solo testmode.\n");
  }

  if( (sm->monomode + sm->graymode + sm->dithermode) > 2 )
  {
    fprintf(stderr,"Sorry .. only -mono OR -gray OR -dither is allowed\n");
    exit(1);
  }
  if( sm->texturemode && (sm->monomode || sm->graymode || sm->dithermode))
  {
    fprintf(stderr,"Warning: Textures only usefull in colormode yet.\n");
  }

    /* init Default-Maze */
  create_maze(&(sm->std_maze));
    /* Signals,Gfx,Network,(IPC:fork),keyboard initialisieren */
  init_program(argc,argv);

  if(sm->sologame)
  {
    printf("Press '1' to start game!\n");
  }
  else
  {
    printf("OK .. now wait for serverstart\n");
  }

  /**** beginning of the mainloop (endless) ****/

  while(!sm->exitprg)
  {
    int waitselect;

#ifdef USE_IPC
   if(sm->sologame) x11_cntrl();
#else
   x11_cntrl();
#endif

    if(nowait)
      waitselect = FALSE;
    else
      waitselect = TRUE;

    if(sm->bgdraw)
    {
      draw_info();
      sm->bgdraw = FALSE;
      x11_flush();
    }

    if((sm->screendraw) && (sm->redraw))
    {
      if(sm->drawwait >= DRAWWAIT)
      {
        sm->redraw = FALSE;
        sm->drawwait = 0;
        draw_screen();
        waitselect = FALSE;
      }
    }

    if((sm->winnerdraw) && (sm->redraw))
    {
      sm->redraw = FALSE;
      draw_end(sm->playfeld,sm->winner); /* does XSync() */
    }

    if((sm->statchg2) && (!sm->gameflag)) /*update Screen after the Gameover*/
    {
      sm->statchg  = TRUE;
      sm->statchg2 = FALSE;
      draw_status(-1,sm->playfeld);
      x11_flush();
    }

    if((sm->killchg) && (!sm->gameflag)) /*update Screen after the Gameover*/
    {
      draw_kills(sm->shownumber,sm->playfeld);
      x11_flush();
    }

    if(waitselect) /* test! only a timeout-wait yet */
    {              /* this reduces the load enormous :) */
      struct timeval timeout;
#ifdef USE_IPC
      if(sm->gameflag)
      {
        timeout.tv_sec = 0;
        timeout.tv_usec = 1000; /* lower than the minval on most machines */
      }
      else
      {
#endif
        timeout.tv_sec = 0;         /* in NON-IPC versions, the SIGIO-Signal */
        timeout.tv_usec = 100000;   /* also exits the select-command */
#ifdef USE_IPC
      }
#endif
      select(0,NULL,NULL,NULL,&timeout);
    }
  }

  XCloseDisplay(sm->grafix.display);
}
Example #29
0
void draw() {
  draw_map();
  draw_player();
  draw_status();
  draw_inventory();
}
Example #30
0
bool
view_column_draw(struct view *view, struct line *line, unsigned int lineno)
{
	struct view_column *column = view->columns;
	struct view_column_data column_data = {0};

	if (!view->ops->get_column_data(view, line, &column_data))
		return true;

	if (column_data.section)
		column = column_data.section;

	for (; column; column = column->next) {
		mode_t mode = column_data.mode ? *column_data.mode : 0;

		if (column->hidden)
			continue;

		switch (column->type) {
		case VIEW_COLUMN_DATE:
			if (draw_date(view, column, column_data.date))
				return true;
			continue;

		case VIEW_COLUMN_AUTHOR:
			if (draw_author(view, column, column_data.author))
				return true;
			continue;

		case VIEW_COLUMN_REF:
			if (draw_ref(view, column, column_data.ref))
				return true;
			continue;

		case VIEW_COLUMN_ID:
			if (draw_id(view, column, column_data.reflog ? column_data.reflog : column_data.id))
				return true;
			continue;

		case VIEW_COLUMN_LINE_NUMBER:
			if (draw_lineno(view, column, column_data.line_number ? *column_data.line_number : lineno))
				return true;
			continue;

		case VIEW_COLUMN_MODE:
			if (draw_mode(view, column, mode))
				return true;
			continue;

		case VIEW_COLUMN_FILE_SIZE:
			if (draw_file_size(view, column, column_data.file_size ? *column_data.file_size : 0, mode))
				return true;
			continue;

		case VIEW_COLUMN_COMMIT_TITLE:
			if (draw_commit_title(view, column, column_data.graph, column_data.graph_canvas,
					      column_data.refs, column_data.commit_title))
				return true;
			continue;

		case VIEW_COLUMN_FILE_NAME:
			if (draw_filename(view, column, column_data.file_name, mode))
				return true;
			continue;

		case VIEW_COLUMN_SECTION:
			if (draw_text(view, column->opt.section.type, column->opt.section.text))
				return true;
			continue;

		case VIEW_COLUMN_STATUS:
			if (draw_status(view, column, line->type, column_data.status))
				return true;
			continue;

		case VIEW_COLUMN_TEXT:
		{
			enum line_type type = line->type;
			const char *text = column_data.text;

			if (line->wrapped && draw_text(view, LINE_DELIMITER, "+"))
				return true;

			if (line->graph_indent) {
				size_t indent = get_graph_indent(text);

				if (draw_text_expanded(view, LINE_DEFAULT, text, -1, indent, false))
					return true;
				text += indent;
			}

			if (line->commit_title) {
				if (draw_text_overflow(view, text, LINE_DEFAULT,
						       column->opt.text.commit_title_overflow, 4))
					return true;

			} else if (column_data.box) {
				const struct box *box = column_data.box;
				const char *text = box->text;
				size_t i;

				for (i = 0; i < box->cells; i++) {
					const struct box_cell *cell = &box->cell[i];

					if (draw_textn(view, cell->type, text, cell->length))
						return true;

					text += cell->length;
				}

			} else if (draw_text(view, type, text)) {
				return true;
			}
		}
			continue;
		}
	}

	return true;
}