Free Hero Mesh

Check-in [d308a8c8ca]
Login
This is a mirror of the main repository for Free Hero Mesh. New tickets and changes will not be accepted at this mirror.
Overview
Comment:Implement displaying the replay list
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d308a8c8cad2b7acb1ba1b12bc22c5a9a3eae316
User & Date: user on 2021-01-05 07:12:23
Other Links: manifest | tags
Context
2021-01-05
19:20
Write more in class.doc check-in: 01f32e4d01 user: user tags: trunk
07:12
Implement displaying the replay list check-in: d308a8c8ca user: user tags: trunk
06:39
Add the rest of the key code icons check-in: d01ca44575 user: user tags: trunk
Changes

Modified game.c from [271271dcf7] to [8e4e41abe4].

101
102
103
104
105
106
107










108
109
110
111
112
113
114
115
116
117
    for(y=0;y<ninventory;y++) {
      if(y*picture_size+60>=screen->h) break;
      if(classes[inventory[y].class]->nimages<inventory[y].image) continue;
      draw_picture(0,y*picture_size+52,classes[inventory[y].class]->images[inventory[y].image]&0x7FFF);
    }
  } else {
    // Move list










    
    SDL_UnlockSurface(screen);
    
  }
  if(quiz_text) draw_popup(quiz_text);
  SDL_Flip(screen);
  set_cursor(XC_arrow);
}

static void continue_animation(void) {







>
>
>
>
>
>
>
>
>
>
|

<







101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119

120
121
122
123
124
125
126
    for(y=0;y<ninventory;y++) {
      if(y*picture_size+60>=screen->h) break;
      if(classes[inventory[y].class]->nimages<inventory[y].image) continue;
      draw_picture(0,y*picture_size+52,classes[inventory[y].class]->images[inventory[y].image]&0x7FFF);
    }
  } else {
    // Move list
    snprintf(buf,8,"%5d",replay_pos);
    draw_text(8,52,buf,0xF0,0xF9);
    snprintf(buf,8,"%5d",replay_count);
    draw_text(8,screen->h-8,buf,0xF0,0xFC);
    for(y=44,x=replay_pos-(screen->h-68)/32;;x++) {
      y+=16;
      if(y+24>screen->h) break;
      if(x>=0 && x<replay_count) draw_key(16,y,replay_list[x],0xF8,0xFB);
      if(x==replay_pos) draw_text(0,y,"~~",0xF0,0xFE);
      if(x==replay_mark) draw_text(32,y,"~~",0xF0,0xFD);
    }
    SDL_UnlockSurface(screen);

  }
  if(quiz_text) draw_popup(quiz_text);
  SDL_Flip(screen);
  set_cursor(XC_arrow);
}

static void continue_animation(void) {

Modified heromesh.h from [4bcb7663f0] to [97fa5dbd0e].

88
89
90
91
92
93
94

95
96
97
98
99
100
101

// Use only when screen is unlocked
void draw_picture(int x,int y,Uint16 img);
void draw_cell(int x,int y);

// Use only when screen is locked
void draw_text(int x,int y,const unsigned char*t,int bg,int fg);


const char*screen_prompt(const char*txt);
int screen_message(const char*txt);
void load_pictures(void);

int scrollbar(int*cur,int page,int max,SDL_Event*ev,SDL_Rect*re);








>







88
89
90
91
92
93
94
95
96
97
98
99
100
101
102

// Use only when screen is unlocked
void draw_picture(int x,int y,Uint16 img);
void draw_cell(int x,int y);

// Use only when screen is locked
void draw_text(int x,int y,const unsigned char*t,int bg,int fg);
void draw_key(int x,int y,int k,int bg,int fg);

const char*screen_prompt(const char*txt);
int screen_message(const char*txt);
void load_pictures(void);

int scrollbar(int*cur,int page,int max,SDL_Event*ev,SDL_Rect*re);

Modified picture.c from [ba28d43d0a] to [f5de034dcf].

15
16
17
18
19
20
21

22
23
24
25
26
27
28
#include <string.h>
#include "sqlite3.h"
#include "smallxrm.h"
#include "pcfont.h"
#include "quarks.h"
#include "heromesh.h"
#include "cursorshapes.h"


SDL_Surface*screen;
Uint16 picture_size;
int left_margin;

static SDL_Surface*picts;
static Uint8*curpic;







>







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <string.h>
#include "sqlite3.h"
#include "smallxrm.h"
#include "pcfont.h"
#include "quarks.h"
#include "heromesh.h"
#include "cursorshapes.h"
#include "keyicons.xbm"

SDL_Surface*screen;
Uint16 picture_size;
int left_margin;

static SDL_Surface*picts;
static Uint8*curpic;
130
131
132
133
134
135
136


















137
138
139
140
141
142
143
      ++f;
    }
    t++;
    if(!--len) return;
    pix+=8;
  }
}



















const char*screen_prompt(const char*txt) {
  static char*t=0;
  int n=0;
  SDL_Rect r={0,0,screen->w,16};
  int m=r.w>>3;
  SDL_Event ev;







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







131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
      ++f;
    }
    t++;
    if(!--len) return;
    pix+=8;
  }
}

void draw_key(int x,int y,int k,int bg,int fg) {
  // To be called only when screen is locked!
  Uint8*p=screen->pixels;
  Uint16 pitch=screen->pitch;
  int xx,yy;
  const unsigned char*f;
  if(x<0 || y<0 || x+16>screen->w || y+16>screen->h) return;
  p+=y*pitch+x;
  f=keyicons_bits+(k<<5);
  for(yy=0;yy<16;yy++) {
    for(xx=0;xx<8;xx++) p[xx]=(*f>>xx)&1?fg:bg;
    ++f;
    for(xx=0;xx<8;xx++) p[xx+8]=(*f>>xx)&1?fg:bg;
    p+=pitch;
    ++f;
  }
}

const char*screen_prompt(const char*txt) {
  static char*t=0;
  int n=0;
  SDL_Rect r={0,0,screen->w,16};
  int m=r.w>>3;
  SDL_Event ev;