summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Datafile/Archive.cpp2
-rw-r--r--Datafile/Main.cpp18
-rw-r--r--Stars45/FighterAI.cpp24
-rw-r--r--Stars45/HUDView.cpp4
-rw-r--r--Stars45/Main.cpp2
-rw-r--r--Stars45/ShipAI.cpp2
-rw-r--r--Stars45/ShipDesign.cpp3
-rw-r--r--Stars45/Starshatter.cpp1
-rw-r--r--nGenEx/Game.h1
-rw-r--r--nGenEx/Polygon.cpp15
-rw-r--r--nGenEx/Screen.cpp9
-rw-r--r--nGenEx/VideoDX9.cpp7
12 files changed, 50 insertions, 38 deletions
diff --git a/Datafile/Archive.cpp b/Datafile/Archive.cpp
index 9d47465..cff704c 100644
--- a/Datafile/Archive.cpp
+++ b/Datafile/Archive.cpp
@@ -217,7 +217,7 @@ int DataArchive::FindEntry(const char* req_name)
int entry = -1;
for (DWORD i = 0; i < header.nfiles; i++)
- if (!stricmp(directory[i].name, req_name))
+ if (!_stricmp(directory[i].name, req_name))
return i;
return entry;
diff --git a/Datafile/Main.cpp b/Datafile/Main.cpp
index 23ac306..2e9ddfc 100644
--- a/Datafile/Main.cpp
+++ b/Datafile/Main.cpp
@@ -216,7 +216,7 @@ int match(const char* sFile, const char* sPattern)
switch (nPatternType) {
case PATTERN_NOWILD:
default:
- file_matches_pattern = (stricmp(sFile, sPattern) == 0);
+ file_matches_pattern = (_stricmp(sFile, sPattern) == 0);
break;
case PATTERN_STAR:
@@ -266,7 +266,7 @@ void ext(DataArchive& a, int argc, char* argv[])
// if we are extracting from a sub-directory,
if (nPath) {
// and this file is in the sub-directory,
- if (strnicmp(pde->name, sPath, nPath) == 0) {
+ if (_strnicmp(pde->name, sPath, nPath) == 0) {
// and this file matches the pattern:
if (match(pde->name+nPath+1, sPatt)) {
char sName[256];
@@ -294,7 +294,7 @@ void ext(DataArchive& a, int argc, char* argv[])
DataEntry* pde = a.GetFile(j);
if (pde) {
- if (stricmp(pde->name, argv[i]) == 0) {
+ if (_stricmp(pde->name, argv[i]) == 0) {
a.Extract(argv[i]);
}
}
@@ -340,7 +340,7 @@ void del(DataArchive& a, int argc, char* argv[])
// if we are deleting from a sub-directory,
if (nPath) {
// and this file is in the sub-directory,
- if (strnicmp(pde->name, sPath, nPath) == 0) {
+ if (_strnicmp(pde->name, sPath, nPath) == 0) {
// and this file matches the pattern:
if (match(pde->name+nPath+1, sPatt)) {
char sName[256];
@@ -400,11 +400,11 @@ int main(int argc, char* argv[])
DataArchive a(argv[1]);
int option = OPT_NONE;
- if (!stricmp(argv[2], "-ins")) option = OPT_INS;
- else if (!stricmp(argv[2], "-ext")) option = OPT_EXT;
- else if (!stricmp(argv[2], "-del")) option = OPT_DEL;
- else if (!stricmp(argv[2], "-mak")) option = OPT_MAK;
- else if (!stricmp(argv[2], "-list")) option = OPT_LIST;
+ if (!_stricmp(argv[2], "-ins")) option = OPT_INS;
+ else if (!_stricmp(argv[2], "-ext")) option = OPT_EXT;
+ else if (!_stricmp(argv[2], "-del")) option = OPT_DEL;
+ else if (!_stricmp(argv[2], "-mak")) option = OPT_MAK;
+ else if (!_stricmp(argv[2], "-list")) option = OPT_LIST;
argc -= 3;
argv += 3;
diff --git a/Stars45/FighterAI.cpp b/Stars45/FighterAI.cpp
index 0102f21..835bd00 100644
--- a/Stars45/FighterAI.cpp
+++ b/Stars45/FighterAI.cpp
@@ -1604,20 +1604,22 @@ FighterAI::EvadeThreat()
else {
evading = true;
-
- if (target == threat) {
- if (target->Type() == SimObject::SIM_SHIP) {
- Ship* tgt_ship = (Ship*) target;
- if (tgt_ship->GetTrigger(0)) {
- SetTarget(0);
- drop_time = 3;
+
+ if (target != nullptr) {
+ if (target == threat) {
+ if (target->Type() == SimObject::SIM_SHIP) {
+ Ship* tgt_ship = (Ship*) target;
+ if (tgt_ship->GetTrigger(0)) {
+ SetTarget(0);
+ drop_time = 3;
+ }
}
}
- }
- else if (target && threat_dist < threat_range / 2) {
- SetTarget(0);
- drop_time = 3;
+ else if (target && threat_dist < threat_range / 2) {
+ SetTarget(0);
+ drop_time = 3;
+ }
}
if (target)
diff --git a/Stars45/HUDView.cpp b/Stars45/HUDView.cpp
index 48953ac..5edda65 100644
--- a/Stars45/HUDView.cpp
+++ b/Stars45/HUDView.cpp
@@ -959,6 +959,10 @@ HUDView::DrawContactMarkers()
// draw life bars on targeted ship:
if (target && target->Type() == SimObject::SIM_SHIP && target->Rep()) {
Ship* tgt_ship = (Ship*) target;
+ if (tgt_ship == nullptr) {
+ Print(" Null Pointer in HUDView::DrawContactMarkers(). Please investigate.");
+ return;
+ }
Graphic* g = tgt_ship->Rep();
Rect r = g->ScreenRect();
diff --git a/Stars45/Main.cpp b/Stars45/Main.cpp
index 340e393..6f307d7 100644
--- a/Stars45/Main.cpp
+++ b/Stars45/Main.cpp
@@ -38,7 +38,7 @@ extern FILE* ErrLog;
extern int VD3D_describe_things;
int dump_missions = 0;
-const char* versionInfo = "5.1.66";
+const char* versionInfo = "5.1.87 EX";
static void PrintLogHeader()
{
diff --git a/Stars45/ShipAI.cpp b/Stars45/ShipAI.cpp
index 27e12d3..876f067 100644
--- a/Stars45/ShipAI.cpp
+++ b/Stars45/ShipAI.cpp
@@ -101,6 +101,8 @@ ShipAI::GetWard() const
void
ShipAI::SetWard(Ship* s)
{
+ if (ship == nullptr)
+ return;
if (s == ship->GetWard())
return;
diff --git a/Stars45/ShipDesign.cpp b/Stars45/ShipDesign.cpp
index 9965d3d..92a5c30 100644
--- a/Stars45/ShipDesign.cpp
+++ b/Stars45/ShipDesign.cpp
@@ -3590,6 +3590,8 @@ void
ShipDesign::ParseSkinMtl(TermStruct* val, Skin* skin)
{
Material* mtl = new(__FILE__,__LINE__) Material;
+ if (mtl == nullptr)
+ return;
for (int i = 0; i < val->elements()->size(); i++) {
TermDef* def = val->elements()->at(i)->isDef();
@@ -3675,6 +3677,7 @@ ShipDesign::ParseSkinMtl(TermStruct* val, Skin* skin)
Print("WARNING: invalid or missing tex_emissive in '%s'\n", filename);
DataLoader* loader = DataLoader::GetLoader();
+
loader->LoadTexture(tex_name, mtl->tex_emissive);
}
}
diff --git a/Stars45/Starshatter.cpp b/Stars45/Starshatter.cpp
index 7641227..b2cded4 100644
--- a/Stars45/Starshatter.cpp
+++ b/Stars45/Starshatter.cpp
@@ -425,6 +425,7 @@ Starshatter::InitGame()
input = new(__FILE__,__LINE__) MultiController;
Keyboard* k = new(__FILE__,__LINE__) Keyboard;
input->AddController(k);
+ ActivateKeyboardLayout(GetKeyboardLayout(0), 0);
mouse_input = new(__FILE__,__LINE__) MouseController;
input->AddController(mouse_input);
diff --git a/nGenEx/Game.h b/nGenEx/Game.h
index 82864da..bda2114 100644
--- a/nGenEx/Game.h
+++ b/nGenEx/Game.h
@@ -25,6 +25,7 @@ void FlushKeys();
void BufferKey(int vkey);
int GetKey();
int GetKeyPlus(int& key, int& shift);
+void ProcessKeyMessage();
extern "C" bool ProfileGameLoop(void);
diff --git a/nGenEx/Polygon.cpp b/nGenEx/Polygon.cpp
index 8051ec3..e21c442 100644
--- a/nGenEx/Polygon.cpp
+++ b/nGenEx/Polygon.cpp
@@ -665,15 +665,12 @@ Material::GetThumbColor(int i, int j, int size)
int tu = (int) (u * tex_bumpmap->Width());
int tv = (int) (v * tex_bumpmap->Height());
- double du1 = tex_bumpmap->GetColor(tu,tv).Red() -
- tex_bumpmap->GetColor(tu-1,tv).Red();
- double du2 = tex_bumpmap->GetColor(tu+1,tv).Red() -
- tex_bumpmap->GetColor(tu,tv).Red();
-
- double dv1 = tex_bumpmap->GetColor(tu,tv).Red() -
- tex_bumpmap->GetColor(tu,tv-1).Red();
- double dv2 = tex_bumpmap->GetColor(tu,tv+1).Red() -
- tex_bumpmap->GetColor(tu,tv).Red();
+ DWORD tmpred = tex_bumpmap->GetColor(tu,tv).Red();
+ double du1 = tmpred - tex_bumpmap->GetColor(tu-1,tv).Red();
+ double du2 = tex_bumpmap->GetColor(tu+1,tv).Red() - tmpred;
+
+ double dv1 = tmpred - tex_bumpmap->GetColor(tu,tv-1).Red();
+ double dv2 = tex_bumpmap->GetColor(tu,tv+1).Red() - tmpred;
double du = (du1 + du2) / 512 * 1e-8;
double dv = (dv1 + dv2) / 512 * 1e-8;
diff --git a/nGenEx/Screen.cpp b/nGenEx/Screen.cpp
index 045c38d..39f5586 100644
--- a/nGenEx/Screen.cpp
+++ b/nGenEx/Screen.cpp
@@ -107,11 +107,12 @@ Screen::Resize(int w, int h)
ListIter<Window> iter = window_list;
while (++iter) {
Window* win = iter.value();
+ Rect tmprect = win->GetRect();
- double w_x = win->GetRect().x / (double) width;
- double w_y = win->GetRect().y / (double) height;
- double w_w = win->GetRect().w / (double) width;
- double w_h = win->GetRect().h / (double) height;
+ double w_x = tmprect.x / (double) width;
+ double w_y = tmprect.y / (double) height;
+ double w_w = tmprect.w / (double) width;
+ double w_h = tmprect.h / (double) height;
Rect r;
diff --git a/nGenEx/VideoDX9.cpp b/nGenEx/VideoDX9.cpp
index d3c623c..902f4cb 100644
--- a/nGenEx/VideoDX9.cpp
+++ b/nGenEx/VideoDX9.cpp
@@ -1345,9 +1345,10 @@ VideoDX9::SetLights(const List<Light>& lights)
d3d_light.Type = (D3DLIGHTTYPE) light->Type();
if (light->Type() == Light::LIGHT_DIRECTIONAL) {
- d3d_light.Direction.x = (float) (-light->Location().x);
- d3d_light.Direction.y = (float) (-light->Location().y);
- d3d_light.Direction.z = (float) (-light->Location().z);
+ Point light_location = light->Location();
+ d3d_light.Direction.x = (float) (-light_location.x);
+ d3d_light.Direction.y = (float) (-light_location.y);
+ d3d_light.Direction.z = (float) (-light_location.z);
if (d3d_light.Direction.x == 0 &&
d3d_light.Direction.y == 0 &&