mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-13 09:52:01 -04:00
improved death screen, fix some bugs
This commit is contained in:
parent
e40ba67a8d
commit
b9953f2d5b
10 changed files with 159 additions and 50 deletions
|
@ -239,6 +239,7 @@ void chveni(int i)
|
||||||
|
|
||||||
void objekty_mimo(THE_TIMER *t)
|
void objekty_mimo(THE_TIMER *t)
|
||||||
{
|
{
|
||||||
|
if (cur_mode == MD_END_GAME) return;
|
||||||
schovej_mysku();
|
schovej_mysku();
|
||||||
ukaz_kompas(1);
|
ukaz_kompas(1);
|
||||||
anim_sipky(0,0);
|
anim_sipky(0,0);
|
||||||
|
@ -1304,6 +1305,26 @@ void debug_print()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void death_screen() {
|
||||||
|
trans_bar(0, 0, 640, 480, 0);
|
||||||
|
int xs;
|
||||||
|
int ys;
|
||||||
|
int y = 160;
|
||||||
|
const char *t = texty[65];
|
||||||
|
char buff[strlen(t)+4];
|
||||||
|
set_font(H_FBOLD, RGB555_ALPHA(31,31,31));
|
||||||
|
zalamovani(t,buff, 440, &xs, &ys);
|
||||||
|
t = buff;
|
||||||
|
while (*t) {
|
||||||
|
set_aligned_position(320, y, 1, 1, t);
|
||||||
|
outtext(t);
|
||||||
|
y+=2*text_height(t);
|
||||||
|
t = t+strlen(t)+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void redraw_scene()
|
void redraw_scene()
|
||||||
{
|
{
|
||||||
if (norefresh) return;
|
if (norefresh) return;
|
||||||
|
@ -1318,9 +1339,13 @@ void redraw_scene()
|
||||||
if (battle || (game_extras & EX_ALWAYS_MINIMAP)) draw_medium_map();
|
if (battle || (game_extras & EX_ALWAYS_MINIMAP)) draw_medium_map();
|
||||||
if (show_debug) debug_print();
|
if (show_debug) debug_print();
|
||||||
other_draw();
|
other_draw();
|
||||||
|
if (cur_mode == MD_END_GAME) {
|
||||||
|
death_screen();
|
||||||
|
}
|
||||||
ukaz_mysku();
|
ukaz_mysku();
|
||||||
global_anim_counter++;
|
global_anim_counter++;
|
||||||
send_message(E_KOUZLO_ANM);
|
send_message(E_KOUZLO_ANM);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void refresh_scene(THE_TIMER *t)
|
void refresh_scene(THE_TIMER *t)
|
||||||
|
|
|
@ -624,6 +624,19 @@ static int process_actions(const char *command) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (istrcmp(command, "dispel-magic") == 0) {
|
||||||
|
unaffect();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (istrcmp(command, "echoes-of-the-past") == 0) {
|
||||||
|
const char *lname = local_strdup(level_fname);
|
||||||
|
leave_current_map();
|
||||||
|
temp_storage_delete(lname);
|
||||||
|
load_map(lname);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -651,6 +664,9 @@ static void wiz_find_monster(const char *name) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int process_with_params(const char *cmd, const char *args) {
|
static int process_with_params(const char *cmd, const char *args) {
|
||||||
if (istrcmp(cmd, "locate") == 0) {
|
if (istrcmp(cmd, "locate") == 0) {
|
||||||
if (args[0] == 0) return 0;
|
if (args[0] == 0) return 0;
|
||||||
|
@ -669,8 +685,31 @@ static int process_with_params(const char *cmd, const char *args) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} if (args[0] == 'm') {
|
||||||
|
char *end;
|
||||||
|
unsigned long id = strtoul(args+1, &end, 10);
|
||||||
|
if (*end == 0) {
|
||||||
|
ablock(H_ENEMY);
|
||||||
|
size_t cnt = get_handle_size(H_ENEMY)/sizeof(TMOB);
|
||||||
|
if (id < cnt) {
|
||||||
|
int choosen_id = -1;
|
||||||
|
for (int i = 0; i < MAX_MOBS; ++i) {
|
||||||
|
if (mobs[i].vlajky & MOB_LIVE) continue;
|
||||||
|
choosen_id = i;
|
||||||
}
|
}
|
||||||
|
if (choosen_id >= 0) {
|
||||||
|
const TMOB *t =(TMOB *)ablock(H_ENEMY);
|
||||||
|
int sect = map_sectors[viewsector].step_next[viewdir];
|
||||||
|
if (sect) {
|
||||||
|
load_enemy_to_map(choosen_id, sect, (viewdir+2) & 3, t+id);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (istrcmp(cmd, "say") == 0) {
|
if (istrcmp(cmd, "say") == 0) {
|
||||||
|
|
32
game/enemy.c
32
game/enemy.c
|
@ -54,7 +54,7 @@ char going[]={0,0,1,0,1,1};
|
||||||
|
|
||||||
static word *mob_paths[MAX_MOBS];
|
static word *mob_paths[MAX_MOBS];
|
||||||
static word *mob_path_ptr[MAX_MOBS];
|
static word *mob_path_ptr[MAX_MOBS];
|
||||||
static int monster_block;
|
static int monster_block = 0;
|
||||||
|
|
||||||
void *sound_template=NULL;
|
void *sound_template=NULL;
|
||||||
|
|
||||||
|
@ -2261,3 +2261,33 @@ void regen_all_mobs()
|
||||||
m->lives=m->vlastnosti[VLS_MAXHIT];
|
m->lives=m->vlastnosti[VLS_MAXHIT];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void load_enemy_to_map(int i, int sector, int dir, const TMOB *t) {
|
||||||
|
mobs[i]=*t;
|
||||||
|
if (~mobs[i].vlajky & MOB_MOBILE) mob_map[ sector]=i+MOB_START;
|
||||||
|
if (mobs[i].palette>0)mobs[i].palette=rnd(mobs[i].palette);else mobs[i].palette=abs(mobs[i].palette);
|
||||||
|
mobs[i].sector=sector;
|
||||||
|
mobs[i].dir=dir;
|
||||||
|
mobs[i].home_pos=sector;
|
||||||
|
mobs[i].vlajky|=MOB_LIVE;
|
||||||
|
|
||||||
|
char s[20];
|
||||||
|
|
||||||
|
sprintf(s,"%s.SEQ",mobs[i].mobs_name);
|
||||||
|
int h = find_handle(s, NULL);
|
||||||
|
int *grptr = &h;
|
||||||
|
if (h == -1) {
|
||||||
|
grptr = &end_ptr;
|
||||||
|
def_handle(grptr[0]++,s,NULL,SR_ENEMIES);
|
||||||
|
mobs[i].cislo_vzoru=*grptr-monster_block;
|
||||||
|
register_mob_graphics(*grptr,mobs[i].mobs_name,mobs[i].anim_counts,ablock(grptr[0]-1));
|
||||||
|
grptr[0]+=6*16;
|
||||||
|
register_mob_sounds(*grptr,mobs[i].sounds);
|
||||||
|
grptr[0]+=4;
|
||||||
|
sprintf(s,"%s.COL",mobs[i].mobs_name);
|
||||||
|
def_handle(grptr[0],s,col_load,SR_ENEMIES);
|
||||||
|
grptr[0]++;
|
||||||
|
} else {
|
||||||
|
mobs[i].cislo_vzoru=(h+1)-monster_block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -652,7 +652,7 @@ extern char marker; //tato promenna je 0, jen v pripade ze je 1 probehne assert
|
||||||
|
|
||||||
void game_keyboard(EVENT_MSG *msg,void **usr);
|
void game_keyboard(EVENT_MSG *msg,void **usr);
|
||||||
void calc_animations(void);
|
void calc_animations(void);
|
||||||
int load_map(char *filename);
|
int load_map(const char *filename);
|
||||||
void other_draw(void);
|
void other_draw(void);
|
||||||
void refresh_scene(THE_TIMER *t);
|
void refresh_scene(THE_TIMER *t);
|
||||||
const void *pcx_fade_decomp(const void *p, int32_t *s);
|
const void *pcx_fade_decomp(const void *p, int32_t *s);
|
||||||
|
@ -848,8 +848,8 @@ void draw_placed_items_normal(int celx,int cely,int sect,int side);
|
||||||
#define SPL_TVAR 0x4 //hrac ma kouzlo nastav tvar
|
#define SPL_TVAR 0x4 //hrac ma kouzlo nastav tvar
|
||||||
#define SPL_DRAIN 0x8 //hrac kazdym utokem drainuje nepritele
|
#define SPL_DRAIN 0x8 //hrac kazdym utokem drainuje nepritele
|
||||||
#define SPL_MANASHIELD 0x10 //hrac je chranen stitem z many
|
#define SPL_MANASHIELD 0x10 //hrac je chranen stitem z many
|
||||||
#define SPL_SANC 0x20 //hraci je kazde zraneni snizeno na polovic
|
#define SPL_SANC 0x20 //resistance to fyzical attack
|
||||||
#define SPL_HSANC 0x40 //hrac nikdy nedostane zraneni vetsi nez 18
|
#define SPL_HSANC 0x40 //resistance to all attack
|
||||||
#define SPL_BLIND 0x80 //hrac je slepy
|
#define SPL_BLIND 0x80 //hrac je slepy
|
||||||
#define SPL_REGEN 0x100 //hrac ma regeneraci pri boji
|
#define SPL_REGEN 0x100 //hrac ma regeneraci pri boji
|
||||||
#define SPL_ICE_RES 0x200 //hrac je chranen proti ledu
|
#define SPL_ICE_RES 0x200 //hrac je chranen proti ledu
|
||||||
|
@ -1826,7 +1826,7 @@ char generate_string_tables(const char *path);
|
||||||
|
|
||||||
char *change_extension_support(char *buffer, const char *filename,char *new_extension);
|
char *change_extension_support(char *buffer, const char *filename,char *new_extension);
|
||||||
#define set_file_extension(filename, extension) change_extension_support((char *)alloca(strlen(filename)+strlen(extension)), (filename), (extension))
|
#define set_file_extension(filename, extension) change_extension_support((char *)alloca(strlen(filename)+strlen(extension)), (filename), (extension))
|
||||||
|
void load_enemy_to_map(int i, int sector, int dir, const TMOB *t);
|
||||||
|
|
||||||
|
|
||||||
//extras
|
//extras
|
||||||
|
|
|
@ -134,9 +134,19 @@ void add_window(int x,int y,int xs,int ys,int texture,int border,int txtx,int tx
|
||||||
void zalamovani(const char *source,char *target,int maxxs,int *xs,int *ys)
|
void zalamovani(const char *source,char *target,int maxxs,int *xs,int *ys)
|
||||||
{
|
{
|
||||||
strcpy(target,source);
|
strcpy(target,source);
|
||||||
|
char *x = target;
|
||||||
|
while (*x) {
|
||||||
|
if (*x == '\n') *x = 0;
|
||||||
|
++x;
|
||||||
|
}
|
||||||
|
++x;
|
||||||
|
*x = 0;
|
||||||
xs[0]=0;
|
xs[0]=0;
|
||||||
ys[0]=0;
|
ys[0]=0;
|
||||||
if ((xs[0]=text_width(target))>maxxs)
|
x = target;
|
||||||
|
while (*x) {
|
||||||
|
char *nextx = x + strlen(x)+1;
|
||||||
|
if ((xs[0]=text_width(x))>maxxs)
|
||||||
{
|
{
|
||||||
char c[2]=" ";
|
char c[2]=" ";
|
||||||
char *ls,*ps,*cs;
|
char *ls,*ps,*cs;
|
||||||
|
@ -152,6 +162,7 @@ void zalamovani(const char *source,char *target,int maxxs,int *xs,int *ys)
|
||||||
c[0]=*ps++;
|
c[0]=*ps++;
|
||||||
if (c[0]==0) {ls=NULL;break;}
|
if (c[0]==0) {ls=NULL;break;}
|
||||||
if (c[0]==32) ls=ps-1;
|
if (c[0]==32) ls=ps-1;
|
||||||
|
if (c[0]=='\n') {ls = ps-1;break;}
|
||||||
sum+=text_width(c);
|
sum+=text_width(c);
|
||||||
}
|
}
|
||||||
if (ls!=NULL)
|
if (ls!=NULL)
|
||||||
|
@ -168,10 +179,11 @@ void zalamovani(const char *source,char *target,int maxxs,int *xs,int *ys)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char *c;
|
ys[0]+=text_height(x);
|
||||||
c=target;c=strchr(c,0);c++;*c=0;
|
|
||||||
ys[0]=text_height(target);
|
|
||||||
}
|
}
|
||||||
|
x = nextx;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static T_CLK_MAP message_win[]=
|
static T_CLK_MAP message_win[]=
|
||||||
|
|
|
@ -2055,6 +2055,7 @@ static char check_double_wield() {
|
||||||
if (!i1 || !i2) return 0;
|
if (!i1 || !i2) return 0;
|
||||||
const TITEM *it1 = glob_items+i1;
|
const TITEM *it1 = glob_items+i1;
|
||||||
const TITEM *it2 = glob_items+i2;
|
const TITEM *it2 = glob_items+i2;
|
||||||
|
if (it1->typ_zbrane!=TYP_UTOC || it2->typ_zbrane!=TYP_UTOC ) return 0;
|
||||||
for (int i = VLS_SILA; i <=VLS_OBRAT; ++i) {
|
for (int i = VLS_SILA; i <=VLS_OBRAT; ++i) {
|
||||||
if ((it1->podminky[i] + it2->podminky[i] > human_selected->vlastnosti[i])
|
if ((it1->podminky[i] + it2->podminky[i] > human_selected->vlastnosti[i])
|
||||||
&& (MAX(it1->podminky[i], it2->podminky[i]) > human_selected->vlastnosti[VLS_OBRAT])) {
|
&& (MAX(it1->podminky[i], it2->podminky[i]) > human_selected->vlastnosti[VLS_OBRAT])) {
|
||||||
|
|
|
@ -278,18 +278,20 @@ static char read_set(TMPFILE_RD *txt,char *var,char *set)
|
||||||
int c;
|
int c;
|
||||||
char *cc;
|
char *cc;
|
||||||
char d;
|
char d;
|
||||||
|
char e;
|
||||||
|
|
||||||
temp_storage_scanf(txt,"%[^=]%c",var,&d);
|
temp_storage_scanf(txt,"%[^=]%c",var,&d);
|
||||||
do
|
do
|
||||||
c=temp_storage_getc(txt);
|
c=temp_storage_getc(txt);
|
||||||
while (c<33);
|
while (c<33);
|
||||||
if (c=='"') temp_storage_scanf(txt,"%[^\"]%c%c",set,&d,&c);
|
if (c=='"') temp_storage_scanf(txt,"%[^\"]%c%c",set,&d,&e);
|
||||||
else if (c=='\'') temp_storage_scanf(txt,"%[^']%c%c",set,&d,&c);
|
else if (c=='\'') temp_storage_scanf(txt,"%[^']%c%c",set,&d,&e);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
temp_storage_ungetc(txt);
|
temp_storage_ungetc(txt);
|
||||||
temp_storage_scanf(txt,"%[^> ]%c",set,&c);
|
temp_storage_scanf(txt,"%[^> ]%c",set,&e);
|
||||||
}
|
}
|
||||||
|
c = e;
|
||||||
while(c<33 && c!=EOF) c=temp_storage_getc(txt);
|
while(c<33 && c!=EOF) c=temp_storage_getc(txt);
|
||||||
if (c!='>') temp_storage_ungetc(txt);
|
if (c!='>') temp_storage_ungetc(txt);
|
||||||
cc=strchr(var,0);
|
cc=strchr(var,0);
|
||||||
|
|
|
@ -1468,7 +1468,8 @@ void call_spell(int i)
|
||||||
c+=p->start;
|
c+=p->start;
|
||||||
twins=0;
|
twins=0;
|
||||||
do {
|
do {
|
||||||
switch (twins = twins == 3 ? 0 : twins, *c++) {
|
twins = twins == 3 ? 0 : twins;
|
||||||
|
switch (*c++) {
|
||||||
case S_zivel:
|
case S_zivel:
|
||||||
p->pc = GET_WORD(c)
|
p->pc = GET_WORD(c)
|
||||||
;
|
;
|
||||||
|
|
|
@ -187,7 +187,7 @@ const char *find_map_from_hash_impl(char *c, uint32_t h, int sz) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int load_map(char *filename)
|
int load_map(const char *filename)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
void *temp;
|
void *temp;
|
||||||
|
|
|
@ -557,7 +557,7 @@ static int vyber_hrace(int att) {
|
||||||
for (int i = POCET_POSTAV; i>0;) {
|
for (int i = POCET_POSTAV; i>0;) {
|
||||||
--i;
|
--i;
|
||||||
h = postavy+i;
|
h = postavy+i;
|
||||||
if (h->used && h->inmaphash == current_map_hash) {
|
if (h->used && h->lives && h->inmaphash == current_map_hash) {
|
||||||
candidate0 = i;
|
candidate0 = i;
|
||||||
if (h->groupnum == gr) {
|
if (h->groupnum == gr) {
|
||||||
candidate1 =i;
|
candidate1 =i;
|
||||||
|
@ -750,8 +750,8 @@ void wire_end_game()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bott_disp_text(texty[65]);
|
/* bott_disp_text(texty[65]);
|
||||||
bott_text_forever();
|
bott_text_forever();*/
|
||||||
add_to_timer(TM_SCENE,gamespeed,-1,refresh_scene);
|
add_to_timer(TM_SCENE,gamespeed,-1,refresh_scene);
|
||||||
add_to_timer(TM_FLY,gamespeed,-1,calc_fly);
|
add_to_timer(TM_FLY,gamespeed,-1,calc_fly);
|
||||||
disable_click_map();
|
disable_click_map();
|
||||||
|
@ -2460,7 +2460,6 @@ char player_check_death(THUMAN *p, char afterround)
|
||||||
}
|
}
|
||||||
p->groupnum=0;
|
p->groupnum=0;
|
||||||
p->lives=0;
|
p->lives=0;
|
||||||
if (p->level>1) p->exp=level_map[p->level-2];
|
|
||||||
p->kondice=0;
|
p->kondice=0;
|
||||||
p->mana=0;
|
p->mana=0;
|
||||||
SEND_LOG("(GAME) Character '%s' died. R.I.P.",p->jmeno);
|
SEND_LOG("(GAME) Character '%s' died. R.I.P.",p->jmeno);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue