mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-13 09:52:01 -04:00
fix summon enemies
This commit is contained in:
parent
9a3641cf03
commit
7aaeccd1c3
5 changed files with 29 additions and 7 deletions
14
game/enemy.c
14
game/enemy.c
|
@ -944,7 +944,7 @@ TENEMY_FACE get_enemy_face(TMOB *p,int dirmob,int action,int curdir)
|
||||||
}
|
}
|
||||||
if (pos==3) ret.mirror=pos=1;
|
if (pos==3) ret.mirror=pos=1;
|
||||||
if (p->anim_counter==-1) view=pos*16;
|
if (p->anim_counter==-1) view=pos*16;
|
||||||
else view=pos*16+(p->anim_counter % p->anim_counts[pos])+1;
|
else view=pos*16+(p->anim_counter % (MAX(p->anim_counts[pos],1)))+1;
|
||||||
ret.face = view;
|
ret.face = view;
|
||||||
ret.pos = pos;
|
ret.pos = pos;
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -2308,6 +2308,16 @@ void regen_all_mobs()
|
||||||
|
|
||||||
|
|
||||||
void load_enemy_to_map(int i, int sector, int dir, const TMOB *t) {
|
void load_enemy_to_map(int i, int sector, int dir, const TMOB *t) {
|
||||||
|
|
||||||
|
char can_save = 0;
|
||||||
|
for (int x = 0; x<MAX_MOBS; ++x) {
|
||||||
|
if (strcmp(t->mobs_name, mobs[x].mobs_name) == 0 && !(mobs[x].vlajky2 & MOB_F2_DONT_SAVE)) {
|
||||||
|
can_save = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
mobs[i]=*t;
|
mobs[i]=*t;
|
||||||
if (~mobs[i].vlajky & MOB_MOBILE) mob_map[ sector]=i+MOB_START;
|
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);
|
if (mobs[i].palette>0)mobs[i].palette=rnd(mobs[i].palette);else mobs[i].palette=abs(mobs[i].palette);
|
||||||
|
@ -2315,6 +2325,8 @@ void load_enemy_to_map(int i, int sector, int dir, const TMOB *t) {
|
||||||
mobs[i].dir=dir;
|
mobs[i].dir=dir;
|
||||||
mobs[i].home_pos=sector;
|
mobs[i].home_pos=sector;
|
||||||
mobs[i].vlajky|=MOB_LIVE;
|
mobs[i].vlajky|=MOB_LIVE;
|
||||||
|
if (!can_save) mobs[i].vlajky2|=MOB_F2_DONT_SAVE;
|
||||||
|
|
||||||
|
|
||||||
char s[20];
|
char s[20];
|
||||||
|
|
||||||
|
|
|
@ -360,7 +360,7 @@ int save_map_state() //uklada stav mapy pro savegame (neuklada aktualni pozici);
|
||||||
}
|
}
|
||||||
i=-1;
|
i=-1;
|
||||||
temp_storage_write(&i,sizeof(i),fsta);
|
temp_storage_write(&i,sizeof(i),fsta);
|
||||||
for(i=0;i<MAX_MOBS;i++) if (mobs[i].vlajky & MOB_LIVE)
|
for(i=0;i<MAX_MOBS;i++) if ((mobs[i].vlajky & MOB_LIVE) && !(mobs[i].vlajky2 & MOB_F2_DONT_SAVE))
|
||||||
{
|
{
|
||||||
temp_storage_write(&i,sizeof(i),fsta);
|
temp_storage_write(&i,sizeof(i),fsta);
|
||||||
temp_storage_write(mobs+i,sizeof(TMOB),fsta); //save_mobmap
|
temp_storage_write(mobs+i,sizeof(TMOB),fsta); //save_mobmap
|
||||||
|
@ -447,8 +447,11 @@ int load_map_state_ex(const char *level_fname, int mapsize, char partial)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(i=0;i<MAX_MOBS;(mobs[i].vlajky &=~MOB_LIVE),i++);
|
for(i=0;i<MAX_MOBS;(mobs[i].vlajky &=~MOB_LIVE),i++);
|
||||||
while (temp_storage_read(&i,sizeof(i),fsta) && i>=0 && i<=MAX_MOBS)
|
while (temp_storage_read(&i,sizeof(i),fsta) && i>=0 && i<=MAX_MOBS) {
|
||||||
if (temp_storage_read(mobs+i,1*sizeof(TMOB),fsta)!=sizeof(TMOB)) goto err;
|
if (temp_storage_read(mobs+i,1*sizeof(TMOB),fsta)!=sizeof(TMOB)) goto err;
|
||||||
|
mobs[i].vlajky2 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
for(i=0;i<MAX_MOBS;i++) mobs[i].vlajky &=~MOB_IN_BATTLE;
|
for(i=0;i<MAX_MOBS;i++) mobs[i].vlajky &=~MOB_IN_BATTLE;
|
||||||
refresh_mob_map();
|
refresh_mob_map();
|
||||||
|
|
|
@ -1470,7 +1470,6 @@ void unwire_main_functs(void);
|
||||||
#define MAX_MOBS 255
|
#define MAX_MOBS 255
|
||||||
|
|
||||||
|
|
||||||
#define MOB_IN_BATTLE 0x1
|
|
||||||
#define MOB_ATTACKING 0x2
|
#define MOB_ATTACKING 0x2
|
||||||
#define MOB_TO_HIT 0x4
|
#define MOB_TO_HIT 0x4
|
||||||
#define MOB_DEATH 0x5
|
#define MOB_DEATH 0x5
|
||||||
|
@ -1484,13 +1483,18 @@ void unwire_main_functs(void);
|
||||||
#define MOB_PICK 0x20
|
#define MOB_PICK 0x20
|
||||||
#define MOB_PICKING 0x40
|
#define MOB_PICKING 0x40
|
||||||
#define MOB_ROGUE 0x80
|
#define MOB_ROGUE 0x80
|
||||||
#define MOB_SENSE 0x4
|
//vlajky
|
||||||
|
#define MOB_IN_BATTLE 0x1
|
||||||
#define MOB_PASSABLE 0x2
|
#define MOB_PASSABLE 0x2
|
||||||
|
#define MOB_SENSE 0x4
|
||||||
#define MOB_MOBILE 0x8
|
#define MOB_MOBILE 0x8
|
||||||
#define MOB_RELOAD 0x10
|
#define MOB_RELOAD 0x10
|
||||||
|
#define MOB_CASTING 0x20
|
||||||
#define MOB_SAMPLE_LOOP 0x40
|
#define MOB_SAMPLE_LOOP 0x40
|
||||||
#define MOB_LIVE 0x80 //potvora zije
|
#define MOB_LIVE 0x80 //potvora zije
|
||||||
#define MOB_CASTING 0x20
|
|
||||||
|
//vlajky2
|
||||||
|
#define MOB_F2_DONT_SAVE 0x1
|
||||||
|
|
||||||
typedef struct tmob
|
typedef struct tmob
|
||||||
{
|
{
|
||||||
|
@ -1514,6 +1518,7 @@ typedef struct tmob
|
||||||
char flee_num; //pravdepodobnost uteku
|
char flee_num; //pravdepodobnost uteku
|
||||||
char anim_counts[6]; //pocet animacnich policek pro kazdy pohyb
|
char anim_counts[6]; //pocet animacnich policek pro kazdy pohyb
|
||||||
char mobs_name[7]; //zaklad jmena souboru pro moba
|
char mobs_name[7]; //zaklad jmena souboru pro moba
|
||||||
|
char vlajky2; //vlajky pro summon z konzoli (BIT0 - neukladat)
|
||||||
int32_t experience; //zkusenost
|
int32_t experience; //zkusenost
|
||||||
char vlajky; //BIT0 - 1 v boji
|
char vlajky; //BIT0 - 1 v boji
|
||||||
char anim_phase; //cinnost kterou mob dela
|
char anim_phase; //cinnost kterou mob dela
|
||||||
|
|
|
@ -399,6 +399,7 @@ const void *load_mob_legacy_format(const void *p, int32_t *s) {
|
||||||
nx = sizeof(TMOB);
|
nx = sizeof(TMOB);
|
||||||
memmove(d, c, nx - ofs - 1); //last padding 1
|
memmove(d, c, nx - ofs - 1); //last padding 1
|
||||||
c+=nx - ofs - 1;
|
c+=nx - ofs - 1;
|
||||||
|
m->vlajky2 = 0;
|
||||||
}
|
}
|
||||||
*s = count * sizeof(TMOB);
|
*s = count * sizeof(TMOB);
|
||||||
return out;
|
return out;
|
||||||
|
|
|
@ -556,6 +556,7 @@ void play_sample_at_sector(int sample,int listener,int source,int track, char lo
|
||||||
{
|
{
|
||||||
alock(sample);
|
alock(sample);
|
||||||
s=ablock(sample);
|
s=ablock(sample);
|
||||||
|
if (!s) return;
|
||||||
p=(struct t_wave *)s;
|
p=(struct t_wave *)s;
|
||||||
s+=sizeof(struct t_wave);
|
s+=sizeof(struct t_wave);
|
||||||
siz=*(int *)s;s+=4;
|
siz=*(int *)s;s+=4;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue