Skip to content

Commit fb76ba8

Browse files
authored
Merge pull request #335 from toxieainc/master
Fix some warnings and typos and remove duplicate win-sdk
2 parents f3d4a2d + 85df244 commit fb76ba8

31 files changed

Lines changed: 174 additions & 215 deletions

engine/openbor.c

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ const s_defense default_defense =
143143
.block_damage_adjust = 0,
144144
.block_damage_max = MAX_INT,
145145
.block_damage_min = MIN_INT,
146-
.blockpower = 0.f,
147-
.blockthreshold = 0.f,
146+
.blockpower = 0,
147+
.blockthreshold = 0,
148148
.blockratio = DEFENSE_BLOCKRATIO_COMPATABILITY_DEFAULT,
149149
.blocktype = BLOCK_TYPE_GLOBAL,
150150
.death_config_flags = DEATH_CONFIG_MACRO_DEFAULT,
@@ -153,7 +153,7 @@ const s_defense default_defense =
153153
.damage_min = MIN_INT,
154154
.factor = 1.f,
155155
.knockdown = 1.f,
156-
.pain = 0.f
156+
.pain = 0
157157
};
158158

159159
const s_offense default_offense =
@@ -1029,7 +1029,7 @@ int buffer_append(char **buffer, const char *str, size_t n, size_t *bufferlen, s
10291029
*buffer = realloc(*buffer, *bufferlen = appendlen + *len + 1024);
10301030
if(*buffer == NULL)
10311031
{
1032-
borShutdown(1, "Unalbe to resize buffer.\n");
1032+
borShutdown(1, "Unable to resize buffer.\n");
10331033
}
10341034
}
10351035
strncpy(*buffer + *len, str, appendlen);
@@ -1051,7 +1051,7 @@ int handle_txt_include(char *command, ArgList *arglist, char **fn, char *namebuf
10511051
*buf = realloc(*buf, *len + size + strlen(incfile) + strlen(filename) + 100); //leave enough memory for jump command
10521052
if(*buf == NULL)
10531053
{
1054-
borShutdown(1, "Unalbe to resize buffer. (handle_txt_include)\n");
1054+
borShutdown(1, "Unable to resize buffer. (handle_txt_include)\n");
10551055
free(buf2);
10561056
return 0;
10571057
}
@@ -4301,7 +4301,7 @@ void cachesound(int index, int load)
43014301
// Rewrite by Caskey, Damon V.
43024302
// 2018-03-19
43034303
//
4304-
// Add or remove a sprite to the the sprite list
4304+
// Add or remove a sprite to the sprite list
43054305
// by index.
43064306
//
43074307
// index: Target index in the sprite list.
@@ -4842,12 +4842,12 @@ int nextcolourmapn(s_model *model, int map_index, int player_index)
48424842

48434843
// This logic attempts to populate used_colors_map array with
48444844
// every color in use by other players who picking same
4845-
// character. If there are aren't enough unused map indexes to
4845+
// character. If there aren't enough unused map indexes to
48464846
// go around (i.e. three players select a character that only
48474847
// has two maps), then we return initial map selection.
48484848

48494849
for(i = 0; i < MAX_PLAYERS; i++)
4850-
{
4850+
{
48514851
// Compare every player index to player_index argument. If
48524852
// it's a different index but that index's model matches
48534853
// player_index's model, then it's another player choosing
@@ -4961,7 +4961,7 @@ int prevcolourmapn(s_model *model, int map_index, int player_index)
49614961

49624962
// This logic attempts to populate used_colors_map array with
49634963
// every color in use by other players who picking same
4964-
// character. If there are aren't enough unused map indexes to
4964+
// character. If there aren't enough unused map indexes to
49654965
// go around (i.e. three players select a character that only
49664966
// has two maps), then we return initial map selection.
49674967

@@ -6636,7 +6636,7 @@ void child_spawn_execute_list(s_child_spawn* head, entity* parent)
66366636
* 2022-05-29
66376637
*
66386638
* Accept pointer to node in list of child
6639-
* spawns. Apply properties to to spawn
6639+
* spawns. Apply properties to spawn
66406640
* a child entity. Returns pointer to
66416641
* spawned entity.
66426642
*/
@@ -9391,7 +9391,7 @@ void prepare_cache_map(size_t size)
93919391
void cache_model(char *name, char *path, int flag)
93929392
{
93939393
int len;
9394-
printf("Cacheing '%s' from %s\n", name, path);
9394+
printf("Caching '%s' from %s\n", name, path);
93959395
prepare_cache_map(models_cached + 1);
93969396
memset(&model_cache[models_cached], 0, sizeof(model_cache[models_cached]));
93979397

@@ -12497,7 +12497,7 @@ size_t lcmScriptDeleteMain(char **buf)
1249712497
len = i;
1249812498
break;
1249912499
} else continue;
12500-
if (i <= 0) break;
12500+
//if (i <= 0) break;
1250112501
}
1250212502

1250312503
len = len-pos;
@@ -12641,7 +12641,7 @@ s_model *init_model(const int cacheindex, const int unload)
1264112641
/*
1264212642
* Faction data. Faction type properties
1264312643
* get defaults set downstream depending
12644-
* on the the model's own type.
12644+
* on the model's own type.
1264512645
*/
1264612646

1264712647
newchar->faction = (s_faction){
@@ -13694,7 +13694,6 @@ s_model *load_cached_model(char *name, char *owner, char unload)
1369413694
offense_setup_from_arg(filename, command, newchar->offense, &arglist, OFFENSE_PARAMETER_FACTOR);
1369513695
break;
1369613696

13697-
break;
1369813697
case CMD_MODEL_HEIGHT:
1369913698
newchar->size.y = GET_INT_ARG(1);
1370013699
break;
@@ -14842,7 +14841,7 @@ s_model *load_cached_model(char *name, char *owner, char unload)
1484214841
child_spawn_upsert_property(&temp_child_spawn_head, temp_child_spawn_index)->config = (CHILD_SPAWN_CONFIG_AUTOKILL_HIT | CHILD_SPAWN_CONFIG_BEHAVIOR_BOMB | CHILD_SPAWN_CONFIG_FACTION_DAMAGE_PARENT | CHILD_SPAWN_CONFIG_FACTION_HOSTILE_PARENT | CHILD_SPAWN_CONFIG_FACTION_INDIRECT_PARENT | CHILD_SPAWN_CONFIG_LAUNCH_TOSS | CHILD_SPAWN_CONFIG_MOVE_CONFIG_PARAMETER | CHILD_SPAWN_CONFIG_RELATIONSHIP_OWNER);
1484314842
child_spawn_upsert_property(&temp_child_spawn_head, temp_child_spawn_index)->aimove = AIMOVE1_BOMB;
1484414843
child_spawn_upsert_property(&temp_child_spawn_head, temp_child_spawn_index)->direction_adjust = DIRECTION_ADJUST_SAME;
14845-
child_spawn_upsert_property(&temp_child_spawn_head, temp_child_spawn_index)->move_config_flags = (MOVE_CONFIG_NO_ADJUST_BASE | MOVE_CONFIG_SUBJECT_TO_HOLE | MOVE_CONFIG_SUBJECT_TO_PLATFORM | MOVE_CONFIG_SUBJECT_TO_WALL | MOVE_CONFIG_SUBJECT_TO_MAX_Z | MOVE_CONFIG_SUBJECT_TO_MIN_Z | MOVE_CONFIG_SUBJECT_TO_PLATFORM);
14844+
child_spawn_upsert_property(&temp_child_spawn_head, temp_child_spawn_index)->move_config_flags = (MOVE_CONFIG_NO_ADJUST_BASE | MOVE_CONFIG_SUBJECT_TO_HOLE | MOVE_CONFIG_SUBJECT_TO_PLATFORM | MOVE_CONFIG_SUBJECT_TO_WALL | MOVE_CONFIG_SUBJECT_TO_MAX_Z | MOVE_CONFIG_SUBJECT_TO_MIN_Z);
1484614845

1484714846
break;
1484814847

@@ -14855,7 +14854,7 @@ s_model *load_cached_model(char *name, char *owner, char unload)
1485514854
child_spawn_upsert_property(&temp_child_spawn_head, temp_child_spawn_index)->config = (CHILD_SPAWN_CONFIG_AUTOKILL_HIT | CHILD_SPAWN_CONFIG_BEHAVIOR_SHOT | CHILD_SPAWN_CONFIG_FACTION_DAMAGE_PARENT | CHILD_SPAWN_CONFIG_FACTION_HOSTILE_PARENT | CHILD_SPAWN_CONFIG_FACTION_INDIRECT_PARENT | CHILD_SPAWN_CONFIG_GRAVITY_OFF | CHILD_SPAWN_CONFIG_LAUNCH_THROW | CHILD_SPAWN_CONFIG_MOVE_CONFIG_PARAMETER | CHILD_SPAWN_CONFIG_RELATIONSHIP_OWNER);
1485614855
child_spawn_upsert_property(&temp_child_spawn_head, temp_child_spawn_index)->aimove = AIMOVE1_ARROW;
1485714856
child_spawn_upsert_property(&temp_child_spawn_head, temp_child_spawn_index)->direction_adjust = DIRECTION_ADJUST_SAME;
14858-
child_spawn_upsert_property(&temp_child_spawn_head, temp_child_spawn_index)->move_config_flags = (MOVE_CONFIG_NO_ADJUST_BASE | MOVE_CONFIG_SUBJECT_TO_HOLE | MOVE_CONFIG_SUBJECT_TO_PLATFORM | MOVE_CONFIG_SUBJECT_TO_WALL | MOVE_CONFIG_SUBJECT_TO_MAX_Z | MOVE_CONFIG_SUBJECT_TO_MIN_Z | MOVE_CONFIG_SUBJECT_TO_PLATFORM);
14857+
child_spawn_upsert_property(&temp_child_spawn_head, temp_child_spawn_index)->move_config_flags = (MOVE_CONFIG_NO_ADJUST_BASE | MOVE_CONFIG_SUBJECT_TO_HOLE | MOVE_CONFIG_SUBJECT_TO_PLATFORM | MOVE_CONFIG_SUBJECT_TO_WALL | MOVE_CONFIG_SUBJECT_TO_MAX_Z | MOVE_CONFIG_SUBJECT_TO_MIN_Z);
1485914858
child_spawn_upsert_property(&temp_child_spawn_head, temp_child_spawn_index)->takedamage = arrow_takedamage;
1486014859

1486114860
break;
@@ -16029,7 +16028,7 @@ s_model *load_cached_model(char *name, char *owner, char unload)
1602916028

1603016029
/*
1603116030
* Translate text value into a pre-defined forcemap constant.
16032-
* Wen applying a pre-defined forcemap, we�ll look at the model
16031+
* When applying a pre-defined forcemap, we�ll look at the model
1603316032
* and try to find its appropriate index. For example, if the
1603416033
* pre-defined BURN is used, forcemap will apply the model�s
1603516034
* designated burn. This allows use of effect maps without the
@@ -16620,10 +16619,10 @@ s_model *load_cached_model(char *name, char *owner, char unload)
1662016619
break;
1662116620

1662216621
case CMD_MODEL_FORCEMAP:
16623-
16622+
1662416623
/*
1662516624
* Translate text value into a pre-defined forcemap constant.
16626-
* Wen applying a pre-defined forcemap, we�ll look at the model
16625+
* When applying a pre-defined forcemap, we�ll look at the model
1662716626
* and try to find its appropriate index. For example, if the
1662816627
* pre-defined BURN is used, forcemap will apply the model�s
1662916628
* designated burn. This allows use of effect maps without the
@@ -16902,7 +16901,7 @@ s_model *load_cached_model(char *name, char *owner, char unload)
1690216901

1690316902
/*
1690416903
* Delete nodes from frame object lists
16905-
* that don't have valid data (i.e no
16904+
* that don't have valid data (i.e. no
1690616905
* coordinates defined at all or the
1690716906
* coordinates X/Y/H/W are all 0).
1690816907
*
@@ -22138,7 +22137,7 @@ void draw_visual_debug()
2213822137
// boxes, which is what the draw_box_on_entity() funciton
2213922138
// is meant for. For Y axis, We need to invert the value,
2214022139
// and place them in opposiing parameters (Max Y into
22141-
// function's min Y parameter, and and min Y into function's
22140+
// function's min Y parameter, and min Y into function's
2214222141
// max Y parameter).
2214322142

2214422143
range_y_min = -entity->animation->range.y.min;
@@ -28518,7 +28517,7 @@ void update_health()
2851828517

2851928518
// 1 Only recover MP > mpstableval.
2852028519
// 2 No recover. Drop MP if MP < mpstableval.
28521-
// 3 Both: recover if MP if MP < mpstableval and drop if MP > mpstableval.
28520+
// 3 Both: recover if MP < mpstableval and drop if MP > mpstableval.
2852228521
// 4 Gain until stable, then fall to stable.
2852328522
// 0 Default. Recover MP at all times.
2852428523

@@ -29622,7 +29621,7 @@ void display_ents()
2962229621
{
2962329622
alty = (int)(e->position.y - (other->position.y + other->animation->platform[other->animpos][PLATFORM_HEIGHT]));
2962429623
temp1 = -1 * (e->position.y - (other->position.y + other->animation->platform[other->animpos][PLATFORM_HEIGHT])) * light.x / 256; // xshift
29625-
temp2 = (float)(-e->position.y * light.y / 256);
29624+
temp2 = -e->position.y * light.y / 256;
2962629625

2962729626
qx = (int)(e->position.x - scrx);
2962829627
qy = (int)(e->position.z - scry - other->position.y - other->animation->platform[other->animpos][PLATFORM_HEIGHT]); // + (other->animation->platform[other->animpos][PLATFORM_DEPTH]/2)
@@ -30757,7 +30756,7 @@ entity *normal_find_target(int anim, int detect_adj)
3075730756
continue;
3075830757
}
3075930758

30760-
// If anim is defined, then then target must be
30759+
// If anim is defined, then target must be
3076130760
// in range of animation.
3076230761
if(anim >= 0)
3076330762
{
@@ -44065,7 +44064,7 @@ int obstacle_takedamage(entity *other, s_attack *attack, int fall_flag, s_defens
4406544064
void initialize_item_carry(entity *ent, s_spawn_entry *spawn_entry)
4406644065
{
4406744066
// It's possible to call this from script, so if
44068-
// if there is already memory for an item allocated
44067+
// there is already memory for an item allocated
4406944068
// here, clear it out to make sure we don't end up
4407044069
// with any memory leaks.
4407144070
if(ent->item_properties)
@@ -45607,12 +45606,12 @@ int recordInputs()
4560745606
{
4560845607
if ( playrecstatus->synctime%window >= window-2 ) // last is NULL bytes
4560945608
{
45610-
playrecstatus->buffer = (RecKeys*)realloc(playrecstatus->buffer,sizeof(RecKeys)*((int)(trunc(playrecstatus->synctime/window)+1)*window+window));
45609+
playrecstatus->buffer = (RecKeys*)realloc(playrecstatus->buffer,sizeof(RecKeys)*((playrecstatus->synctime/window+1)*window+window));
4561145610
if (playrecstatus->buffer == NULL)
4561245611
{
4561345612
printf("Error to allocate buffer in record inputs mode.\n");
4561445613
return 0;
45615-
} else memset(playrecstatus->buffer+(playrecstatus->synctime+1),0,(int)(trunc(playrecstatus->synctime/window)+1)*window+window-(playrecstatus->synctime+1)-1); // -2 becouse -1 is to 0 to size-1
45614+
} else memset(playrecstatus->buffer+(playrecstatus->synctime+1),0,(playrecstatus->synctime/window+1)*window+window-(playrecstatus->synctime+1)-1); // -2 because -1 is to 0 to size-1
4561645615
}
4561745616
}
4561845617

@@ -48885,7 +48884,7 @@ void init_videomodes(int log)
4888548884
}
4888648885
else if(stricmp(command, "colourdepth") == 0)
4888748886
{
48888-
printf("\nColordepth is depreciated. All modules are displayed with a 32bit color screen.\n\n");
48887+
printf("\nColordepth is not supported anymore. All modules are displayed with a 32bit color screen.\n\n");
4888948888
}
4889048889
else if(stricmp(command, "forcemode") == 0) {}
4889148890
else if(command && command[0])

engine/openbor.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3630,7 +3630,7 @@ typedef struct entity
36303630
// Size defined ints (for time).
36313631
unsigned long combotime; // If not expired, continue to next attack in series combo. ~~
36323632
unsigned long guardtime; // Next time to auto adjust guardpoints. ~~
3633-
unsigned long freezetime; // Used to store at what point the a frozen entity becomes unfrozen. ~~
3633+
unsigned long freezetime; // Used to store at what point a frozen entity becomes unfrozen. ~~
36343634
unsigned long invinctime; // Used to set time for invincibility to expire. ~~
36353635
unsigned long knockdowntime; // When knockdown count is expired. ~~
36363636
unsigned long magictime; // Next time to auto adjust MP. ~~
@@ -3794,7 +3794,7 @@ typedef struct
37943794
unsigned long musicoffset;
37953795
char *name; // must be a name in the model list, so just reference
37963796
int index; // model index
3797-
int weaponindex; // the spawned entity with an weapon item, this is the index of the item model
3797+
int weaponindex; // the spawned entity with a weapon item, this is the index of the item model
37983798
int alpha; // Used for alpha effects
37993799
int boss;
38003800
int flip;
@@ -3817,7 +3817,7 @@ typedef struct
38173817
unsigned credit;
38183818
int aggression; // For enemy A.I.
38193819
int spawntype; // Pass 1 when a level spawn.
3820-
e_entity_type entitytype; // if it's a enemy, player etc..
3820+
e_entity_type entitytype; // if it's an enemy, player etc..
38213821
entity *parent;
38223822
char *weapon; // spawn with a weapon, since it should be in the model list, so the model must be loaded, just reference its name
38233823
s_model *weaponmodel;

engine/openborscript.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
Be sure to call ScriptVariant_Clear if you want to use free to delete those variants.
2222
2323
If you want to copy a ScriptVariant from another, use ScriptVariant_Copy instead of assignment,
24-
not because it is faster, but this method is neccessary for string types.
24+
not because it is faster, but this method is necessary for string types.
2525
2626
If you want to change types of an ScriptVariant, use ScriptVariant_ChangeType, don't change vt directly.
2727
@@ -5005,7 +5005,7 @@ HRESULT openbor_getentityproperty(ScriptVariant **varlist , ScriptVariant **pret
50055005
case _ep_running_movez:
50065006
{
50075007
ScriptVariant_ChangeType(*pretvar, VT_INTEGER);
5008-
(*pretvar)->lVal = (LONG)(ent->modeldata.run_config_flags & (RUN_CONFIG_Z_DOWN_ENABLED | RUN_CONFIG_Z_DOWN_ENABLED));
5008+
(*pretvar)->lVal = (LONG)(ent->modeldata.run_config_flags & RUN_CONFIG_Z_DOWN_ENABLED);
50095009
break;
50105010
}
50115011
}
@@ -5130,7 +5130,7 @@ HRESULT openbor_getentityproperty(ScriptVariant **varlist , ScriptVariant **pret
51305130

51315131
/*
51325132
Request from animation or frame that doesn't exist = shutdown.
5133-
Let's be more user friendly then that; return empty so modder can evaluate
5133+
Let's be more user friendly than that; return empty so modder can evaluate
51345134
and take action accordingly.*/
51355135
if(!validanim(ent, arg->lVal) || !(ent->modeldata.animation[arg->lVal]->numframes >= arg1->lVal))
51365136
{
@@ -10851,7 +10851,7 @@ HRESULT openbor_savefilestream(ScriptVariant **varlist , ScriptVariant **pretvar
1085110851
arg = varlist[0];
1085210852
if(FAILED(ScriptVariant_IntegerValue(arg, &filestreamindex)))
1085310853
{
10854-
printf("You must give a valid filestrema handle for savefilestream!\n");
10854+
printf("You must give a valid filestream handle for savefilestream!\n");
1085510855
return E_FAIL;
1085610856
}
1085710857

@@ -11297,7 +11297,6 @@ HRESULT openbor_checkrange(ScriptVariant **varlist , ScriptVariant **pretvar, in
1129711297
{
1129811298
entity *ent = NULL, *target = NULL;
1129911299
LONG ani = 0;
11300-
extern int max_animations;
1130111300

1130211301
if(paramCount < 2)
1130311302
{
@@ -13700,7 +13699,6 @@ HRESULT openbor_shutdown(ScriptVariant **varlist , ScriptVariant **pretvar, int
1370013699
HRESULT openbor_jumptobranch(ScriptVariant **varlist , ScriptVariant **pretvar, int paramCount)
1370113700
{
1370213701
LONG ltemp;
13703-
extern char branch_name[MAX_NAME_LEN + 1];
1370413702
*pretvar = NULL;
1370513703
if(paramCount < 1)
1370613704
{
@@ -15001,7 +14999,7 @@ HRESULT openbor_setdrawmethod(ScriptVariant **varlist , ScriptVariant **pretvar,
1500114999
return S_OK;
1500215000

1500315001
setdrawmethod_error:
15004-
printf("Function need a valid entity handle and at least 1 interger parameter, setdrawmethod(entity, int flag, int scalex, int scaley, int flipx, int flipy, int shiftx, int alpha, int remap, int fillcolor, int rotate, int fliprotate, int transparencybg, void* colourmap, centerx, centery)\n");
15002+
printf("Function need a valid entity handle and at least 1 integer parameter, setdrawmethod(entity, int flag, int scalex, int scaley, int flipx, int flipy, int shiftx, int alpha, int remap, int fillcolor, int rotate, int fliprotate, int transparencybg, void* colourmap, centerx, centery)\n");
1500515003
return E_FAIL;
1500615004
}
1500715005

@@ -15046,7 +15044,7 @@ HRESULT openbor_updateframe(ScriptVariant **varlist , ScriptVariant **pretvar, i
1504615044
return S_OK;
1504715045

1504815046
updateframe_error:
15049-
printf("Function need a valid entity handle and at an interger parameter: updateframe(entity, int frame)\n");
15047+
printf("Function need a valid entity handle and at an integer parameter: updateframe(entity, int frame)\n");
1505015048
return E_FAIL;
1505115049
}
1505215050

engine/sdl/video.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
#include "gfxtypes.h"
1313
#include "types.h"
1414
#include "yuv.h"
15+
#if SDL
1516
#include "SDL.h"
17+
#endif
1618

1719
extern u8 pDeltaBuffer[480 * 2592];
1820
extern int opengl;

0 commit comments

Comments
 (0)