mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-13 09:52:01 -04:00
Merge branch 'main' of https://github.com/ondra-novak/gates_of_skeldal
This commit is contained in:
commit
075100d2ce
8 changed files with 115 additions and 32 deletions
|
@ -795,8 +795,8 @@ static void console_keyboard(EVENT_MSG *msg, void **_) {
|
|||
case 'Q': console_top_line = MAX(0, console_top_line-10);break;
|
||||
case 'H': console_top_line = MIN(console_max_lines-10, console_top_line+1);break;
|
||||
case 'P': console_top_line = MAX(0, console_top_line-1);break;
|
||||
case 'G': console_top_line = console_max_characters-10;
|
||||
case 'O': console_top_line = 0;
|
||||
case 'G': console_top_line = console_max_characters-10;break;
|
||||
case 'O': console_top_line = 0;break;
|
||||
default: return;
|
||||
}
|
||||
msg->msg = -1;
|
||||
|
|
|
@ -1450,10 +1450,11 @@ void mob_strelba(TMOB *p)
|
|||
spell_throw(-((p-mobs)+1),i);
|
||||
letici_veci->flags &=~FLY_DESTROY;
|
||||
int att = p->vlastnosti[VLS_OBRAT]/5;
|
||||
letici_veci->hit_bonus=p->vlastnosti[VLS_UTOK_L]+rnd(p->vlastnosti[VLS_UTOK_H]-p->vlastnosti[VLS_UTOK_L]+1) + att;
|
||||
int attack_roll = p->vlastnosti[VLS_UTOK_L]+rnd(p->vlastnosti[VLS_UTOK_H]-p->vlastnosti[VLS_UTOK_L]+1);
|
||||
letici_veci->hit_bonus= attack_roll + att;
|
||||
if (log_combat) {
|
||||
wzprintf("%s shoots: %d (roll %d-%d) + %d (%s/5) = %d\n",
|
||||
p->vlastnosti[VLS_UTOK_L],p->vlastnosti[VLS_UTOK_H],att,texty[13],letici_veci->hit_bonus);
|
||||
p->name, attack_roll, p->vlastnosti[VLS_UTOK_L],p->vlastnosti[VLS_UTOK_H],att,texty[13],letici_veci->hit_bonus);
|
||||
}
|
||||
letici_veci->damage=p->vlastnosti[VLS_DAMAGE];
|
||||
p->dostal=0;
|
||||
|
@ -2183,7 +2184,7 @@ static void knock_mob_back(TMOB *mm,int dir)
|
|||
const TITEM *it = glob_items + itnum-1;
|
||||
if (it->druh != TYP_UTOC) return;
|
||||
int vls[] = {VLS_MGSIL_H,VLS_MGSIL_L,VLS_UTOK_H,VLS_UTOK_L,VLS_DAMAGE};
|
||||
for (int i = 0; i < countof(vls); ++i) {
|
||||
for (size_t i = 0; i < countof(vls); ++i) {
|
||||
vlastnosti[vls[i]] -= it->zmeny[vls[i]];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -874,7 +874,7 @@ static int last_select=-1;
|
|||
static TSTR_LIST story_text=NULL;
|
||||
static void *back_texture=NULL;
|
||||
static int cur_story_pos=0;
|
||||
static char load_mode;
|
||||
//static char load_mode;
|
||||
|
||||
#define SLOT_SPACE 33
|
||||
#define SLOT_FONT H_FBOLD
|
||||
|
@ -994,6 +994,7 @@ static int dedup_strings_prefix(TSTR_LIST lst, int count) {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
static void load_specific_file(int slot_num,char *filename,void **out,int32_t *size) //call it in task!
|
||||
{
|
||||
FILE *slot;
|
||||
|
@ -1022,6 +1023,31 @@ static void load_specific_file(int slot_num,char *filename,void **out,int32_t *s
|
|||
}
|
||||
fclose(slot);
|
||||
}
|
||||
*/
|
||||
static void load_specific_file(const char *filename,const char *name, void **out,int32_t *size) //call it in task!
|
||||
{
|
||||
FILE *slot;
|
||||
|
||||
|
||||
slot=fopen_icase(build_pathname(2, gpathtable[SR_SAVES], filename),"rb");
|
||||
if (slot==NULL)
|
||||
{
|
||||
*out=NULL;
|
||||
return;
|
||||
}
|
||||
fseek(slot,SAVE_NAME_SIZE,SEEK_CUR);
|
||||
|
||||
LOAD_SPECIFIC_FILE_CALLBACK_DATA ctx;
|
||||
ctx.name = name;
|
||||
|
||||
*out = NULL;
|
||||
*size = 0;
|
||||
if (enum_all_status(slot, &load_specific_file_callback, &ctx) == 0){
|
||||
*out = ctx.data;
|
||||
*size = ctx.size;
|
||||
}
|
||||
fclose(slot);
|
||||
}
|
||||
|
||||
|
||||
static TSAVEGAME_LIST get_all_savegames(unsigned long kampan) {
|
||||
|
@ -1147,7 +1173,7 @@ static void redraw_story_bar(int pos)
|
|||
ukaz_mysku();
|
||||
showview(x,STORY_Y+SCREEN_OFFLINE,STORY_XS,STORY_YS);
|
||||
}
|
||||
|
||||
/*
|
||||
static void read_story_task(va_list args)
|
||||
{
|
||||
int slot=va_arg(args,int);
|
||||
|
@ -1202,7 +1228,51 @@ static void read_story(int slot)
|
|||
if (slot!=-1)
|
||||
task_num=add_task(8196,read_story_task,slot);
|
||||
}
|
||||
*/
|
||||
|
||||
static void read_story(const char *filename) {
|
||||
void *text_data;
|
||||
int32_t size;
|
||||
TSTR_LIST ls;
|
||||
char *c,*d;
|
||||
|
||||
load_specific_file(filename,STORY_BOOK,&text_data,&size);
|
||||
if (text_data!=NULL)
|
||||
{
|
||||
ls=create_list(2);
|
||||
c=text_data;
|
||||
set_font(H_FONT6,0);
|
||||
while (size>0)
|
||||
{
|
||||
int xs,ys;
|
||||
d=c;
|
||||
while (size>0 && *d!='\r' && *d!='\n') {d++;size--;};
|
||||
if (!size) break;
|
||||
*d=0;
|
||||
{
|
||||
char *e,*or;
|
||||
or=e=getmem(strlen(c)+2);
|
||||
zalamovani(c,e,STORY_XS,&xs,&ys);
|
||||
while (*e)
|
||||
{
|
||||
str_add(&ls,e);
|
||||
if (text_width(e)>STORY_XS) abort();
|
||||
e=strchr(e,0)+1;
|
||||
}
|
||||
c=d+1;size--;
|
||||
if (size > 0 &&(*c=='\n' || *c=='\r')) {c++;size--;};
|
||||
free(or);
|
||||
}
|
||||
}
|
||||
free(text_data);
|
||||
}
|
||||
else ls=NULL;
|
||||
if (story_text!=NULL) release_list(story_text);
|
||||
story_text=ls;
|
||||
cur_story_pos=get_list_count();if (cur_story_pos<0) cur_story_pos=0;
|
||||
redraw_story_bar(cur_story_pos);
|
||||
|
||||
}
|
||||
|
||||
static int get_list_count()
|
||||
{
|
||||
|
@ -1506,7 +1576,6 @@ T_CLK_MAP clk_save[]=
|
|||
|
||||
static void select_slot(int i) {
|
||||
int rel = i-current_slot_list_top_line;
|
||||
char unbright = 1;
|
||||
while (rel < 0) {
|
||||
--current_slot_list_top_line;
|
||||
schovej_mysku();
|
||||
|
@ -1514,7 +1583,6 @@ static void select_slot(int i) {
|
|||
showview(0,0,0,0);
|
||||
ukaz_mysku();
|
||||
rel++;
|
||||
unbright = 0;
|
||||
}
|
||||
while (rel > SLOTS_MAX-1) {
|
||||
++current_slot_list_top_line;
|
||||
|
@ -1522,12 +1590,16 @@ static void select_slot(int i) {
|
|||
redraw_load();
|
||||
showview(0,0,0,0);
|
||||
ukaz_mysku();
|
||||
unbright = 0;
|
||||
rel--;
|
||||
}
|
||||
if (last_select != i) {
|
||||
if (last_select != -1) place_name(0,last_select-current_slot_list_top_line,1,0);
|
||||
place_name(0,i-current_slot_list_top_line,1,1);
|
||||
last_select = i;
|
||||
if (last_select != -1 && last_select < (int)current_game_slot_list.count) {
|
||||
read_story(current_game_slot_list.files[last_select]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void saveload_keyboard(EVENT_MSG *msg,void **_)
|
||||
|
@ -1539,7 +1611,7 @@ static void saveload_keyboard(EVENT_MSG *msg,void **_)
|
|||
{
|
||||
case 1:unwire_proc();wire_proc();break;
|
||||
case 'H':if (last_select>0) select_slot(last_select-1);break;
|
||||
case 'P':if (last_select<current_game_slot_list.count-1) select_slot(last_select+1);break;
|
||||
case 'P':if (last_select<(int)current_game_slot_list.count-1) select_slot(last_select+1);break;
|
||||
case 28:if (last_select>=0) load_save_pos_ingame(last_select);break;
|
||||
}
|
||||
}
|
||||
|
@ -1554,8 +1626,8 @@ static void saveload_keyboard_menu(EVENT_MSG *msg,void **_)
|
|||
{
|
||||
case 1:send_message(E_CLOSE_MAP,NULL);break;
|
||||
case 'H':if (last_select>0) select_slot(last_select-1);break;
|
||||
case 'P':if (last_select<current_game_slot_list.count-1) select_slot(last_select+1);break;
|
||||
case 28:if (last_select>= 0 && last_select < current_game_slot_list.count) {
|
||||
case 'P':if (last_select<(int)current_game_slot_list.count-1) select_slot(last_select+1);break;
|
||||
case 28:if (last_select>= 0 && last_select < (int)current_game_slot_list.count) {
|
||||
send_message(E_CLOSE_MAP, current_game_slot_list.files[last_select]);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -541,6 +541,7 @@ LETICI_VEC *create_fly()
|
|||
p->items=NULL;
|
||||
p->item=0;
|
||||
p->lives=0;
|
||||
p->anim_pos = 0;
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -1295,7 +1296,12 @@ void group_all(void)
|
|||
void destroy_player_map() //je nutne volat pred presunem postav
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<POCET_POSTAV;i++) map_coord[postavy[i].sektor].flags&=~(MC_DPLAYER | MC_SAFEPLACE);
|
||||
for(i=0;i<POCET_POSTAV;i++) {
|
||||
int s = postavy[i].sektor;
|
||||
if (s > 0 && s < mapsize) {
|
||||
map_coord[s].flags&=~(MC_DPLAYER | MC_SAFEPLACE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void build_player_map() //je nutne volat po presunu postav
|
||||
|
|
|
@ -378,17 +378,17 @@ const void *load_mob_legacy_format(const void *p, int32_t *s) {
|
|||
char *d = (char *)m;
|
||||
size_t ofs = 0;
|
||||
size_t nx = offsetof(TMOB,experience);
|
||||
memcpy(d, c, nx);
|
||||
memmove(d, c, nx);
|
||||
c+=nx-2; //first padding 2
|
||||
d+=nx;
|
||||
ofs=nx;
|
||||
nx = offsetof(TMOB, dialog_flags);
|
||||
memcpy(d, c, nx - ofs);
|
||||
memmove(d, c, nx - ofs);
|
||||
c+=nx - ofs -1; //second padding 1
|
||||
d+=nx;
|
||||
ofs=nx;
|
||||
nx = sizeof(TMOB);
|
||||
memcpy(d, c, nx - ofs-1); //last padding 1
|
||||
memmove(d, c, nx - ofs - 1); //last padding 1
|
||||
c+=nx - ofs - 1;
|
||||
}
|
||||
*s = count * sizeof(TMOB);
|
||||
|
|
|
@ -467,7 +467,7 @@ int vypocet_zasahu(const short *utocnik,const short *obrance, int chaos,int zbr
|
|||
if (flg & SPL_HSANC) {
|
||||
int tmp = total_hit;
|
||||
total_hit/=2;
|
||||
if (log_combat) wzprintf("Total resistance applied: %d - %d (half) = %d\n", tmp, total_hit - tmp);
|
||||
if (log_combat) wzprintf("Total resistance applied: %d - %d (half) = %d\n", tmp, total_hit - tmp, total_hit);
|
||||
}
|
||||
if (flg & SPL_TVAR) {
|
||||
if (log_combat) wzprintf("Set Face spell applied: %d = -%d (heal)\n", total_hit, -total_hit);
|
||||
|
|
|
@ -362,7 +362,10 @@ void define(int id,int x,int y,int xs,int ys,char align,void (*initproc)(OBJREC
|
|||
va_start(vlst, initproc);
|
||||
o->call_init(o,vlst);
|
||||
va_end(vlst);
|
||||
if (o->datasize && o->data==NULL) o->data=(void *)getmem(o->datasize);
|
||||
if (o->datasize && o->data==NULL) {
|
||||
o->data=(void *)getmem(o->datasize);
|
||||
memset(o->data,0,o->datasize);
|
||||
}
|
||||
o->next=NULL;
|
||||
if (o_start==NULL)
|
||||
{
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <cstdarg>
|
||||
#include <chrono>
|
||||
#include <filesystem>
|
||||
#include "../libs/logfile.h"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue