Free Hero Mesh

Diff
Login
This is a mirror of the main repository for Free Hero Mesh. New tickets and changes will not be accepted at this mirror.

Differences From Artifact [b641536c5e]:

To Artifact [cbe344cbd2]:


17
18
19
20
21
22
23

24
25
26
27
28
29
30
#include "smallxrm.h"
#include "pcfont.h"
#include "quarks.h"
#include "heromesh.h"

SDL_Surface*screen;
Uint16 picture_size;


static SDL_Surface*picts;
static Uint8*curpic;

static const char default_palette[]=
  "C020FF "
  "000000 222222 333333 444444 555555 666666 777777 888888 999999 AAAAAA BBBBBB CCCCCC DDDDDD EEEEEE FFFFFF "







>







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "smallxrm.h"
#include "pcfont.h"
#include "quarks.h"
#include "heromesh.h"

SDL_Surface*screen;
Uint16 picture_size;
int left_margin;

static SDL_Surface*picts;
static Uint8*curpic;

static const char default_palette[]=
  "C020FF "
  "000000 222222 333333 444444 555555 666666 777777 888888 999999 AAAAAA BBBBBB CCCCCC DDDDDD EEEEEE FFFFFF "
84
85
86
87
88
89
90

















91
92
93
94
95
96
97

void draw_picture(int x,int y,Uint16 img) {
  // To be called only when screen is unlocked!
  SDL_Rect src={(img&15)*picture_size,(img>>4)*picture_size,picture_size,picture_size};
  SDL_Rect dst={x,y,picture_size,picture_size};
  SDL_BlitSurface(picts,&src,screen,&dst);
}


















void draw_text(int x,int y,const unsigned char*t,int bg,int fg) {
  // To be called only when screen is locked!
  int len=strlen(t);
  Uint8*pix=screen->pixels;
  Uint8*p;
  Uint16 pitch=screen->pitch;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115

void draw_picture(int x,int y,Uint16 img) {
  // To be called only when screen is unlocked!
  SDL_Rect src={(img&15)*picture_size,(img>>4)*picture_size,picture_size,picture_size};
  SDL_Rect dst={x,y,picture_size,picture_size};
  SDL_BlitSurface(picts,&src,screen,&dst);
}

void draw_cell(int x,int y) {
  // To be called only when screen is unlocked!
  Uint32 o;
  Class*c;
  SDL_Rect dst={x,y,picture_size,picture_size};
  if(x<1 || x>64 || y<1 || y>64) return;
  SDL_FillRect(screen,&dst,back_color);
  o=playfield[y*64+x+65];
  while(o!=VOIDLINK) {
    if(!(objects[o]->oflags&OF_INVISIBLE)) {
      c=classes[objects[o]->class];
      if(objects[o]->image<c->nimages) draw_picture(x*picture_size+left_margin,y*picture_size,c->images[objects[o]->image]&0x7FFF);
    }
    o=objects[o]->up;
  }
}

void draw_text(int x,int y,const unsigned char*t,int bg,int fg) {
  // To be called only when screen is locked!
  int len=strlen(t);
  Uint8*pix=screen->pixels;
  Uint8*p;
  Uint16 pitch=screen->pitch;
334
335
336
337
338
339
340


341
  if(v=xrm_get_resource(resourcedb,optionquery,optionquery,2)) {
    w=strtol(v,(void*)&v,10);
    h=strtol(v,0,10);
    SDL_EnableKeyRepeat(w,h);
  } else {
    SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY,SDL_DEFAULT_REPEAT_INTERVAL);
  }


}







>
>

352
353
354
355
356
357
358
359
360
361
  if(v=xrm_get_resource(resourcedb,optionquery,optionquery,2)) {
    w=strtol(v,(void*)&v,10);
    h=strtol(v,0,10);
    SDL_EnableKeyRepeat(w,h);
  } else {
    SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY,SDL_DEFAULT_REPEAT_INTERVAL);
  }
  optionquery[1]=Q_margin;
  left_margin=strtol(xrm_get_resource(resourcedb,optionquery,optionquery,2)?:"65",0,10);
}