Esempio n. 1
0
void anim_sipky(int h,int mode)
  {
  static int phase = 0;
  static char drw = 0;
  static short handle = 0;

     if (mode == 1)
       {
       handle = h;
       phase = 6;
       return;
       }
    if (phase && mode != 255)
       {
       int i;

       if (phase>4) i = 8-phase; else i = phase;
       i = (i-2)*110;
       if (i>= 0)
       put_8bit_clipped(ablock(handle),GetScreenAdr()+378*scr_linelen2+498,i,142,102);
       else put_picture(498,378,ablock(H_SIPKY_END));
       drw = 1;
       if (mode != -1)
        {
        phase--;
        }
       }
  if (mode == 255 && drw)
     {
     showview(498,378,142,102);
     drw = 0;
     }
  }
Esempio n. 2
0
void mouse_set_cursor(int cursor)
  {
  static short *ms_item=NULL;

  if (cursor==last_ms_cursor) return;
  if (last_ms_cursor>0) aunlock(last_ms_cursor);
  if (cursor>0)
     {
     alock(cursor);
     schovej_mysku();
     register_ms_cursor(ablock(cursor));
     last_ms_cursor=cursor;
     set_ms_finger(0,0);
     ukaz_mysku();
     }
  else
     {
     char *p;

     cursor=-cursor;
     if (ms_item==NULL) ms_item=(short *)getmem(IT_ICONE_SIZE);
     p=(char *)ablock(cursor/18+ikon_libs);
     memcpy(ms_item,&p[(cursor%18)*IT_ICONE_SIZE],IT_ICONE_SIZE);
     schovej_mysku();
     register_ms_cursor(ms_item);
     set_ms_finger(45/2,55/2);
     last_ms_cursor=-cursor;
     ukaz_mysku();
     }
  }
Esempio n. 3
0
void bott_disp_text_proc(void **pp,long *ss)
  {
  char *p,*text;
  int y = 20;
  int xx,yy;

  text = alloca(strlen(bott_text)+2);
  set_font(H_FBOLD,NOSHADOW(0));
  zalamovani(bott_text,text,390,&xx,&yy);
  RedirectScreen(bott_clear());
  if (battle && cur_mode == MD_INBATTLE) put_picture(0,0,ablock(H_BATTLE_BAR));
  else put_picture(0,0,ablock(H_DESK));
  create_frame(70,20,400,50,1);
  p = text;
  do
     {
     position(70,y);
     outtext(p);
     y += text_height(p);
     p = strchr(p,0)+1;
     }
  while (p[0]);
  *pp = GetScreenAdr();
  *ss = _msize(*pp);
  RestoreScreen();
  }
Esempio n. 4
0
void set_font(int font,int c1,...)
  {
  static int last_font=-1;
  int i;

  if (last_font!=-1 && last_font!=font)
     {
     aunlock(last_font);
     alock(font);
     }
  curfont=ablock(font);
  if (c1>=0)
     if (c1 & BGSWITCHBIT)
      {
      charcolors[0]=0xFFFF;
      for (i=1;i<5;i++) charcolors[i]=c1 & ~0x20;
      }
     else
      {
      charcolors[0]=0;
      for (i=1;i<5;i++) charcolors[i]=c1 & ~0x20;
      }
  else if (c1==-2)
     {
     int *p;

     p=&c1;p++;
     for (i=0;i<5;i++) charcolors[i]=*p++;
     }
  last_font=font;
  default_font=curfont;
  memcpy(f_default,charcolors,sizeof(charcolors));
  }
Esempio n. 5
0
void draw_blood(char mode,int mob_dostal,int mob_dostal_pocet)
	{
	static int phase = 100;
	static int block;
	static int dostal;
	char s[20];
	word *adr;
	int i;

	mob_dostal_pocet;
  if (mode) {
    if (phase<3) dostal += mob_dostal_pocet;else dostal = mob_dostal_pocet;
    phase = 0;
    block = mob_dostal;
    return;
    }
	if (phase>7) return;
	adr = 520+378*scr_linelen2+GetScreenAdr();
	i = 105*phase;
	phase++;
  put_8bit_clipped(ablock(H_KREVMIN+block-1),adr,i,120,102);
	set_font(H_FTINY,RGB555(31,31,31));
	itoa(dostal,s,10);
	set_aligned_position(60+520,51+378,1,1,s);outtext(s);
	}
Esempio n. 6
0
static void draw_small_icone(int num,int x,int y)
  {
  word *pic;

  pic = ablock(H_POSTUP);
  num*= 13;x += num;
  put_textured_bar(pic,x,y,13,13,num,0);
  }
Esempio n. 7
0
char clk_touch_vyk(int sector,int side,int xr,int yr)
  {
  int i;
  TVYKLENEK *v;
  int x1,y1,x2,y2;

  if (picked_item!=NULL && picked_item[1]!=0) return 0;
  for(i=0;v=map_vyk+i,i<vyk_max;i++) if (v->sector==sector && v->dir==side) break;
  if (i==vyk_max) return 0;
  x1=v->xpos-v->xs/2;
  x2=v->xpos+v->xs/2;
  y1=320-(v->ypos+v->ys);
  y2=320-(v->ypos);
  x1+=MIDDLE_X-points[0][1][1].x;
  x2+=MIDDLE_X-points[0][1][1].x;
  y1+=MIDDLE_Y+points[0][1][1].y;
  y2+=MIDDLE_Y+points[0][1][1].y;
  if (x1<=xr && xr<=x2 && y1<=yr && yr<=y2)
     {
     if (picked_item==NULL)
        {
        for(i=0;v->items[i];i++);if (!i) return 0;
        i--;
        picked_item=NewArr(short,2);
        picked_item[0]=v->items[i];picked_item[1]=0;
        v->items[i]=0;
        do_items_specs();
        pick_set_cursor();
        call_macro(viewsector*4+viewdir,MC_VYKEVENT);
        return 1;
        }
     else
        {
        int fc;
        word *w;
        for(i=0;v->items[i];i++);if (i==8)
           {
           bott_disp_text(texty[36]);
           return 1;
           }
        fc=picked_item[0];fc=glob_items[fc-1].vzhled+face_arr[0];
        w=ablock(fc);
        if (v->xs<w[0] || v->ys<w[0])
           {
           bott_disp_text(texty[35]);
           return 1;
           }
        v->items[i]=picked_item[0];
        v->items[i+1]=0;
        call_macro(viewsector*4+viewdir,MC_VYKEVENT);
        free(picked_item);picked_item=NULL;
        pick_set_cursor();
        return 1;
        }
     }
Esempio n. 8
0
static void draw_spectxtrs(word sector,int celx,int cely)
  {
  int i;
  char a = 1;

  if (!(map_coord[sector].flags & MC_SPECTXTR)) return;
  for(i = 0;i<MAX_SPECTXTRS;i++) if (spectxtr[i].repeat && spectxtr[i].sector == sector)
     {
     SPECTXTR *sp = spectxtr+i;

     draw_spectxtr(ablock(sp->handle+sp->pos),celx,cely,sp->xpos);
     a = 0;
     }
  if (a)
     map_coord[sector].flags &= ~MC_SPECTXTR;
  }
Esempio n. 9
0
static void bott_fletna_normal(void **pp,long *s)
  {
  word *bott_scr;
  int i,x;
  bott_scr = bott_clear();
  RedirectScreen(bott_scr);
  put_picture(0,0,ablock(H_FLETNA_BAR));
  set_font(H_FTINY,RGB555(31,31,0));
  set_aligned_position(103,52,1,1,texty[174]);outtext(texty[174]);
  for(i = 0,x = 156;i<12;i++,x += 22)
     {
     set_aligned_position(x,32,1,1,texty[180+i]);outtext(texty[180+i]);
     }
  *pp = GetScreenAdr();
  *s = _msize(*pp);
  RestoreScreen();
  }
Esempio n. 10
0
void set_background(void **p,long *s)
  {
  word *data;
  word *ptr;
  word *pal;
  char *pic;
  int counter;

  if (!bgr_handle) return;
  if (bgr_distance==-1) return;
  data=ablock(bgr_handle);
  *s=scr_linelen2*360*2;
  ptr=*p=getmem(*s);
  counter=scr_linelen2*360;
  pal=data+3+bgr_distance*256;
  pic=(char *)data+PIC_FADE_PAL_SIZE;
  do
	*ptr++=pal[*pic++] | BGSWITCHBIT;
  while (--counter);
  }
Esempio n. 11
0
void ukaz_kompas(char mode)
  {
  static int phase = 0,speed = 0;
  int direct;

  if (mode == 1)
     {
     direct = (3-viewdir);
     direct = phase-direct*10;
     if (direct<-20) direct += 40;
     if (direct>= 20) direct -= 40;
     speed = ((direct>0)-(direct<0));
     }
  if (mode != 255) put_image(ablock(H_KOMPAS),GetScreenAdr()+476,phase*16,102,16);
  if (mode == 1)
     {
     phase -= speed;if (phase>39) phase = 0;
     if(phase<0) phase = 39;
     }
  if (mode == 255) showview(476,0,102,15);
  }
Esempio n. 12
0
static char *displ_picture(char *c)
  {
  char *d;
  int x,y,hn,z,ln,sl;
  short *sh;

  d = write_buff;
  while (*c !=':') *d++= *c++;
  *d++= 0;c++;
  hn = get_data_handle(write_buff,pcx_8bit_decomp);
  x = read_num(c,(z = 0,&z));c += z;
  y = read_num(c,(z = 0,&z));c += z;
  ln = read_num(c,(z = 0,&z));c += z;
  sl = read_num(c,(z = 0,&z));c += z;
  sh = ablock(hn);
  if (sh[1]+y>YMAX) return c;
  y += YLEFT;
  x += relpos;
  put_8bit_clipped(sh,GetScreenAdr()+x+scr_linelen2*y,ln,sh[0],sl);
  return c;
  }
Esempio n. 13
0
static void insert_picture(char *filename,int align,int line,int lsize)
  {
  int x, y;
  short *psiz;
  char *c = write_buff;

  psiz = ablock(get_data_handle(filename,pcx_8bit_decomp));
  switch (align)
     {
     case ANUM_CENTER:
                       x = (XMAX-psiz[0])/2;
                       y = linepos;
                       linepos += psiz[1];
                       *c++= 27;
                       *c++= END_LINE;
                       c += insert_num(c,0,psiz[1]+last_skip);
                       break;
     case ANUM_LEFT:   x = 0;
                       y = linepos;
                       left_skip = psiz[0]+5;
                       total_width = XMAX-left_skip;
                       break;
     case ANUM_RIGHT:  total_width = (x = XMAX-psiz[0])-5;
                       left_skip = 0;
                       y = linepos;
                       break;
     }
  if (!lsize) lsize = psiz[1]-line;
  picture_len = lsize;
  *c++= 27;
  *c++= PICTURE;
  while (*filename) *c++= *filename++;
  *c++=':';
  c += insert_num(c,0,x);
  c += insert_num(c,0,y);
  c += insert_num(c,0,line);
  c += insert_num(c,0,lsize);
  *c++= 0;
  str_add(&all_text,write_buff);
  }
HANDLE
__gsh_no_block_spawn (char *args[], char *cwd, char *env[],
		      int pstdin, int pstdout, int pstderr)
{
  BOOL result;
  STARTUPINFO SI;
  PROCESS_INFORMATION PI;
  SECURITY_ATTRIBUTES SA;
  TCHAR *wcommand;
  TCHAR *wcwd = NULL;
  void *block_env = NULL;

  /* Startup info. */
  SI.cb          = sizeof (STARTUPINFO);
  SI.lpReserved  = NULL;
  SI.lpDesktop   = NULL;
  SI.lpTitle     = NULL;
  SI.dwFlags     = STARTF_USESTDHANDLES;
  SI.wShowWindow = SW_HIDE;
  SI.cbReserved2 = 0;
  SI.lpReserved2 = NULL;
  SI.hStdInput   = (HANDLE) _get_osfhandle (pstdin);
  SI.hStdOutput  = (HANDLE) _get_osfhandle (pstdout);
  SI.hStdError   = (HANDLE) _get_osfhandle (pstderr);

  /* Security attributes. */
  SA.nLength = sizeof (SECURITY_ATTRIBUTES);
  SA.bInheritHandle = TRUE;
  SA.lpSecurityDescriptor = NULL;

  /* Prepare the command string. */
  wcommand = wjoin (args);

  /* Then the environment block */
  if (env != NULL)
    block_env = ablock (env);

  /* Convert dir to widestrig */
  if (cwd != NULL)
    {
      wcwd = (TCHAR *) malloc (strlen (cwd) * 2 + 2);
      S2WSC (wcwd, cwd, strlen (cwd) * 2 + 2);
    }

  result = CreateProcess
      (NULL, wcommand, &SA, NULL, TRUE,
       GetPriorityClass (GetCurrentProcess()), block_env, wcwd, &SI, &PI);

  free (block_env);
  free (wcommand);
  free (wcwd);

  if (result == TRUE)
    {
      CloseHandle (PI.hThread);
      return PI.hProcess;
    }
  else
    {
      printf ("%d\n", GetLastError ());
      return NULL;

    }
}
Esempio n. 15
0
void new_setup()
  {
  WINDOW *w;
  CTL3D ctl;
  int i;
  static int textxp[]={ 75, 75,435,435,434,535,535,535,434,434,434,434,434, 35,410,510};
  static int textyp[]={275,305, 65, 95,125, 65, 95,125,185,215,245,275,305,235, 40, 40};
  static int  textc[]={ 53, 54, 56, 57, 58, 56, 57, 58,140,141,142,143,144 ,51, 55, 59};

  mix_back_sound(256000-16384);
  memset(&ctl,0,sizeof(ctl));
  change_click_map(setup,4);
  set_font(H_FBOLD,SETUP_COL2);
  default_font=curfont;
  memcpy(f_default,charcolors,sizeof(f_default));
  w=create_window(0,SCREEN_OFFLINE,639,359,0,&ctl);
  w->draw_event=show_setup_desktop;
  desktop_add_window(w);
  define(10,50,270,190,20,0,skeldal_checkbox);  c_default(get_snd_effect(SND_SWAP));   on_change(do_setup_change);
  if (check_snd_effect(SND_OUTFILTER))
     {
     define(20,50,300,190,20,0,skeldal_checkbox);c_default(get_snd_effect(SND_OUTFILTER));
        on_change(do_setup_change);
     }

  define(30,410,60,90,20,0,skeldal_checkbox);c_default(zoom_speed(-1)==0);
  on_change(change_zoom);
  define(40,410,90,90,20,0,skeldal_checkbox);c_default(zoom_speed(-1)==1);on_change(change_zoom);
  define(50,410,120,90,20,0,skeldal_checkbox);c_default(zoom_speed(-1)==2);on_change(change_zoom);

  define(60,510,60,90,20,0,skeldal_checkbox);c_default(turn_speed(-1)==0);on_change(change_turn);
  define(70,510,90,90,20,0,skeldal_checkbox);c_default(turn_speed(-1)==1);on_change(change_turn);
  define(80,510,120,90,20,0,skeldal_checkbox);c_default(turn_speed(-1)==2);on_change(change_turn);

  for(i=0;i<5;i++)
     {
     define((i+9)*10,410,180+i*30,190,20,0,skeldal_checkbox);
     switch(i)
        {
        case 0:c_default(show_names);break;
        case 1:c_default(enable_sort);break;
        case 2:c_default(autoattack);break;
        case 3:c_default(autosave_enabled);break;
        case 4:c_default(level_preload);break;
        }
     }

  for(i=0;i<sizeof(textc)/sizeof(int);i++)
     define(-1,textxp[i],textyp[i]-1,1,1,0,label,texty[textc[i]]);

  for(i=0;i<sizeof(effects)/sizeof(int);i++)
     if (check_snd_effect(effects[i]))
       {
       define(200+i*10,50+i*60,30,30,200,0,skeldal_soupak,effects[i]==SND_MUSIC?127:255);c_default(get_snd_effect(effects[i]));
       on_change(do_setup_change);
       }
  define(300,559,336,81,21,0,setup_ok_button,texty[174]);on_change(unwire_setup);
  property(NULL,ablock(H_FTINY),&color_topbar,0);
  redraw_window();
  add_to_timer(TM_CHECKBOX,4,-1,checkbox_animator);
  }
Esempio n. 16
0
static void bott_draw_normal(void **pp,long *s)
  {
  int i,j;int x,xs = 0,y;
  word *bott_scr;
  THUMAN *p;

  bott_scr = bott_clear();
  RedirectScreen(bott_scr);
  if (battle && cur_mode == MD_INBATTLE) put_picture(0,0,ablock(H_BATTLE_BAR));
  else put_picture(0,0,ablock(H_DESK));
  memcpy(&xs,ablock(H_OKNO),2);
  x = 54;
  for(j = 0;j<POCET_POSTAV;j++)
     if ((p =&postavy[i = group_sort[j]])->used)
     if (cur_mode != MD_PRESUN || i == moving_player)
     {
     char c[] =" ";int z,lv,llv;
     put_picture(x,0,ablock(H_OKNO));lv = p->lives;llv = p->vlastnosti[VLS_MAXHIT];
     if (lv || p->used & 0x80)
        {
        z = 3-((lv-1)*4/llv);if (lv == llv) z = 0;
        z*= 75;
        if (p->xicht>= 0)put_8bit_clipped(ablock(H_XICHTY+i),bott_scr+PIC_X+x+PIC_Y*scr_linelen2,z,54,75);
        if (p->bonus) draw_small_icone(0,PIC_X+x+1,PIC_Y+1);
        if (p->spell) draw_small_icone(1,PIC_X+x+1,PIC_Y+1);
        if (!p->voda) draw_small_icone(2,PIC_X+x+1,PIC_Y+1);
        if (!p->jidlo) draw_small_icone(3,PIC_X+x+1,PIC_Y+1);
        }
     else put_picture(PIC_X+x,PIC_Y,ablock(H_LEBKA));
     curcolor = 0;
     y = BARS_YS-p->lives*BARS_YS/p->vlastnosti[VLS_MAXHIT];
     if (y) bar(x+ZIVOTY_S,BARS_S,x+ZIVOTY_E,BARS_S+y);
     y = BARS_YS-p->kondice*BARS_YS/p->vlastnosti[VLS_KONDIC];
     if (y) bar(x+KONDIC_S,BARS_S,x+KONDIC_E,BARS_S+y);
     if (p->vlastnosti[VLS_MAXMANA]) y = BARS_YS-p->mana*BARS_YS/p->vlastnosti[VLS_MAXMANA];else y = BARS_YS;
     if (y<0) y = 0;
     if (y) bar(x+MANA_S,BARS_S,x+MANA_E,BARS_S+y);
     if (p->sektor != viewsector) trans_bar25(x,0,74,102);
     set_font(H_FLITT,p->groupnum == cur_group && !battle?SEL_COLOR:barvy_skupin[p->groupnum]);
     set_aligned_position(x+36,92,1,0,p->jmeno);outtext(p->jmeno);
     c[0] = p->groupnum+48;set_aligned_position(x+5,86,0,2,c);outtext(c);
     if (cur_mode == MD_INBATTLE)
        {
        char s[20];
		signed char dir;
        set_font(H_FBOLD,RGB555(31,31,0));
        sprintf(s,texty[40],p->actions);
        set_aligned_position(x+56,86,2,2,s);outtext(s);
		dir = viewdir-p->direction;
		if (abs(dir) == 2) c[0] = 2;
		else if (dir == -1 || dir == 3) c[0] = 1;
		else if (dir == -3 || dir == 1) c[0] = 3;
		  if (dir)
		  {
   			set_font(H_FSYMB,p->groupnum == cur_group && !battle?SEL_COLOR:barvy_skupin[p->groupnum]);
			c[0]+= 4;set_aligned_position(x+10,86,0,2,c);outtext(c);
		  }
        }
     if (i == select_player) rectangle(x+3,12,x+3+54,12+75,SEL_COLOR);
     if (p->dostal)
        {
        char s[20];
        put_picture(x+ZASAHB_X,ZASAHB_Y,ablock(H_PZASAH));
        set_font(H_FBOLD,RGB555(31,31,0));
        sprintf(s,"%d",p->dostal);
        set_aligned_position(x+ZASAHT_X,ZASAHT_Y,1,1,s);outtext(s);
        }
     x += xs;
     }
  if (cur_mode == MD_PRESUN || cur_mode == MD_UTEK)
     {
     char s[40];
     set_font(H_FBOLD,RGB555(31,31,16));
     position(150,20);outtext(texty[cur_mode == MD_PRESUN?42:44]);
     sprintf(s,texty[60+cislovka(postavy[moving_player].actions)],postavy[moving_player].actions);
     position(150,35);outtext(s);
     position(150,50);outtext(texty[63]);
     }
/*  if (mob_dostal)
        {
        word *w;
        char s[40];

        w = ablock(H_MZASAH1+mob_dostal-1);
        put_picture(580-(w[0]>>1),55-(w[1]>>1),w);
        itoa(mob_dostal_pocet,s,10);
        set_font(H_FLITT5,0xffff);
        set_aligned_position(580,55,1,1,s);
        outtext(s);
        }
 */
  *pp = GetScreenAdr();
  *s = _msize(*pp);
  RestoreScreen();
  }
Esempio n. 17
0
static void show_setup_desktop(WINDOW *w)
  {
  put_picture(w->x,w->y,ablock(H_SETUPBAR));
  }