You can subscribe to this list here.
| 2004 |
Jan
|
Feb
(72) |
Mar
(274) |
Apr
(274) |
May
(123) |
Jun
(111) |
Jul
(210) |
Aug
(165) |
Sep
(172) |
Oct
(222) |
Nov
(196) |
Dec
(407) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(116) |
Feb
(288) |
Mar
(98) |
Apr
(24) |
May
(150) |
Jun
(65) |
Jul
(88) |
Aug
(164) |
Sep
(103) |
Oct
(145) |
Nov
(1126) |
Dec
(190) |
| 2006 |
Jan
(79) |
Feb
(29) |
Mar
(32) |
Apr
(33) |
May
(42) |
Jun
(27) |
Jul
(103) |
Aug
(217) |
Sep
(136) |
Oct
(36) |
Nov
(41) |
Dec
(12) |
| 2007 |
Jan
(30) |
Feb
(34) |
Mar
(52) |
Apr
(11) |
May
(14) |
Jun
(22) |
Jul
(121) |
Aug
(191) |
Sep
(112) |
Oct
(67) |
Nov
(27) |
Dec
(8) |
| 2008 |
Jan
(59) |
Feb
(108) |
Mar
(169) |
Apr
(119) |
May
(99) |
Jun
(60) |
Jul
(20) |
Aug
(25) |
Sep
(19) |
Oct
(43) |
Nov
(7) |
Dec
(16) |
| 2009 |
Jan
(8) |
Feb
(17) |
Mar
(12) |
Apr
(2) |
May
(4) |
Jun
|
Jul
|
Aug
(4) |
Sep
(2) |
Oct
(4) |
Nov
(2) |
Dec
(9) |
| 2010 |
Jan
(37) |
Feb
(58) |
Mar
(92) |
Apr
(10) |
May
(21) |
Jun
|
Jul
(20) |
Aug
(73) |
Sep
(37) |
Oct
(7) |
Nov
(28) |
Dec
(38) |
| 2011 |
Jan
(23) |
Feb
(85) |
Mar
(73) |
Apr
(13) |
May
(1) |
Jun
(3) |
Jul
(3) |
Aug
(3) |
Sep
(17) |
Oct
(3) |
Nov
(32) |
Dec
(28) |
| 2012 |
Jan
(30) |
Feb
(11) |
Mar
(25) |
Apr
(17) |
May
(20) |
Jun
(1) |
Jul
(13) |
Aug
(3) |
Sep
(14) |
Oct
(15) |
Nov
(22) |
Dec
(12) |
| 2013 |
Jan
(33) |
Feb
(39) |
Mar
(80) |
Apr
(8) |
May
|
Jun
(6) |
Jul
(22) |
Aug
|
Sep
(5) |
Oct
(1) |
Nov
(5) |
Dec
(1) |
| 2014 |
Jan
|
Feb
(1) |
Mar
(10) |
Apr
|
May
(1) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2015 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(17) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(12) |
Jul
(9) |
Aug
(8) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <pyr...@us...> - 2020-02-06 14:30:28
|
Revision: 13733
http://sourceforge.net/p/vegastrike/code/13733
Author: pyramid3d
Date: 2020-02-06 14:30:26 +0000 (Thu, 06 Feb 2020)
Log Message:
-----------
updated README with corrections
Modified Paths:
--------------
trunk/README.md
Modified: trunk/README.md
===================================================================
--- trunk/README.md 2020-02-06 14:18:57 UTC (rev 13732)
+++ trunk/README.md 2020-02-06 14:30:26 UTC (rev 13733)
@@ -13,9 +13,9 @@
**Repository Moved**
=====================================
-This [Vega Strike code repository]() has been moved to Github.
+This [Vega Strike SVN code repository](https://sourceforge.net/p/vegastrike/code/) has been moved to GitHub.
-[https://github.com/vegastrike/Vega-Strike-Engine-Source](https://github.com/vegastrike/Vega-Strike-Engine-Source)
+ > [https://github.com/vegastrike/Vega-Strike-Engine-Source](https://github.com/vegastrike/Vega-Strike-Engine-Source)
The move has been concluded after this repo svn commit revision r13698 on 2015-08-04 23:02:01 +0000 also code named
> "version 0.5.2-alpha"
@@ -22,7 +22,7 @@
There were commits in this repo up to revision r13731 on 2017-06-21 20:11:56.
-Those commits have been merged with the new [Github Vegastrike project repo](https://github.com/vegastrike/).
+Those commits have been merged with the new [GitHub Vegastrike project repo](https://github.com/vegastrike/).
All code from the local [trunk](#trunk) has been archived to both
@@ -31,7 +31,7 @@
No code or data has been removed and as long as the repository is available, it will remain accessible for historical research and forensics.
-Please do however refrain from future commits to this repository to focus your contributions on the [Github Vegastrike project repo](https://github.com/vegastrike/) repository.
+Please do however refrain from future commits to this repository to focus your contributions on the [GitHub Vegastrike project repo](https://github.com/vegastrike/) repository.
|
|
From: <pyr...@us...> - 2020-02-06 14:18:59
|
Revision: 13732
http://sourceforge.net/p/vegastrike/code/13732
Author: pyramid3d
Date: 2020-02-06 14:18:57 +0000 (Thu, 06 Feb 2020)
Log Message:
-----------
archiving all code since main repo moved to github after r13698 on 2015-08-04 23:02:01 +0000
Added Paths:
-----------
branches/0.5.2alpha-archive/
tags/0.5.2alpha-archive/
trunk/
trunk/README.md
Removed Paths:
-------------
trunk/
Added: trunk/README.md
===================================================================
--- trunk/README.md (rev 0)
+++ trunk/README.md 2020-02-06 14:18:57 UTC (rev 13732)
@@ -0,0 +1,38 @@
+```markdown
+# @file : README.md
+# @version: 2020-02-06
+# @created: 2020-02-06
+# @author : pyramid
+# @brief : repo moved notice
+```
+
+**Vega Strike Space Simulation Engine**
+=====================================
+
+
+**Repository Moved**
+=====================================
+
+This [Vega Strike code repository]() has been moved to Github.
+
+[https://github.com/vegastrike/Vega-Strike-Engine-Source](https://github.com/vegastrike/Vega-Strike-Engine-Source)
+
+The move has been concluded after this repo svn commit revision r13698 on 2015-08-04 23:02:01 +0000 also code named
+ > "version 0.5.2-alpha"
+
+There were commits in this repo up to revision r13731 on 2017-06-21 20:11:56.
+
+Those commits have been merged with the new [Github Vegastrike project repo](https://github.com/vegastrike/).
+
+All code from the local [trunk](#trunk) has been archived to both
+
+- [branches/0.5.2alpha-archive](branches/0.5.2alpha-archive)
+- [tags/0.5.2alpha-archive](tags/0.5.2alpha-archive)
+
+No code or data has been removed and as long as the repository is available, it will remain accessible for historical research and forensics.
+
+Please do however refrain from future commits to this repository to focus your contributions on the [Github Vegastrike project repo](https://github.com/vegastrike/) repository.
+
+
+
+```EOF```
|
|
From: <kla...@us...> - 2017-06-21 20:11:59
|
Revision: 13731
http://sourceforge.net/p/vegastrike/code/13731
Author: klaussfreire
Date: 2017-06-21 20:11:56 +0000 (Wed, 21 Jun 2017)
Log Message:
-----------
GCC 7 fix: use const char* instead of char*
GCC 7 is far stricter with casting from/to const,
so use const char * in vssetup structures and
functions to avoid having to cast constant strings
into mutable char*
Modified Paths:
--------------
trunk/vegastrike/setup/src/include/central.cpp
trunk/vegastrike/setup/src/include/central.h
trunk/vegastrike/setup/src/include/display_gtk.cpp
trunk/vegastrike/setup/src/include/file.cpp
trunk/vegastrike/setup/src/include/file.h
Modified: trunk/vegastrike/setup/src/include/central.cpp
===================================================================
--- trunk/vegastrike/setup/src/include/central.cpp 2017-06-21 18:02:22 UTC (rev 13730)
+++ trunk/vegastrike/setup/src/include/central.cpp 2017-06-21 20:11:56 UTC (rev 13731)
@@ -28,7 +28,7 @@
ShowMain();
}
-void SetGroup(char *group, char *setting) {
+void SetGroup(const char *group, const char *setting) {
struct group *CURRENT;
CURRENT = &GROUPS;
do {
@@ -36,7 +36,7 @@
if (strcmp(group, CURRENT->name) == 0) { CURRENT->setting = NewString(setting); return; }
} while ((CURRENT = CURRENT->next) > 0);
}
-void SetInfo(char *catagory, char *info) {
+void SetInfo(const char *catagory, const char *info) {
struct catagory *CURRENT;
CURRENT = &CATS;
do {
@@ -45,7 +45,7 @@
} while ((CURRENT = CURRENT->next) > 0);
}
-char *GetInfo(char *catagory) {
+const char *GetInfo(const char *catagory) {
struct catagory *CURRENT;
CURRENT = &CATS;
do {
@@ -58,7 +58,7 @@
return catagory;
}
-char *GetSetting(char *group) {
+const char *GetSetting(const char *group) {
struct group *CUR;
CUR = &GROUPS;
do {
@@ -65,10 +65,10 @@
if (CUR->name == NULL) { continue; }
if (strcmp(CUR->name, group) == 0) { return CUR->setting; }
} while ((CUR = CUR->next) > 0);
- return '\0';
+ return "\0";
}
-struct catagory *GetCatStruct(char *name) {
+struct catagory *GetCatStruct(const char *name) {
struct catagory *CUR;
CUR = &CATS;
do {
@@ -78,7 +78,7 @@
return 0;
}
-struct group *GetGroupStruct(char *name) {
+struct group *GetGroupStruct(const char *name) {
struct group *CUR;
CUR = &GROUPS;
do {
Modified: trunk/vegastrike/setup/src/include/central.h
===================================================================
--- trunk/vegastrike/setup/src/include/central.h 2017-06-21 18:02:22 UTC (rev 13730)
+++ trunk/vegastrike/setup/src/include/central.h 2017-06-21 20:11:56 UTC (rev 13731)
@@ -45,32 +45,32 @@
#define CONFIG_FILE "setup.config"
void Start(int*,char***);
-void SetGroup(char *group, char *setting);
-void SetInfo(char *catagory, char *info);
-char *GetInfo(char *catagory);
-char *GetSetting(char *group);
-struct catagory *GetCatStruct(char *name);
-struct group *GetGroupStruct(char *name);
+void SetGroup(const char *group, const char *setting);
+void SetInfo(const char *catagory, const char *info);
+const char *GetInfo(const char *catagory);
+const char *GetSetting(const char *group);
+struct catagory *GetCatStruct(const char *name);
+struct group *GetGroupStruct(const char *name);
typedef struct _GtkWidget GtkWidget;
struct catagory {
- char *group;
- char *name;
- char *info;
+ const char *group;
+ const char *name;
+ const char *info;
GtkWidget *button;
struct catagory *next;
};
struct group {
- char *name;
- char *setting;
+ const char *name;
+ const char *setting;
struct group *next;
};
struct global_settings {
- char *program_name;
- char *config_file;
- char *temp_file;
- char *data_path;
+ const char *program_name;
+ const char *config_file;
+ const char *temp_file;
+ const char *data_path;
int columns;
};
Modified: trunk/vegastrike/setup/src/include/display_gtk.cpp
===================================================================
--- trunk/vegastrike/setup/src/include/display_gtk.cpp 2017-06-21 18:02:22 UTC (rev 13730)
+++ trunk/vegastrike/setup/src/include/display_gtk.cpp 2017-06-21 20:11:56 UTC (rev 13731)
@@ -16,7 +16,7 @@
**************************************************************************/
#include "display.h"
#ifdef GTK
-void AddCats(GtkWidget *vbox, char *group, char *def);
+void AddCats(GtkWidget *vbox, const char *group, const char *def);
void ClickButton(GtkWidget *w, struct catagory *CUR);
#ifdef _WIN32
@@ -149,7 +149,7 @@
}
-void AddCats(GtkWidget *vbox, char *group, char *def) {
+void AddCats(GtkWidget *vbox, const char *group, const char *def) {
struct catagory *CUR;
#ifdef USE_RADIO
GSList *radiogroup = NULL;
@@ -192,7 +192,8 @@
void ClickButton(GtkWidget *w, struct catagory *CUR) {
struct catagory *OLD;
struct group *NEW;
- char *new_text, *old;
+ char *new_text;
+ const char *old;
#ifdef USE_RADIO
int length;
Modified: trunk/vegastrike/setup/src/include/file.cpp
===================================================================
--- trunk/vegastrike/setup/src/include/file.cpp 2017-06-21 18:02:22 UTC (rev 13730)
+++ trunk/vegastrike/setup/src/include/file.cpp 2017-06-21 20:11:56 UTC (rev 13731)
@@ -226,7 +226,7 @@
}
}
-void Modconfig( int setting, char *name, char *group )
+void Modconfig( int setting, const char *name, const char *group )
{
FILE *rp, *wp; //read and write
char line[MAX_READ+1], write[MAX_READ+1], mid[MAX_READ+1];
@@ -373,12 +373,12 @@
fclose( wp );
}
-void EnableSetting( char *name, char *group )
+void EnableSetting( const char *name, const char *group )
{
Modconfig( 2, name, group );
}
-void DisableSetting( char *name, char *group )
+void DisableSetting( const char *name, const char *group )
{
Modconfig( 1, name, group );
}
Modified: trunk/vegastrike/setup/src/include/file.h
===================================================================
--- trunk/vegastrike/setup/src/include/file.h 2017-06-21 18:02:22 UTC (rev 13730)
+++ trunk/vegastrike/setup/src/include/file.h 2017-06-21 20:11:56 UTC (rev 13731)
@@ -23,8 +23,8 @@
void LoadMainConfig(void);
void LoadConfig(void);
-void Modconfig(int setting, char *name, char *group);
-void EnableSetting(char *name, char *group);
-void DisableSetting(char *name, char *group);
+void Modconfig(int setting, const char *name, const char *group);
+void EnableSetting(const char *name, const char *group);
+void DisableSetting(const char *name, const char *group);
#endif
|
|
From: <kla...@us...> - 2017-06-21 18:02:25
|
Revision: 13730
http://sourceforge.net/p/vegastrike/code/13730
Author: klaussfreire
Date: 2017-06-21 18:02:22 +0000 (Wed, 21 Jun 2017)
Log Message:
-----------
GCC 7 fix: cannot return a char, must use char*
Modified Paths:
--------------
trunk/vegastrike/src/gui/text_area.cpp
Modified: trunk/vegastrike/src/gui/text_area.cpp
===================================================================
--- trunk/vegastrike/src/gui/text_area.cpp 2017-06-21 16:42:42 UTC (rev 13729)
+++ trunk/vegastrike/src/gui/text_area.cpp 2017-06-21 18:02:22 UTC (rev 13730)
@@ -243,7 +243,7 @@
{
TextAreaItem *search;
search = ItemList->FindCount( cur_selected, 0 );
- if (search == 0) return '\0';
+ if (search == 0) return "\0";
if (type == 1) return search->name;
else return search->description;
|
|
From: <kla...@us...> - 2017-06-21 16:42:44
|
Revision: 13729
http://sourceforge.net/p/vegastrike/code/13729
Author: klaussfreire
Date: 2017-06-21 16:42:42 +0000 (Wed, 21 Jun 2017)
Log Message:
-----------
Fix member access through pointer (GCC7 fix)
Modified Paths:
--------------
trunk/vegastrike/src/cmd/unit_collide.h
Modified: trunk/vegastrike/src/cmd/unit_collide.h
===================================================================
--- trunk/vegastrike/src/cmd/unit_collide.h 2016-08-15 15:33:21 UTC (rev 13728)
+++ trunk/vegastrike/src/cmd/unit_collide.h 2017-06-21 16:42:42 UTC (rev 13729)
@@ -94,9 +94,9 @@
{
if ( !hugeobjects.empty() )
hugeobjects.clear();
- if ( this->active_huge.size() )
+ if ( this->active_huge->size() )
ha.clear();
- if ( this->accum_huge.size() )
+ if ( this->accum_huge->size() )
hb.clear();
acc_huge.clear();
act_huge.clear();
|
|
From: <kla...@us...> - 2016-08-15 15:33:23
|
Revision: 13728
http://sourceforge.net/p/vegastrike/code/13728
Author: klaussfreire
Date: 2016-08-15 15:33:21 +0000 (Mon, 15 Aug 2016)
Log Message:
-----------
Remove useless import
Modified Paths:
--------------
trunk/data/modules/missions/privateer.py
Modified: trunk/data/modules/missions/privateer.py
===================================================================
--- trunk/data/modules/missions/privateer.py 2016-08-15 15:01:02 UTC (rev 13727)
+++ trunk/data/modules/missions/privateer.py 2016-08-15 15:33:21 UTC (rev 13728)
@@ -32,7 +32,6 @@
return # Do not want to do anything to get out of sync.
for i in self.loops:
i.Execute()
- import sys
def initbriefing(self):
print("ending briefing")
def loopbriefing(self):
|
|
From: <kla...@us...> - 2016-08-15 15:01:04
|
Revision: 13727
http://sourceforge.net/p/vegastrike/code/13727
Author: klaussfreire
Date: 2016-08-15 15:01:02 +0000 (Mon, 15 Aug 2016)
Log Message:
-----------
Fix rlaan-cockpit normals, add indirect glow
Modified Paths:
--------------
trunk/data/cockpits/rlaan-cockpit.cpt/cockpit-rlaan.bfxm
Added Paths:
-----------
trunk/data/cockpits/rlaan-cockpit.cpt/Rlaan_cockpit_GLO_GI.png
Added: trunk/data/cockpits/rlaan-cockpit.cpt/Rlaan_cockpit_GLO_GI.png
===================================================================
(Binary files differ)
Index: trunk/data/cockpits/rlaan-cockpit.cpt/Rlaan_cockpit_GLO_GI.png
===================================================================
--- trunk/data/cockpits/rlaan-cockpit.cpt/Rlaan_cockpit_GLO_GI.png 2016-08-15 15:00:08 UTC (rev 13726)
+++ trunk/data/cockpits/rlaan-cockpit.cpt/Rlaan_cockpit_GLO_GI.png 2016-08-15 15:01:02 UTC (rev 13727)
Property changes on: trunk/data/cockpits/rlaan-cockpit.cpt/Rlaan_cockpit_GLO_GI.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Modified: trunk/data/cockpits/rlaan-cockpit.cpt/cockpit-rlaan.bfxm
===================================================================
(Binary files differ)
|
|
From: <kla...@us...> - 2016-08-15 15:00:09
|
Revision: 13726
http://sourceforge.net/p/vegastrike/code/13726
Author: klaussfreire
Date: 2016-08-15 15:00:08 +0000 (Mon, 15 Aug 2016)
Log Message:
-----------
Fix light_cockpit normals, improve indirect glow
Modified Paths:
--------------
trunk/data/cockpits/light_cockpit.cpt/cockpit-light.bfxm
Added Paths:
-----------
trunk/data/cockpits/light_cockpit.cpt/cockpit1lumagi.jpg
Modified: trunk/data/cockpits/light_cockpit.cpt/cockpit-light.bfxm
===================================================================
(Binary files differ)
Added: trunk/data/cockpits/light_cockpit.cpt/cockpit1lumagi.jpg
===================================================================
(Binary files differ)
Index: trunk/data/cockpits/light_cockpit.cpt/cockpit1lumagi.jpg
===================================================================
--- trunk/data/cockpits/light_cockpit.cpt/cockpit1lumagi.jpg 2016-08-15 14:59:20 UTC (rev 13725)
+++ trunk/data/cockpits/light_cockpit.cpt/cockpit1lumagi.jpg 2016-08-15 15:00:08 UTC (rev 13726)
Property changes on: trunk/data/cockpits/light_cockpit.cpt/cockpit1lumagi.jpg
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
|
|
From: <kla...@us...> - 2016-08-15 14:59:22
|
Revision: 13725
http://sourceforge.net/p/vegastrike/code/13725
Author: klaussfreire
Date: 2016-08-15 14:59:20 +0000 (Mon, 15 Aug 2016)
Log Message:
-----------
Rework objconv to rely less on runningbytenum, which is error prone:
measure section sizes instead with ftell. Fix signed-unsigned mismatch
that was causing corruption.
Modified Paths:
--------------
trunk/vegastrike/objconv/mesher/to_BFXM.cpp
Modified: trunk/vegastrike/objconv/mesher/to_BFXM.cpp
===================================================================
--- trunk/vegastrike/objconv/mesher/to_BFXM.cpp 2016-08-15 14:57:11 UTC (rev 13724)
+++ trunk/vegastrike/objconv/mesher/to_BFXM.cpp 2016-08-15 14:59:20 UTC (rev 13725)
@@ -1007,7 +1007,7 @@
XML submesh = LoadXML( animname.c_str(), 1 );
runningbytenum += appendmeshfromxml( submesh, Outputfile, forcenormals );
}
- fseek( Outputfile, ( -1*(runningbytenum) )+4, SEEK_CUR );
+ fseek( Outputfile, ( -1*((long)runningbytenum) )+4, SEEK_CUR );
intbuf = runningbytenum;
intbuf = VSSwapHostIntToLittle( intbuf );
fwrite( &intbuf, sizeof (uint32bit), 1, Outputfile ); //Correct number of bytes for total record
@@ -1045,14 +1045,17 @@
float transx = float( atof( Converter::getNamedOption( "addx" ).c_str() ) );
float transy = float( atof( Converter::getNamedOption( "addy" ).c_str() ) );
float transz = float( atof( Converter::getNamedOption( "addz" ).c_str() ) );
+ long meshlengthpos, vsalengthpos, startpos;
uint32bit intbuf;
float32bit floatbuf;
uchar8bit bytebuf;
uint32bit runningbytenum = 0;
//Mesh Header
+ startpos = ftell( Outputfile );
intbuf = VSSwapHostIntToLittle( 11*sizeof (uint32bit)+20*sizeof (float32bit) );
runningbytenum += sizeof (uint32bit)*(uint32bit) fwrite( &intbuf, sizeof (uint32bit), 1, Outputfile ); //Size of Mesh header in Bytes
intbuf = VSSwapHostIntToLittle( 0 ); //Temp - rewind and fix.
+ meshlengthpos = ftell( Outputfile );
runningbytenum += sizeof (uint32bit)*(uint32bit) fwrite( &intbuf, sizeof (uint32bit), 1, Outputfile ); //Size of this Mesh in Bytes
floatbuf = VSSwapHostFloatToLittle( memfile.scale );
runningbytenum += sizeof (float32bit)*(uint32bit) fwrite( &floatbuf, sizeof (float32bit), 1, Outputfile ); //Mesh Scale
@@ -1119,7 +1122,8 @@
runningbytenum += sizeof (float32bit)*(uint32bit) fwrite( &floatbuf, sizeof (float32bit), 1, Outputfile ); //alpha test value
//END HEADER
//Begin Variable sized Attributes
- uint32bit VSAstart = runningbytenum;
+ uint32bit VSAstart = ftell( Outputfile );
+ vsalengthpos = ftell( Outputfile );
intbuf = VSSwapHostIntToLittle( 0 ); //Temp value will overwrite later
runningbytenum += sizeof (uint32bit)*(uint32bit) fwrite( &intbuf, sizeof (uint32bit), 1, Outputfile ); //Length of Variable sized attribute section in bytes
//Detail texture
@@ -1239,7 +1243,7 @@
}
}
//End Variable sized Attributes
- uint32bit VSAend = runningbytenum;
+ uint32bit VSAend = ftell( Outputfile );
//GEOMETRY
intbuf = VSSwapHostIntToLittle( (uint32bit) memfile.vertices.size() );
runningbytenum += sizeof (uint32bit)*(uint32bit) fwrite( &intbuf, sizeof (uint32bit), 1, Outputfile ); //Number of vertices
@@ -1376,15 +1380,16 @@
}
}
//END GEOMETRY
- fseek( Outputfile, ( -1*(runningbytenum) )+4, SEEK_CUR );
- intbuf = runningbytenum;
+ long endpos = ftell( Outputfile );
+ fseek( Outputfile, meshlengthpos, SEEK_SET );
+ intbuf = endpos - startpos;
intbuf = VSSwapHostIntToLittle( intbuf );
fwrite( &intbuf, sizeof (uint32bit), 1, Outputfile ); //Correct number of bytes for total mesh
- fseek( Outputfile, ( -1*(runningbytenum-VSAstart) ), SEEK_END );
+ fseek( Outputfile, vsalengthpos, SEEK_SET );
intbuf = VSAend-VSAstart;
intbuf = VSSwapHostIntToLittle( intbuf );
fwrite( &intbuf, sizeof (uint32bit), 1, Outputfile ); //Correct number of bytes for Variable Sized Attribute section
- fseek( Outputfile, 0, SEEK_END );
+ fseek( Outputfile, endpos, SEEK_SET );
return runningbytenum;
}
|
|
From: <kla...@us...> - 2016-08-15 14:57:13
|
Revision: 13724
http://sourceforge.net/p/vegastrike/code/13724
Author: klaussfreire
Date: 2016-08-15 14:57:11 +0000 (Mon, 15 Aug 2016)
Log Message:
-----------
Mesher: warn when a material is missing from the .mtl file
Modified Paths:
--------------
trunk/vegastrike/objconv/mesher/from_obj.cpp
Modified: trunk/vegastrike/objconv/mesher/from_obj.cpp
===================================================================
--- trunk/vegastrike/objconv/mesher/from_obj.cpp 2016-08-15 14:54:57 UTC (rev 13723)
+++ trunk/vegastrike/objconv/mesher/from_obj.cpp 2016-08-15 14:57:11 UTC (rev 13724)
@@ -556,16 +556,21 @@
if (buf[0] == '#' || buf[0] == 'g')
continue;
if ( 1 == sscanf( buf, "usemtl %s\n", str ) ) {
+ curmat = str;
+ if (mtls.find(curmat) == mtls.end())
+ printf("WARNING: referenced material not found: %s\n", curmat.c_str());
if (changemat) {
//append to facelistlist
facelistlist[curmat].insert( facelistlist[curmat].end(), facelist.begin(), facelist.end() );
facelist.clear();
}
- curmat = str;
changemat = true;
continue;
}
if ( 1 == sscanf( buf, "usemat %s\n", str ) ) {
+ curmat = str;
+ if (mtls.find(curmat) == mtls.end())
+ printf("WARNING: referenced material not found: %s\n", curmat.c_str());
mtls[curmat].textures.clear();
mtls[curmat].textures.push_back( makeTextureHolder( str, 0 ) );
}
|
|
From: <kla...@us...> - 2016-08-15 14:55:00
|
Revision: 13723
http://sourceforge.net/p/vegastrike/code/13723
Author: klaussfreire
Date: 2016-08-15 14:54:57 +0000 (Mon, 15 Aug 2016)
Log Message:
-----------
Fix 3D cockpit rendering:
- Z-buffer range was off such that the whole cockpit was clipped
- Lighting was wrong, since the camera was centered but ligths weren't
adjusted for it
- Disabling Z culling hasn't been working since shader techniques were
introduced, that force their own culling modes, so remove the option
- Transform matrix was flipping the X axis and thus flipping face
normals, fix it to be consistent with GFXLookAt
Modified Paths:
--------------
trunk/vegastrike/src/gfx/camera.cpp
trunk/vegastrike/src/gfx/cockpit.cpp
trunk/vegastrike/src/gfxlib.h
trunk/vegastrike/src/gldrv/gl_light_state.cpp
Modified: trunk/vegastrike/src/gfx/camera.cpp
===================================================================
--- trunk/vegastrike/src/gfx/camera.cpp 2016-08-15 14:52:15 UTC (rev 13722)
+++ trunk/vegastrike/src/gfx/camera.cpp 2016-08-15 14:54:57 UTC (rev 13723)
@@ -124,7 +124,11 @@
#ifdef PERFRAMESOUND
AUDListenerOrientation( P, Q, R );
#endif
-
+
+ if (centerCamera)
+ GFXSetLightOffset(-Coord.Cast());
+ else
+ GFXSetLightOffset(Vector(0,0,0));
}
void Camera::UpdateCameraSounds()
Modified: trunk/vegastrike/src/gfx/cockpit.cpp
===================================================================
--- trunk/vegastrike/src/gfx/cockpit.cpp 2016-08-15 14:52:15 UTC (rev 13722)
+++ trunk/vegastrike/src/gfx/cockpit.cpp 2016-08-15 14:54:57 UTC (rev 13723)
@@ -2431,7 +2431,7 @@
headtrans.clear();
headtrans.push_back( Matrix() );
- VectorAndPositionToMatrix( headtrans.back(), P, Q, R, QVector( 0, 0, 0 ) );
+ VectorAndPositionToMatrix( headtrans.back(), -P, Q, R, QVector( 0, 0, 0 ) );
static float theta = 0, wtheta = 0;
static float shake_speed =
XMLSupport::parse_float( vs_config->getVariable( "graphics", "shake_speed", "50" ) );
@@ -2468,11 +2468,11 @@
( (GetParent() != NULL) ? LookupUnitStat( UnitImages< void >::WARPFIELDSTRENGTH,
GetParent() ) : 0.0f )/warp_shake_ref ) );
if (shakin > shake_limit) shakin = shake_limit;
- headtrans.front().p.i = shake_mag*shakin*cos( theta )*cockpitradial/100; //AccessCamera()->GetPosition().i+shakin*cos(theta);
- headtrans.front().p.j = shake_mag*shakin*cos( 1.3731*theta )*cockpitradial/100; //AccessCamera()->GetPosition().j+shakin*cos(theta);
- headtrans.front().p.k = 0; //AccessCamera()->GetPosition().k;
- headtrans.front().p.i += warp_shake_mag*cos( wtheta )*sqr( warp_strength )*cockpitradial/100; //AccessCamera()->GetPosition().i+shakin*cos(theta);
- headtrans.front().p.j += warp_shake_mag*cos( 1.165864*wtheta )*sqr( warp_strength )*cockpitradial/100; //AccessCamera()->GetPosition().j+shakin*cos(theta);
+ headtrans.back().p.i = shake_mag*shakin*cos( theta )*cockpitradial/100; //AccessCamera()->GetPosition().i+shakin*cos(theta);
+ headtrans.back().p.j = shake_mag*shakin*cos( 1.3731*theta )*cockpitradial/100; //AccessCamera()->GetPosition().j+shakin*cos(theta);
+ headtrans.back().p.k = 0; //AccessCamera()->GetPosition().k;
+ headtrans.back().p.i += warp_shake_mag*cos( wtheta )*sqr( warp_strength )*cockpitradial/100; //AccessCamera()->GetPosition().i+shakin*cos(theta);
+ headtrans.back().p.j += warp_shake_mag*cos( 1.165864*wtheta )*sqr( warp_strength )*cockpitradial/100; //AccessCamera()->GetPosition().j+shakin*cos(theta);
if (shakin > 0) {
shakin -= GetElapsedTime()*shake_reduction*(shakin/5); //Fast convergence to 5% shaking, slow stabilization
if (shakin <= 0)
@@ -2487,7 +2487,7 @@
else caccel = Vector( 0, 0, 0 );
float driftphase = pow( 0.25, GetElapsedTime() );
oaccel = (1-driftphase)*caccel+driftphase*oaccel;
- headtrans.front().p += -cockpitradial*oaccel;
+ headtrans.back().p += -cockpitradial*oaccel;
float driftmag = cockpitradial*oaccel.Magnitude();
//if (COCKPITZ_PARTITIONS>1) GFXClear(GFXFALSE,GFXFALSE,GFXTRUE);//only clear stencil buffer
@@ -2500,30 +2500,22 @@
GFXTRUE,
GFXTRUE,
GFXTRUE,
- zfloor+zrange*j/COCKPITZ_PARTITIONS,
- zfloor+zrange*(j+1)/COCKPITZ_PARTITIONS ); //cockpit-specific frustrum (with clipping, with frustrum update)
- GFXClear( GFXFALSE, GFXTRUE, GFXFALSE ); //only clear Z
+ zfloor+zrange*(j-1)/COCKPITZ_PARTITIONS,
+ zfloor+zrange*j/COCKPITZ_PARTITIONS ); //cockpit-specific frustrum (with clipping, with frustrum update)
/*if (COCKPITZ_PARTITIONS>1) {
* //Setup stencil
* GFXStencilOp(KEEP,KEEP,REPLACE);
* GFXStencilFunc(LEQUAL,COCKPITZ_PARTITIONS-j,~0);
* GFXStencilMask(~0);
* GFXEnable(STENCIL);
- * };*/
- _Universe->activateLightMap();
+ * };
+ */
for (i = 0; i < mesh.size(); ++i)
- //mesh[i]->DrawNow(1,true,headtrans.front());
- mesh[i]->Draw( FLT_MAX, headtrans.front() );
- //Whether cockpits shouldn't cull faces - not sure why, probably because
- //modellers always set normals the wrong way for cockpits.
- static bool nocockpitcull =
- XMLSupport::parse_bool( vs_config->getVariable( "graphics", "cockpit_no_face_cull", "true" ) );
-
+ mesh[i]->Draw( FLT_MAX, headtrans.back() );
Mesh::ProcessZFarMeshes( true );
- if (nocockpitcull) GFXDisable( CULLFACE );
Mesh::ProcessUndrawnMeshes( false, true );
}
- headtrans.pop_front();
+ headtrans.pop_back();
//if (COCKPITZ_PARTITIONS>1) GFXDisable(STENCIL);
GFXDisable( LIGHTING );
GFXDisable( TEXTURE0 );
Modified: trunk/vegastrike/src/gfxlib.h
===================================================================
--- trunk/vegastrike/src/gfxlib.h 2016-08-15 14:52:15 UTC (rev 13722)
+++ trunk/vegastrike/src/gfxlib.h 2016-08-15 14:54:57 UTC (rev 13723)
@@ -88,6 +88,10 @@
void /*GFXDRVAPI*/ GFXGlobalLights( vector< int > &lights, const Vector ¢er, const float radius );
///loads "lights" with all enabled global lights
void /*GFXDRVAPI*/ GFXGlobalLights( vector< int > &lights );
+///Sets light position offset, use when centering the camera off-origin
+void /*GFXDRVAPI*/ GFXSetLightOffset( const QVector &offset );
+///Sets light position offset, use when centering the camera off-origin
+QVector /*GFXDRVAPI*/ GFXGetLightOffset();
///Sets the light model to have separate specular color (if available)
GFXBOOL /*GFXDRVAPI*/ GFXSetSeparateSpecularColor( const GFXBOOL spec );
///Sets the intensity cutoff before picked lights are ignored
Modified: trunk/vegastrike/src/gldrv/gl_light_state.cpp
===================================================================
--- trunk/vegastrike/src/gldrv/gl_light_state.cpp 2016-08-15 14:52:15 UTC (rev 13722)
+++ trunk/vegastrike/src/gldrv/gl_light_state.cpp 2016-08-15 14:54:57 UTC (rev 13723)
@@ -11,6 +11,18 @@
#define M_PI 3.14159265358979323846264338328
#endif
+QVector _light_offset(0,0,0);
+
+void GFXSetLightOffset( const QVector &offset )
+{
+ _light_offset = offset;
+}
+
+QVector GFXGetLightOffset()
+{
+ return _light_offset;
+}
+
void GFXUploadLightState( int max_light_location, int active_light_array, int apparent_light_size_array, bool shader, vector<int>::const_iterator begin, vector<int>::const_iterator end )
{
// FIXME: (klauss) Very bad thing: static variables initialized with heap-allocated arrays...
@@ -47,7 +59,7 @@
// For two, scaling would be nullified when scaling both distance
// and light size, so it would only waste time.
- QVector lightPos = light.getPosition() - modelview.p;
+ QVector lightPos = light.getPosition() - modelview.p + _light_offset;
double lightDistance = lightPos.Magnitude();
double lightSize = light.getSize() * 0.5;
@@ -224,7 +236,7 @@
void gfx_light::SendGLPosition( const GLenum target ) const
{
- float v[4] = {vect[0], vect[1], vect[2], 1};
+ float v[4] = {vect[0] + _light_offset.x, vect[1] + _light_offset.y, vect[2] + _light_offset.z, 1};
glLightfv( target, GL_POSITION, v );
}
|
|
From: <kla...@us...> - 2016-08-15 14:52:17
|
Revision: 13722
http://sourceforge.net/p/vegastrike/code/13722
Author: klaussfreire
Date: 2016-08-15 14:52:15 +0000 (Mon, 15 Aug 2016)
Log Message:
-----------
Avoid redundant Z-clear when some stages are empty, honor nocamerasetup flag
Modified Paths:
--------------
trunk/vegastrike/src/gfx/mesh_gfx.cpp
Modified: trunk/vegastrike/src/gfx/mesh_gfx.cpp
===================================================================
--- trunk/vegastrike/src/gfx/mesh_gfx.cpp 2016-08-15 14:50:21 UTC (rev 13721)
+++ trunk/vegastrike/src/gfx/mesh_gfx.cpp 2016-08-15 14:52:15 UTC (rev 13722)
@@ -520,23 +520,26 @@
{
int a = NUM_ZBUF_SEQ;
- //clear Z buffer
- GFXClear( GFXFALSE, GFXTRUE, GFXFALSE );
-
- static float far_margin = XMLSupport::parse_float( vs_config->getVariable( "graphics", "mesh_far_percent", ".8" ) );
- _Universe->AccessCamera()->UpdateGFXFrustum( GFXTRUE, g_game.zfar*far_margin, 0 );
-
- std::sort( undrawn_meshes[a].begin(), undrawn_meshes[a].end() );
- for (OrigMeshVector::iterator it = undrawn_meshes[a].begin(); it < undrawn_meshes[a].end(); ++it) {
- Mesh *m = it->orig;
- m->ProcessDrawQueue( it->passno, a, it->zsort, _Universe->AccessCamera()->GetPosition() );
- m->will_be_drawn &= ( ~(1<<a) ); //not accurate any more
+ if (!undrawn_meshes[a].empty()) {
+ //clear Z buffer
+ GFXClear( GFXFALSE, GFXTRUE, GFXFALSE );
+
+ static float far_margin = XMLSupport::parse_float( vs_config->getVariable( "graphics", "mesh_far_percent", ".8" ) );
+ if (!nocamerasetup)
+ _Universe->AccessCamera()->UpdateGFXFrustum( GFXTRUE, g_game.zfar*far_margin, 0 );
+
+ std::sort( undrawn_meshes[a].begin(), undrawn_meshes[a].end() );
+ for (OrigMeshVector::iterator it = undrawn_meshes[a].begin(); it < undrawn_meshes[a].end(); ++it) {
+ Mesh *m = it->orig;
+ m->ProcessDrawQueue( it->passno, a, it->zsort, _Universe->AccessCamera()->GetPosition() );
+ m->will_be_drawn &= ( ~(1<<a) ); //not accurate any more
+ }
+ for (OrigMeshVector::iterator it = undrawn_meshes[a].begin(); it < undrawn_meshes[a].end(); ++it) {
+ Mesh *m = it->orig;
+ m->draw_queue[a].clear();
+ }
+ undrawn_meshes[a].clear();
}
- for (OrigMeshVector::iterator it = undrawn_meshes[a].begin(); it < undrawn_meshes[a].end(); ++it) {
- Mesh *m = it->orig;
- m->draw_queue[a].clear();
- }
- undrawn_meshes[a].clear();
GFXDeactivateShader();
if (gl_options.ext_srgb_framebuffer)
@@ -560,14 +563,20 @@
void Mesh::ProcessUndrawnMeshes( bool pushSpecialEffects, bool nocamerasetup )
{
- //clear Z buffer
- GFXClear( GFXFALSE, GFXTRUE, GFXFALSE );
+ bool zcleared = false;
for (int a = 0; a < NUM_ZBUF_SEQ; a++) {
+ if (undrawn_meshes[a].empty() && undrawn_logos.empty())
+ continue;
+ if (!zcleared) {
+ //clear Z buffer
+ GFXClear( GFXFALSE, GFXTRUE, GFXFALSE );
+ zcleared = true;
+ }
if (a == MESH_SPECIAL_FX_ONLY) {
GFXPushGlobalEffects();
GFXDisable( DEPTHWRITE );
- } else {
+ } else if (!nocamerasetup) {
_Universe->AccessCamera()->UpdateGFXFrustum( GFXTRUE, g_game.znear, g_game.zfar );
}
std::sort( undrawn_meshes[a].begin(), undrawn_meshes[a].end() );
|
|
From: <kla...@us...> - 2016-08-15 14:50:22
|
Revision: 13721
http://sourceforge.net/p/vegastrike/code/13721
Author: klaussfreire
Date: 2016-08-15 14:50:21 +0000 (Mon, 15 Aug 2016)
Log Message:
-----------
Harden BFXM loading against corrupted meshes
Modified Paths:
--------------
trunk/vegastrike/src/gfx/mesh_bxm.cpp
Modified: trunk/vegastrike/src/gfx/mesh_bxm.cpp
===================================================================
--- trunk/vegastrike/src/gfx/mesh_bxm.cpp 2016-07-08 18:56:02 UTC (rev 13720)
+++ trunk/vegastrike/src/gfx/mesh_bxm.cpp 2016-08-15 14:50:21 UTC (rev 13721)
@@ -281,20 +281,28 @@
fseek( Inputfile, 4+sizeof (uint32bit), SEEK_SET );
fread( &intbuf, sizeof (uint32bit), 1, Inputfile ); //Length of Inputfile
uint32bit Inputlength = VSSwapHostIntToLittle( intbuf );
+ if (Inputlength < sizeof(uint32bit)*13 || Inputlength > (1<<30)) {
+ fprintf( stderr, "Corrupt file %s, aborting\n", Inputfile.GetFilename().c_str() );
+ exit( -1 );
+ }
inmemfile = (chunk32*) malloc( Inputlength+1 );
if (!inmemfile) {
- fprintf( stderr, "Buffer allocation failed, Aborting" );
- exit( -1 );
+ fprintf( stderr, "Buffer allocation failed, Aborting\n" );
+ exit( -2 );
}
rewind( Inputfile );
fread( inmemfile, 1, Inputlength, Inputfile );
fcloseInput( Inputfile );
#else
uint32bit Inputlength = Inputfile.Size();
+ if (Inputlength < sizeof(uint32bit)*13 || Inputlength > (1<<30)) {
+ fprintf( stderr, "Corrupt file %s, aborting\n", Inputfile.GetFilename().c_str() );
+ abort();
+ }
inmemfile = (chunk32*) malloc( Inputlength );
if (!inmemfile) {
- fprintf( stderr, "Buffer allocation failed, Aborting" );
- exit( -1 );
+ fprintf( stderr, "Buffer allocation failed, Aborting\n" );
+ exit( -2 );
}
Inputfile.Read( inmemfile, Inputlength );
Inputfile.Close();
|
|
From: <kla...@us...> - 2016-07-08 18:56:05
|
Revision: 13720
http://sourceforge.net/p/vegastrike/code/13720
Author: klaussfreire
Date: 2016-07-08 18:56:02 +0000 (Fri, 08 Jul 2016)
Log Message:
-----------
Remove redundant VS_PI declaration from unit_xml
Modified Paths:
--------------
trunk/vegastrike/src/cmd/unit_xml.cpp
Modified: trunk/vegastrike/src/cmd/unit_xml.cpp
===================================================================
--- trunk/vegastrike/src/cmd/unit_xml.cpp 2016-07-08 07:07:07 UTC (rev 13719)
+++ trunk/vegastrike/src/cmd/unit_xml.cpp 2016-07-08 18:56:02 UTC (rev 13720)
@@ -26,8 +26,6 @@
using namespace XMLSupport;
-#define VS_PI (3.1415926536)
-
/*ADDED FOR extensible use of unit pretty print and unit load */
UNITLOADTYPE current_unit_load_mode = DEFAULT;
extern float getFuelConversion();
|
|
From: <kla...@us...> - 2016-07-08 07:07:10
|
Revision: 13719
http://sourceforge.net/p/vegastrike/code/13719
Author: klaussfreire
Date: 2016-07-08 07:07:07 +0000 (Fri, 08 Jul 2016)
Log Message:
-----------
Fix upgrade description generation to avoid bogus output with the
"recently" introduced splitting of units.csv, which makes a lot of
missing fields have default values. Detect no-ops (0 for additive) and
defaults, and skip those attributes in the listings.
Modified Paths:
--------------
trunk/vegastrike/src/cmd/basecomputer.cpp
trunk/vegastrike/src/cmd/unit_csv.cpp
trunk/vegastrike/src/vs_math.h
Modified: trunk/vegastrike/src/cmd/basecomputer.cpp
===================================================================
--- trunk/vegastrike/src/cmd/basecomputer.cpp 2016-07-03 07:41:16 UTC (rev 13718)
+++ trunk/vegastrike/src/cmd/basecomputer.cpp 2016-07-08 07:07:07 UTC (rev 13719)
@@ -440,7 +440,14 @@
} \
while (0)
+#define MODIFIES( mode, playerUnit, blankUnit, what ) \
+ ( (((playerUnit) -> what) != 0) \
+ && ( (mode != 0) || (((playerUnit) -> what) != ((blankUnit) -> what)) ) )
+#define MODIFIES_ALTEMPTY( mode, playerUnit, blankUnit, what, empty ) \
+ ( (((playerUnit) -> what) != (empty)) \
+ && ( (mode != 0) || (((playerUnit) -> what) != ((blankUnit) -> what)) ) )
+
//CONSTRUCTOR.
BaseComputer::BaseComputer( Unit *player, Unit *base, const std::vector< DisplayMode > &modes ) :
m_displayModes( modes )
@@ -4984,8 +4991,8 @@
break;
}
}
- const Unit::Computer uc = playerUnit->ViewComputerData();
- const Unit::Computer buc = blankUnit->ViewComputerData();
+ const Unit::Computer &uc = playerUnit->ViewComputerData();
+ const Unit::Computer &buc = blankUnit->ViewComputerData();
if (!mode) {
text += "#n##n#"+prefix+"#c0:1:.5#[FLIGHT CHARACTERISTICS]#n##-c";
text += "#n#"+prefix+statcolor+"Turning response: #-c";
@@ -4996,7 +5003,7 @@
if (!mode) {
text += conversionBuffer;
text += " radians/second^2#n#"+expstatcolor+" (yaw, pitch, roll)#-c";
- } else if (playerUnit->limits.yaw != blankUnit->limits.yaw) {
+ } else if (MODIFIES(replacement_mode, playerUnit, blankUnit, limits.yaw)) {
switch (replacement_mode)
{
case 0: //Replacement or new Module
@@ -5025,8 +5032,9 @@
PRETTY_ADDN( substatcolor+" pitch #-c", playerUnit->limits.pitch/(moment), 4 );
PRETTY_ADDN( substatcolor+" roll #-c", playerUnit->limits.roll/(moment), 4 );
text += " radians/second^2";
- } else if (playerUnit->limits.yaw != blankUnit->limits.yaw || playerUnit->limits.pitch != blankUnit->limits.pitch
- || playerUnit->limits.roll != blankUnit->limits.roll) {
+ } else if (MODIFIES(replacement_mode, playerUnit, blankUnit, limits.yaw)
+ || MODIFIES(replacement_mode, playerUnit, blankUnit, limits.pitch)
+ || MODIFIES(replacement_mode, playerUnit, blankUnit, limits.roll)) {
switch (replacement_mode)
{
case 0: //Replacement or new Module
@@ -5078,31 +5086,31 @@
switch (replacement_mode)
{
case 0: //Replacement or new Module
- if (playerUnit->limits.forward != blankUnit->limits.forward) {
+ if (MODIFIES(replacement_mode, playerUnit, blankUnit, limits.forward)) {
PRETTY_ADDU( statcolor+"Provides forward thrust rated at: #-c",
playerUnit->limits.forward/1000.0,
2,
"MegaNewtons" );
}
- if (playerUnit->limits.retro != blankUnit->limits.retro) {
+ if (MODIFIES(replacement_mode, playerUnit, blankUnit, limits.retro)) {
PRETTY_ADDU( statcolor+"Provides aftward thrust rated at: #-c",
playerUnit->limits.retro/1000.0,
2,
"MegaNewtons" );
}
- if (playerUnit->limits.vertical != blankUnit->limits.vertical) {
+ if (MODIFIES(replacement_mode, playerUnit, blankUnit, limits.vertical)) {
PRETTY_ADDU( statcolor+"Provides vertical thrust rated at: #-c",
playerUnit->limits.vertical/1000.0,
2,
"MegaNewtons" );
}
- if (playerUnit->limits.lateral != blankUnit->limits.lateral) {
+ if (MODIFIES(replacement_mode, playerUnit, blankUnit, limits.lateral)) {
PRETTY_ADDU( statcolor+"Provides lateral thrust rated at: #-c",
playerUnit->limits.lateral/1000.0,
2,
"MegaNewtons" );
}
- if (playerUnit->limits.afterburn != blankUnit->limits.afterburn) {
+ if (MODIFIES(replacement_mode, playerUnit, blankUnit, limits.afterburn)) {
PRETTY_ADDU( statcolor+"Overdrive thrust rated at: #-c",
playerUnit->limits.afterburn/1000.0,
2,
@@ -5110,31 +5118,31 @@
}
break;
case 1: //Additive
- if (playerUnit->limits.forward != blankUnit->limits.forward) {
+ if (MODIFIES(replacement_mode, playerUnit, blankUnit, limits.forward)) {
PRETTY_ADDU( statcolor+"Increases forward thrust rating by: #-c",
playerUnit->limits.forward/1000.0,
2,
"MegaNewtons" );
}
- if (playerUnit->limits.retro != blankUnit->limits.retro) {
+ if (MODIFIES(replacement_mode, playerUnit, blankUnit, limits.retro)) {
PRETTY_ADDU( statcolor+"Increases aftward thrust rating by: #-c",
playerUnit->limits.retro/1000.0,
2,
"MegaNewtons" );
}
- if (playerUnit->limits.vertical != blankUnit->limits.vertical) {
+ if (MODIFIES(replacement_mode, playerUnit, blankUnit, limits.vertical)) {
PRETTY_ADDU( statcolor+"Increases vertical thrust rating by: #-c",
playerUnit->limits.vertical/1000.0,
2,
"MegaNewtons" );
}
- if (playerUnit->limits.lateral != blankUnit->limits.lateral) {
+ if (MODIFIES(replacement_mode, playerUnit, blankUnit, limits.lateral)) {
PRETTY_ADDU( statcolor+"Increases lateral thrust rating by: #-c",
playerUnit->limits.lateral/1000.0,
2,
"MegaNewtons" );
}
- if (playerUnit->limits.afterburn != blankUnit->limits.afterburn) {
+ if (MODIFIES(replacement_mode, playerUnit, blankUnit, limits.afterburn)) {
PRETTY_ADDU( statcolor+"Increases overdrive thrust rating by: #-c",
playerUnit->limits.afterburn/1000.0,
2,
@@ -5142,31 +5150,31 @@
}
break;
case 2: //multiplicative
- if (playerUnit->limits.forward != blankUnit->limits.forward) {
+ if (MODIFIES(replacement_mode, playerUnit, blankUnit, limits.forward)) {
PRETTY_ADDU( statcolor+"Increases forward thrust rating by: #-c",
(playerUnit->limits.forward-1)*100,
0,
"%" );
}
- if (playerUnit->limits.retro != blankUnit->limits.retro) {
+ if (MODIFIES(replacement_mode, playerUnit, blankUnit, limits.retro)) {
PRETTY_ADDU( statcolor+"Increases aftward thrust rating by: #-c",
(playerUnit->limits.retro-1)*100,
0,
"%" );
}
- if (playerUnit->limits.vertical != blankUnit->limits.vertical) {
+ if (MODIFIES(replacement_mode, playerUnit, blankUnit, limits.vertical)) {
PRETTY_ADDU( statcolor+"Increases vertical thrust rating by: #-c",
(playerUnit->limits.vertical-1)*100,
0,
"%" );
}
- if (playerUnit->limits.lateral != blankUnit->limits.lateral) {
+ if (MODIFIES(replacement_mode, playerUnit, blankUnit, limits.lateral)) {
PRETTY_ADDU( statcolor+"Increases lateral thrust rating by: #-c",
(playerUnit->limits.lateral-1)*100,
0,
"%" );
}
- if (playerUnit->limits.afterburn != blankUnit->limits.afterburn)
+ if (MODIFIES(replacement_mode, playerUnit, blankUnit, limits.afterburn))
PRETTY_ADDU( statcolor+"Overdrive thrust rating by: #-c", (playerUnit->limits.afterburn-1)*100, 0, "%" );
break;
default: //Failure
@@ -5184,32 +5192,32 @@
switch (replacement_mode)
{
case 0: //Replacement or new Module
- if ( uc.max_speed() != buc.max_speed() ) {
+ if ( MODIFIES(replacement_mode, &uc, &buc, max_speed()) ) {
PRETTY_ADDU( statcolor+"Sets max combat speed governor to: #-c", uc.max_speed(), 0, "m/s" );
PRETTY_ADDU( statcolor+"Sets max non-combat speed governor to: #-c",
uc.max_speed()*non_combat_mode_mult, 0, "m/s" );
}
- if ( uc.max_ab_speed() != buc.max_ab_speed() )
+ if ( MODIFIES(replacement_mode, &uc, &buc, max_ab_speed()) )
PRETTY_ADDU( statcolor+"Sets max overdrive combat speed governor to: #-c", uc.max_ab_speed(), 0, "m/s" );
break;
case 1: //Additive
- if ( uc.max_speed() != buc.max_speed() ) {
+ if ( MODIFIES(replacement_mode, &uc, &buc, max_speed()) ) {
PRETTY_ADDU( statcolor+"Increases max combat speed governor setting by: #-c", uc.max_speed(), 0, "m/s" );
PRETTY_ADDU( statcolor+"Increases max non-combat speed governor setting by: #-c",
uc.max_speed()*non_combat_mode_mult, 0, "m/s" );
}
- if ( uc.max_ab_speed() != buc.max_ab_speed() )
+ if ( MODIFIES(replacement_mode, &uc, &buc, max_ab_speed()) )
PRETTY_ADDU( statcolor+"Increases max overdrive combat speed governor setting by: #-c",
uc.max_ab_speed(), 0, "m/s" );
break;
case 2: //multiplicative
- if ( uc.max_speed() != buc.max_speed() ) {
+ if ( MODIFIES(replacement_mode, &uc, &buc, max_speed()) ) {
PRETTY_ADDU( statcolor+"Increases max combat speed governor settings by: #-c",
100.0*(uc.max_speed()-1), 0, "%" );
PRETTY_ADDU( statcolor+"Increases max non-combat speed governor settings by: #-c",
100.0*(uc.max_speed()-1), 0, "%" );
}
- if ( uc.max_ab_speed() != buc.max_ab_speed() )
+ if ( MODIFIES(replacement_mode, &uc, &buc, max_ab_speed()) )
PRETTY_ADDU( statcolor+"Increases max overdrive combat speed governor settings by: #-c",
(uc.max_ab_speed()-1)*100, 0, "%" );
break;
@@ -5230,8 +5238,9 @@
PRETTY_ADDU( substatcolor+" - roll: #-c", uc.max_roll_right, 2, "radians/second" );
}
text += "#n##n##c0:1:.5#"+prefix+"[TARGETTING SUBSYSTEM]#n##-c";
- } else if (uc.max_yaw_right != buc.max_yaw_right || uc.max_pitch_up != buc.max_pitch_up || uc.max_roll_right
- != buc.max_roll_right) {
+ } else if (MODIFIES(replacement_mode, &uc, &buc, max_yaw_right)
+ || MODIFIES(replacement_mode, &uc, &buc, max_pitch_up)
+ || MODIFIES(replacement_mode, &uc, &buc, max_roll_right)) {
switch (replacement_mode)
{
case 0: //Replacement or new Module
@@ -5291,7 +5300,9 @@
switch (replacement_mode)
{
case 0: //Replacement or new Module
- if (uc.radar.maxrange != buc.radar.maxrange || uc.radar.maxcone != buc.radar.maxcone) {
+ if (MODIFIES_ALTEMPTY(replacement_mode, &uc, &buc, radar.maxrange, FLT_MAX)
+ || MODIFIES_ALTEMPTY(replacement_mode, &uc, &buc, radar.maxcone, VS_PI))
+ {
PRETTY_ADDU( statcolor+"Tracking range: #-c", uc.radar.maxrange/1000, 0, "km" );
if ( (acos( uc.radar.maxcone )*360/PI) < 359 ) {
PRETTY_ADDU( statcolor+"Tracking cone: #-c", acos( uc.radar.maxcone )*2, 2, "radians" );
@@ -5365,13 +5376,13 @@
switch (replacement_mode)
{
case 0: //Replacement or new Module
- if ( playerUnit->EnergyRechargeData() != blankUnit->EnergyRechargeData() )
+ if ( MODIFIES(replacement_mode, playerUnit, blankUnit, EnergyRechargeData()) )
PRETTY_ADDU( statcolor+"Installs reactor with recharge rate: #-c",
playerUnit->EnergyRechargeData()*RSconverter, 0, "MJ/s" );
- if ( playerUnit->MaxEnergyData() != blankUnit->MaxEnergyData() )
+ if ( MODIFIES(replacement_mode, playerUnit, blankUnit, MaxEnergyData()) )
PRETTY_ADDU( statcolor+"Installs main capacitor bank with storage capacity: #-c",
(playerUnit->MaxEnergyData()*RSconverter), 0, "MJ" );
- if ( playerUnit->GetWarpEnergy() != blankUnit->GetWarpEnergy() )
+ if ( MODIFIES(replacement_mode, playerUnit, blankUnit, GetWarpEnergy()) )
PRETTY_ADDU( statcolor+"Installs warp capacitor bank with storage capacity: #-c",
playerUnit->GetWarpEnergy()*RSconverter*Wconv, 0, "MJ" );
if (buj.drive != uj.drive) {
@@ -5381,24 +5392,24 @@
}
break;
case 1: //Additive
- if ( playerUnit->EnergyRechargeData() != blankUnit->EnergyRechargeData() )
+ if ( MODIFIES(replacement_mode, playerUnit, blankUnit, EnergyRechargeData()) )
PRETTY_ADDU( statcolor+"Increases recharge rate by #-c",
playerUnit->EnergyRechargeData()*RSconverter, 0, "MJ/s" );
- if ( playerUnit->MaxEnergyData() != blankUnit->MaxEnergyData() )
+ if ( MODIFIES(replacement_mode, playerUnit, blankUnit, MaxEnergyData()) )
PRETTY_ADDU( statcolor+"Adds #-c",
(playerUnit->MaxEnergyData()*RSconverter), 0, "MJ of storage to main capacitor banks" );
- if ( playerUnit->GetWarpEnergy() != blankUnit->GetWarpEnergy() )
+ if ( MODIFIES(replacement_mode, playerUnit, blankUnit, GetWarpEnergy()) )
PRETTY_ADDU( statcolor+"Adds #-c",
playerUnit->GetWarpEnergy()*RSconverter*Wconv, 0, "MJ of storage to warp capacitor bank" );
break;
case 2: //multiplicative
- if ( playerUnit->EnergyRechargeData() != blankUnit->EnergyRechargeData() )
+ if ( MODIFIES(replacement_mode, playerUnit, blankUnit, EnergyRechargeData()) )
PRETTY_ADDU( statcolor+"Increases reactor recharge rate by #-c",
100.0*(playerUnit->EnergyRechargeData()-1), 0, "%" );
- if ( playerUnit->MaxEnergyData() != blankUnit->MaxEnergyData() )
+ if ( MODIFIES(replacement_mode, playerUnit, blankUnit, MaxEnergyData()) )
PRETTY_ADDU( statcolor+"Increases main capacitor bank storage by #-c",
100.0*(playerUnit->MaxEnergyData()-1), 0, "%" );
- if ( playerUnit->GetWarpEnergy() != blankUnit->GetWarpEnergy() )
+ if ( MODIFIES(replacement_mode, playerUnit, blankUnit, GetWarpEnergy()) )
PRETTY_ADDU( statcolor+"Increases warp capacitor bank storage by #-c",
(playerUnit->GetWarpEnergy()-1)*100, 0, "%" );
break;
@@ -5411,7 +5422,7 @@
text += "#n##n##c0:1:.5#"+prefix+"[DURABILITY STATISTICS]#n##-c";
text += "#n#"+prefix+statcolor+"Armor damage resistance:#-c";
}
- if (mode && playerUnit->armor.frontlefttop != blankUnit->armor.frontlefttop) {
+ if (mode && MODIFIES(replacement_mode, playerUnit, blankUnit, armor.frontlefttop)) {
switch (replacement_mode)
{
case 0: //Replacement or new Module
@@ -5428,7 +5439,7 @@
break;
}
}
- if (!mode || playerUnit->armor.frontrighttop != blankUnit->armor.frontrighttop) {
+ if (!mode || MODIFIES(replacement_mode, playerUnit, blankUnit, armor.frontrighttop)) {
PRETTY_ADDU(
substatcolor+" - Fore-starboard-high: #-c",
(mode && replacement_mode
@@ -5485,7 +5496,7 @@
PRETTY_ADD( " Current condition: ", playerUnit->GetHullPercent()*100, 2 );
text += "% of normal";
}
- } else if ( playerUnit->GetHull() != blankUnit->GetHull() ) {
+ } else if ( MODIFIES(replacement_mode, playerUnit, blankUnit, GetHull()) ) {
switch (replacement_mode)
{
case 0: //Replacement or new Module
@@ -5512,9 +5523,9 @@
text += "#n#"+prefix+statcolor+"No shielding. #-c";
}
} else if ( playerUnit->shield.number
- && ( (playerUnit->shield.shield2fb.frontmax != blankUnit->shield.shield2fb.frontmax)
- || (playerUnit->shield.shield4fbrl.frontmax != blankUnit->shield.shield4fbrl.frontmax)
- || (playerUnit->shield.shield8.frontrightbottommax != blankUnit->shield.shield8.frontrightbottommax) ) ) {
+ && ( MODIFIES(replacement_mode, playerUnit, blankUnit, shield.shield2fb.frontmax)
+ || MODIFIES(replacement_mode, playerUnit, blankUnit, shield.shield4fbrl.frontmax)
+ || MODIFIES(replacement_mode, playerUnit, blankUnit, shield.shield8.frontrightbottommax) ) ) {
switch (replacement_mode)
{
case 0: //Replacement or new Module
@@ -5536,7 +5547,7 @@
case 0:
break;
case 2:
- if (!mode || playerUnit->shield.shield2fb.frontmax != blankUnit->shield.shield2fb.frontmax) {
+ if (!mode || MODIFIES(replacement_mode, playerUnit, blankUnit, shield.shield2fb.frontmax)) {
PRETTY_ADDU(
substatcolor+" - fore: #-c",
(mode && replacement_mode == 2) ? ( 100.0
@@ -5554,7 +5565,7 @@
}
break;
case 4:
- if (!mode || playerUnit->shield.shield4fbrl.frontmax != blankUnit->shield.shield4fbrl.frontmax) {
+ if (!mode || MODIFIES(replacement_mode, playerUnit, blankUnit, shield.shield4fbrl.frontmax)) {
PRETTY_ADDU(
substatcolor+" - fore: #-c",
(mode && replacement_mode == 2) ? ( 100.0
@@ -5586,7 +5597,7 @@
}
break;
case 8:
- if (!mode || playerUnit->shield.shield8.frontrightbottommax != blankUnit->shield.shield8.frontrightbottommax) {
+ if (!mode || MODIFIES(replacement_mode, playerUnit, blankUnit, shield.shield8.frontrightbottommax)) {
PRETTY_ADDU(
statcolor+" - Fore-starboard-high: #-c",
(mode && replacement_mode
@@ -5651,7 +5662,7 @@
}
if (!mode) {
PRETTY_ADDU( statcolor+"Shield protection recharge speed: #-c", playerUnit->shield.recharge*VSDM, 0, "MJ/s" );
- } else if (playerUnit->shield.recharge != blankUnit->shield.recharge) {
+ } else if (MODIFIES(replacement_mode, playerUnit, blankUnit, shield.recharge)) {
switch (replacement_mode)
{
case 0: //Replacement or new Module
@@ -5913,6 +5924,8 @@
showUnitStats( sub, text, subunitlevel+1, 0, item );
}
}
+ //last line sometimes gets lost in the interface
+ text += "#n#";
}
//Show the stats on the player's current ship.
Modified: trunk/vegastrike/src/cmd/unit_csv.cpp
===================================================================
--- trunk/vegastrike/src/cmd/unit_csv.cpp 2016-07-03 07:41:16 UTC (rev 13718)
+++ trunk/vegastrike/src/cmd/unit_csv.cpp 2016-07-08 07:07:07 UTC (rev 13719)
@@ -17,7 +17,6 @@
#include <algorithm>
#include "lin_time.h"
#include "unit_const_cache.h"
-#define VS_PI 3.1415926535897931
CSVRow LookupUnitRow( const string &unitname, const string &faction )
{
Modified: trunk/vegastrike/src/vs_math.h
===================================================================
--- trunk/vegastrike/src/vs_math.h 2016-07-03 07:41:16 UTC (rev 13718)
+++ trunk/vegastrike/src/vs_math.h 2016-07-08 07:07:07 UTC (rev 13719)
@@ -54,4 +54,6 @@
#define ISNAN( x ) ( _isnan( x ) )
#endif
+#define VS_PI 3.1415926535897931
+
#endif // _VS_MATH_H_
|
|
From: <kla...@us...> - 2016-07-03 07:41:20
|
Revision: 13718
http://sourceforge.net/p/vegastrike/code/13718
Author: klaussfreire
Date: 2016-07-03 07:41:16 +0000 (Sun, 03 Jul 2016)
Log Message:
-----------
Fix missiles not always impacting on target due to botched collision
checks. Fix missiles never damaging asteroids due to not checking for
subunits when applying damage. Add debugging output that is useful when
debugging those issues.
Modified Paths:
--------------
trunk/vegastrike/src/cmd/missile.h
trunk/vegastrike/src/cmd/missile_generic.cpp
trunk/vegastrike/src/cmd/missile_generic.h
Modified: trunk/vegastrike/src/cmd/missile.h
===================================================================
--- trunk/vegastrike/src/cmd/missile.h 2016-07-03 07:37:58 UTC (rev 13717)
+++ trunk/vegastrike/src/cmd/missile.h 2016-07-03 07:41:16 UTC (rev 13718)
@@ -77,19 +77,6 @@
CumulativeVelocity,
ResolveLast,
uc );
- this->time -= SIMULATION_ATOM;
- if (NULL != targ) {
- float checker = targ->querySphere( Position()-( SIMULATION_ATOM*GetVelocity() ), Position(), rSize() );
- if ( (checker
- && detonation_radius >= 0)
- || ( ( Position()-targ->Position() ).Magnitude()-targ->rSize()-rSize() < detonation_radius ) ) {
- Discharge();
- time = -1;
- //}
- }
- }
- if (time < 0)
- DealDamageToHull( Vector( .1, .1, .1 ), hull+1 );
}
private:
Modified: trunk/vegastrike/src/cmd/missile_generic.cpp
===================================================================
--- trunk/vegastrike/src/cmd/missile_generic.cpp 2016-07-03 07:37:58 UTC (rev 13717)
+++ trunk/vegastrike/src/cmd/missile_generic.cpp 2016-07-03 07:41:16 UTC (rev 13718)
@@ -11,6 +11,7 @@
#include "ai/order.h"
#include "faction_generic.h"
#include "unit_util.h"
+#include "vsfilesystem.h"
void StarSystem::UpdateMissiles()
{
//if false, missiles collide with rocks as units, but not harm them with explosions
@@ -37,10 +38,58 @@
dischargedMissiles.pop_back();
}
}
+
+void MissileEffect::DoApplyDamage(Unit *parent, Unit *un, float distance, float damage_fraction)
+{
+ QVector norm = pos-un->Position();
+ norm.Normalize();
+ float damage_left = 1.f;
+ if (un->hasSubUnits()) {
+ /*
+ * Compute damage aspect ratio of each subunit with their apparent size ( (radius/distance)^2 )
+ * and spread damage across affected subunits based on their apparent size vs total spread surface
+ */
+ double total_area = 0.0f;
+ {
+ un_kiter ki = un->viewSubUnits();
+ for (const Unit *subun; (subun = *ki); ++ki) {
+ if (subun->Killed()) continue;
+ double r = subun->rSize();
+ double d = (pos - subun->Position()).Magnitude() - r;
+ if (d > radius) continue;
+ if (d < 0.01) d = 0.01;
+ total_area += (r*r) / (d*d);
+ }
+ }
+ if (total_area > 0)
+ VSFileSystem::vs_dprintf( 1, "Missile subunit damage of %.3f%%\n", (total_area * (100.0 / 4.0*M_PI)) );
+ if (total_area < 4.0*M_PI) total_area = 4.0*M_PI;
+
+ un_iter i = un->getSubUnits();
+ for (Unit *subun; (subun = *i); ++i) {
+ if (subun->Killed()) continue;
+ double r = subun->rSize();
+ double d = (pos - subun->Position()).Magnitude() - r;
+ if (d > radius) continue;
+ if (d < 0.01) d = 0.01;
+ double a = (r*r) / (d*d*total_area);
+ DoApplyDamage(parent, subun, d, a * damage_fraction);
+ damage_left -= a;
+ }
+ }
+ if (damage_left > 0) {
+ VSFileSystem::vs_dprintf( 1, "Missile damaging %s/%s (dist=%.3f r=%.3f dmg=%.3f)\n",
+ parent->name.get().c_str(), ((un == parent) ? "." : un->name.get().c_str()), distance, radius, damage*damage_fraction*damage_left);
+ parent->ApplyDamage( pos.Cast(), norm, damage*damage_fraction*damage_left, un, GFXColor( 1,1,1,1 ),
+ ownerDoNotDereference, phasedamage*damage_fraction*damage_left );
+ }
+}
+
void MissileEffect::ApplyDamage( Unit *smaller )
{
QVector norm = pos-smaller->Position();
- float distance = norm.Magnitude()-smaller->rSize(); // no better check than the bounding sphere for now
+ float smaller_rsize = smaller->rSize();
+ float distance = norm.Magnitude()-smaller_rsize; // no better check than the bounding sphere for now
if ( distance < radius) { // "smaller->isUnit() != MISSILEPTR &&" was removed - why disable antimissiles?
if ( distance < 0)
distance = 0.f; //it's inside the bounding sphere, so we'll not reduce the effect
@@ -62,9 +111,7 @@
* Kfar = longrange/(R/Rm)^2
* or Kapprox = longrange/(longrange-(R/Rm)^3*(1-longrange)) ; obviously, with more checks preventing /0
*/
- norm.Normalize();
- smaller->ApplyDamage( pos.Cast(), norm, damage*damage_mul, smaller, GFXColor( 1,1,1,1 ),
- ownerDoNotDereference, phasedamage*damage_mul );
+ DoApplyDamage(smaller, smaller, distance, damage_mul);
}
}
@@ -82,13 +129,19 @@
}
void Missile::Discharge()
{
- if ( (damage != 0 || phasedamage != 0) && !discharged )
+ if ( (damage != 0 || phasedamage != 0) && !discharged ) {
+ Unit *targ = Unit::Target();
+ VSFileSystem::vs_dprintf( 1, "Missile discharged (target %s)\n", (targ != NULL) ? targ->name.get().c_str() : "NULL");
_Universe->activeStarSystem()->AddMissileToQueue( new MissileEffect( Position(), damage, phasedamage,
radial_effect, radial_multiplier, owner ) );
+ }
+
discharged = true;
}
void Missile::Kill( bool erase )
{
+ Unit *targ = Unit::Target();
+ VSFileSystem::vs_dprintf( 1, "Missile killed (target %s)\n", (targ != NULL) ? targ->name.get().c_str() : "NULL");
Discharge();
Unit::Kill( erase );
}
@@ -102,6 +155,7 @@
static bool doesmissilebounce = XMLSupport::parse_bool( vs_config->getVariable( "physics", "missile_bounce", "false" ) );
if (doesmissilebounce)
Unit::reactToCollision( smaller, biglocation, bignormal, smalllocation, smallnormal, dist );
+ VSFileSystem::vs_dprintf( 1, "Missile collided with %s\n", smaller->name.get().c_str());
if (smaller->isUnit() != MISSILEPTR) {
//2 missiles in a row can't hit each other
this->Velocity = smaller->Velocity;
@@ -205,16 +259,22 @@
}
Unit::UpdatePhysics2( trans, old_physical_state, accel, difficulty, transmat, CumulativeVelocity, ResolveLast, uc );
this->time -= SIMULATION_ATOM;
- if (NULL != targ) {
- float checker = targ->querySphere( Position()-( SIMULATION_ATOM*GetVelocity() ), Position(), rSize() );
- if ( (checker
- && detonation_radius >= 0)
- || ( ( Position()-targ->Position() ).Magnitude()-targ->rSize()-rSize() < detonation_radius ) ) {
+ if (NULL != targ && !discharged) {
+ QVector endpos = Position();
+ QVector startpos = endpos-( SIMULATION_ATOM*GetVelocity() );
+ float checker = targ->querySphere( startpos, endpos, rSize() );
+ if ( checker && detonation_radius >= 0 ) {
+ // Set position to the collision point
+ SetPosition(startpos + (endpos - startpos) * checker);
+ }
+ if ( checker && detonation_radius >= 0 ) {
//spiritplumber assumes that the missile is hitting a much larger object than itself
static float percent_missile_match_target_velocity =
- XMLSupport::parse_float( vs_config->getVariable( "physics", "percent_missile_match_target_velocity", ".5" ) );
+ XMLSupport::parse_float( vs_config->getVariable( "physics", "percent_missile_match_target_velocity", "1.0" ) );
this->Velocity += percent_missile_match_target_velocity*(targ->Velocity-this->Velocity);
+
+ VSFileSystem::vs_dprintf( 1, "Missile hit target %s (time %.3f)\n", targ->name.get().c_str(), time);
Discharge();
time = -1;
//Vector norm;
Modified: trunk/vegastrike/src/cmd/missile_generic.h
===================================================================
--- trunk/vegastrike/src/cmd/missile_generic.h 2016-07-03 07:37:58 UTC (rev 13717)
+++ trunk/vegastrike/src/cmd/missile_generic.h 2016-07-03 07:41:16 UTC (rev 13718)
@@ -10,6 +10,7 @@
float radius;
float radialmultiplier;
void *ownerDoNotDereference;
+ void DoApplyDamage( Unit *parent, Unit *un, float distance, float damage_fraction );
public:
void ApplyDamage( Unit* );
MissileEffect( const QVector &pos, float dam, float pdam, float radius, float radmult, void *owner ) : pos( pos )
|
|
From: <kla...@us...> - 2016-07-03 07:38:01
|
Revision: 13717
http://sourceforge.net/p/vegastrike/code/13717
Author: klaussfreire
Date: 2016-07-03 07:37:58 +0000 (Sun, 03 Jul 2016)
Log Message:
-----------
Fix querySphere to ignore meshless units that have subunits.
Fixes missiles exploding in your face if you fire them inside an
asteroid field.
Modified Paths:
--------------
trunk/vegastrike/src/cmd/unit_collide.cpp
Modified: trunk/vegastrike/src/cmd/unit_collide.cpp
===================================================================
--- trunk/vegastrike/src/cmd/unit_collide.cpp 2016-07-03 07:34:16 UTC (rev 13716)
+++ trunk/vegastrike/src/cmd/unit_collide.cpp 2016-07-03 07:37:58 UTC (rev 13717)
@@ -19,6 +19,7 @@
#include "vs_globals.h"
#include "configxml.h"
#include "collide.h"
+#include "vsfilesystem.h"
static bool operator==( const Collidable &a, const Collidable &b )
{
return memcmp( &a, &b, sizeof (Collidable) ) == 0;
@@ -466,8 +467,13 @@
if ( ( tmp = un->querySphere( start, end, min_radius ) ) != 0 )
return tmp;
}
+ if (nummesh())
+ return querySphereNoRecurse( start, end, min_radius );
+ else
+ return 0.0f;
+ } else {
+ return querySphereNoRecurse( start, end, min_radius );
}
- return querySphereNoRecurse( start, end, min_radius );
}
//does not check inside sphere
|
|
From: <kla...@us...> - 2016-07-03 07:34:19
|
Revision: 13716
http://sourceforge.net/p/vegastrike/code/13716
Author: klaussfreire
Date: 2016-07-03 07:34:16 +0000 (Sun, 03 Jul 2016)
Log Message:
-----------
Add some more debugging output, and other minor improvements
Modified Paths:
--------------
trunk/vegastrike/src/cmd/unit_generic.cpp
Modified: trunk/vegastrike/src/cmd/unit_generic.cpp
===================================================================
--- trunk/vegastrike/src/cmd/unit_generic.cpp 2016-07-03 07:29:34 UTC (rev 13715)
+++ trunk/vegastrike/src/cmd/unit_generic.cpp 2016-07-03 07:34:16 UTC (rev 13716)
@@ -187,19 +187,19 @@
Vector Unit::GetWarpVelocity() const
{
- Vector VelocityRef( 0, 0, 0 );
- {
- Unit *vr = const_cast< UnitContainer* > (&computer.velocity_ref)->GetUnit();
- if (vr)
- VelocityRef = vr->cumulative_velocity;
- }
-
- Vector vel = cumulative_velocity-VelocityRef;
if (graphicOptions.WarpFieldStrength == 1.) {
// Short circuit, most ships won't be at warp, so it simplifies math a lot
- return vel+VelocityRef;
+ return cumulative_velocity;
} else {
+ Vector VelocityRef( 0, 0, 0 );
+ {
+ Unit *vr = const_cast< UnitContainer* > (&computer.velocity_ref)->GetUnit();
+ if (vr)
+ VelocityRef = vr->cumulative_velocity;
+ }
+
//return(cumulative_velocity*graphicOptions.WarpFieldStrength);
+ Vector vel = cumulative_velocity-VelocityRef;
float speed = vel.Magnitude();
//return vel*graphicOptions.WarpFieldStrength;
if (speed > 0) {
@@ -853,6 +853,7 @@
VSFileSystem::vs_fprintf( stderr, "Assumed exit on unit %s(if not quitting, report error)\n", name.get().c_str() );
if (ucref)
VSFileSystem::vs_fprintf( stderr, "DISASTER AREA!!!!" );
+ VSFileSystem::vs_dprintf( 3, "Deallocating unit %s addr=0x%08x refs=%d\n", name.get().c_str(), this, ucref );
#ifdef DESTRUCTDEBUG
VSFileSystem::vs_fprintf( stderr, "stage %d %x %d\n", 0, this, ucref );
fflush( stderr );
@@ -2253,9 +2254,6 @@
//Well, wasn't skipped actually, but...
this->last_processed_sqs = cur_sim_frame;
this->cur_sim_queue_slot = (cur_sim_frame+this->sim_atom_multiplier)%SIM_QUEUE_SIZE;
- if (maxhull < 0) {
- this->Explode( true, 0 );
- }
Transformation old_physical_state = curr_physical_state;
if (docked&DOCKING_UNITS)
PerformDockingOperations();
@@ -2530,6 +2528,9 @@
curr_physical_state.position ), true, true );
}
}
+ if (maxhull < 0) {
+ this->Explode( true, 0 );
+ }
//Really kill the unit only in non-networking or on server side
if (hull < 0) {
dead &= (pImage->pExplosion == NULL);
@@ -2814,9 +2815,8 @@
bool lastframe,
UnitCollection *uc )
{
- Cockpit *cp = _Universe->isPlayerStarship( this );
//Only in non-networking OR networking && is a player OR SERVER && not a player
- if ( (Network == NULL && !SERVER) || (Network != NULL && cp && !SERVER) || (SERVER) )
+ if ( (SERVER) || (Network == NULL && !SERVER) || (Network != NULL && !SERVER && _Universe->isPlayerStarship( this ) ) )
if (AngularVelocity.i || AngularVelocity.j || AngularVelocity.k)
Rotate( SIMULATION_ATOM*(AngularVelocity) );
//SERVERSIDE ONLY : If it is not a player, it is a unit controlled by server so compute changes
@@ -4659,7 +4659,6 @@
//eraticate everything. naturally (see previous line) we won't erraticate beams erraticated above
if ( !isSubUnit() )
RemoveFromSystem();
- killed = true;
computer.target.SetUnit( NULL );
//God I can't believe this next line cost me 1 GIG of memory until I added it
@@ -4671,15 +4670,20 @@
aistate->Destroy();
}
aistate = NULL;
+
+ // The following we don't want to do twice
+ killed = true;
Unit *un;
for (un_iter iter = getSubUnits(); (un = *iter); ++iter)
un->Kill();
-
+
if (isUnit() != MISSILEPTR)
- VSFileSystem::vs_dprintf( 1, "UNIT HAS DIED: %s %s (file %s)\n", name.get().c_str(),
- fullname.c_str(), filename.get().c_str() );
-
+ VSFileSystem::vs_dprintf( 1, "UNIT HAS DIED: %s %s (file %s, addr 0x%08x)\n", name.get().c_str(),
+ fullname.c_str(), filename.get().c_str(), this );
+
if (ucref == 0) {
+ VSFileSystem::vs_dprintf( 3, "UNIT DELETION QUEUED: %s %s (file %s, addr 0x%08x)\n", name.get().c_str(),
+ fullname.c_str(), filename.get().c_str(), this );
Unitdeletequeue.push_back( this );
if (flightgroup)
if (flightgroup->leader.GetUnit() == this)
|
|
From: <kla...@us...> - 2016-07-03 07:29:36
|
Revision: 13715
http://sourceforge.net/p/vegastrike/code/13715
Author: klaussfreire
Date: 2016-07-03 07:29:34 +0000 (Sun, 03 Jul 2016)
Log Message:
-----------
Optimize handling of subunit-less units by skipping some unneeded work
Modified Paths:
--------------
trunk/vegastrike/src/cmd/unit.cpp
trunk/vegastrike/src/cmd/unit_generic.h
Modified: trunk/vegastrike/src/cmd/unit.cpp
===================================================================
--- trunk/vegastrike/src/cmd/unit.cpp 2016-07-03 07:24:55 UTC (rev 13714)
+++ trunk/vegastrike/src/cmd/unit.cpp 2016-07-03 07:29:34 UTC (rev 13715)
@@ -255,12 +255,14 @@
this->meshdata[i]->Draw( lod, mat, d, cloak );
}
Unit *un;
- for (un_iter iter = this->getSubUnits(); (un = *iter); ++iter) {
- Matrix temp;
- un->curr_physical_state.to_matrix( temp );
- Matrix submat;
- MultMatrix( submat, mat, temp );
- (un)->DrawNow( submat, lod );
+ if (this->hasSubUnits()) {
+ for (un_iter iter = this->getSubUnits(); (un = *iter); ++iter) {
+ Matrix temp;
+ un->curr_physical_state.to_matrix( temp );
+ Matrix submat;
+ MultMatrix( submat, mat, temp );
+ (un)->DrawNow( submat, lod );
+ }
}
float cmas = this->computer.max_ab_speed()*this->computer.max_ab_speed();
if (cmas == 0)
@@ -356,7 +358,7 @@
AUDAdjustSound( sound.engine, cumulative_transformation.position, GetVelocity() );
#endif
- unsigned int i;
+ unsigned int i, n;
if ( (this->hull < 0) && (!cam_setup_phase) )
Explode( true, GetElapsedTime() );
@@ -367,6 +369,7 @@
float avgscale = 1.0f;
bool On_Screen = false;
+ bool Unit_On_Screen = false;
float Apparent_Size = 0.0f;
int cloak = this->cloaking;
Matrix wmat;
@@ -394,11 +397,11 @@
( camera->GetVelocity().Magnitude()+this->Velocity.Magnitude() )*SIMULATION_ATOM;
unsigned int numKeyFrames = this->graphicOptions.NumAnimationPoints;
- for (i = 0; i <= this->nummesh(); i++) {
+ for (i = 0, n = this->nummesh(); i <= n; i++) {
//NOTE LESS THAN OR EQUALS...to cover shield mesh
if (this->meshdata[i] == NULL)
continue;
- if ( i == this->nummesh() && (this->meshdata[i]->numFX() == 0 || this->hull < 0) )
+ if ( i == n && (this->meshdata[i]->numFX() == 0 || this->hull < 0) )
continue;
if (this->meshdata[i]->getBlendDst() == ONE) {
if ( (this->invisible & UnitType::INVISGLOW) != 0 )
@@ -453,8 +456,12 @@
}
}
}
- }
- {
+
+ Unit_On_Screen = On_Screen || !!GFXSphereInFrustum(
+ ct->position,
+ minmeshradius+this->rSize() );
+ } else Unit_On_Screen = true;
+ if (Unit_On_Screen && this->hasSubUnits()) {
Unit *un;
double backup = interpolation_blend_factor;
int cur_sim_frame = _Universe->activeStarSystem()->getCurrentSimFrame();
Modified: trunk/vegastrike/src/cmd/unit_generic.h
===================================================================
--- trunk/vegastrike/src/cmd/unit_generic.h 2016-07-03 07:24:55 UTC (rev 13714)
+++ trunk/vegastrike/src/cmd/unit_generic.h 2016-07-03 07:29:34 UTC (rev 13715)
@@ -341,6 +341,7 @@
* The ammo and the weapon type. As well as the possible weapons it may fit
* Warning: type has a string inside... cannot be memcpy'd
*/
+ bool hasSubUnits() const { return !SubUnits.empty(); };
un_iter getSubUnits();
un_kiter viewSubUnits() const;
#define NO_MOUNT_STAR
|
|
From: <kla...@us...> - 2016-07-03 07:24:58
|
Revision: 13714
http://sourceforge.net/p/vegastrike/code/13714
Author: klaussfreire
Date: 2016-07-03 07:24:55 +0000 (Sun, 03 Jul 2016)
Log Message:
-----------
Fix segfault when building an iterator for a collection of killed units
The iterator was being registered too late (after calling erase) so
erase was performing unsafe list manipulations.
May fix #680 and related errors.
Telltale signs of this bug are crashes shortly after a bunch of subunits
get killed (UNIT HAS DIED in the last few lines of log output), which
happen more often than not when killing units with missiles.
Modified Paths:
--------------
trunk/vegastrike/src/cmd/collection.cpp
Modified: trunk/vegastrike/src/cmd/collection.cpp
===================================================================
--- trunk/vegastrike/src/cmd/collection.cpp 2016-07-03 07:08:54 UTC (rev 13713)
+++ trunk/vegastrike/src/cmd/collection.cpp 2016-07-03 07:24:55 UTC (rev 13714)
@@ -43,6 +43,7 @@
{
col = orig;
it = col->u.begin();
+ col->reg(this);
while(it != col->u.end()){
if((*it) == NULL)
++it;
@@ -53,7 +54,6 @@
break;
}
}
- col->reg(this);
}
UnitCollection::UnitIterator::~UnitIterator()
|
|
From: <kla...@us...> - 2016-07-03 07:08:57
|
Revision: 13713
http://sourceforge.net/p/vegastrike/code/13713
Author: klaussfreire
Date: 2016-07-03 07:08:54 +0000 (Sun, 03 Jul 2016)
Log Message:
-----------
Optimize condition for empty collections to avoid computing the size of
a linked list, which is O(N), whenever possible
Modified Paths:
--------------
trunk/vegastrike/src/cmd/collection.h
Modified: trunk/vegastrike/src/cmd/collection.h
===================================================================
--- trunk/vegastrike/src/cmd/collection.h 2016-07-03 07:06:30 UTC (rev 13712)
+++ trunk/vegastrike/src/cmd/collection.h 2016-07-03 07:08:54 UTC (rev 13713)
@@ -172,8 +172,9 @@
void insert_unique( Unit* );
inline bool empty() const
{
- if (u.size()-removedIters.size() > 0) return false;
- return true;
+ if (u.empty()) return true;
+ else if (removedIters.empty() || u.size() > removedIters.size()) return false;
+ else return true;
}
/* Add a unit or iterator to the front of the list. */
|
|
From: <kla...@us...> - 2016-07-03 07:06:33
|
Revision: 13712
http://sourceforge.net/p/vegastrike/code/13712
Author: klaussfreire
Date: 2016-07-03 07:06:30 +0000 (Sun, 03 Jul 2016)
Log Message:
-----------
Remove useless argument that's just the default value
Modified Paths:
--------------
trunk/vegastrike/src/cmd/ai/navigation.cpp
Modified: trunk/vegastrike/src/cmd/ai/navigation.cpp
===================================================================
--- trunk/vegastrike/src/cmd/ai/navigation.cpp 2016-06-30 22:21:35 UTC (rev 13711)
+++ trunk/vegastrike/src/cmd/ai/navigation.cpp 2016-07-03 07:06:30 UTC (rev 13712)
@@ -618,7 +618,7 @@
}
static float min_warpfield_to_enter_warp =
XMLSupport::parse_float( vs_config->getVariable( "AI", "min_warp_to_try", "1.5" ) );
- if (parent->GetMaxWarpFieldStrength(1) < min_warpfield_to_enter_warp)
+ if (parent->GetMaxWarpFieldStrength() < min_warpfield_to_enter_warp)
deactivatewarp = true;
float maxspeed = mymax (speed, parent->graphicOptions.WarpFieldStrength*parent->GetComputerData().max_combat_ab_speed);
double dis = UnitUtil::getSignificantDistance( parent, target );
|
|
From: <kla...@us...> - 2016-06-30 22:21:38
|
Revision: 13711
http://sourceforge.net/p/vegastrike/code/13711
Author: klaussfreire
Date: 2016-06-30 22:21:35 +0000 (Thu, 30 Jun 2016)
Log Message:
-----------
Small profile-guided optimization: simplify GetWarpVelocity when not in warp
Modified Paths:
--------------
trunk/vegastrike/src/cmd/unit_generic.cpp
Modified: trunk/vegastrike/src/cmd/unit_generic.cpp
===================================================================
--- trunk/vegastrike/src/cmd/unit_generic.cpp 2016-06-30 21:15:06 UTC (rev 13710)
+++ trunk/vegastrike/src/cmd/unit_generic.cpp 2016-06-30 22:21:35 UTC (rev 13711)
@@ -194,18 +194,25 @@
VelocityRef = vr->cumulative_velocity;
}
- //return(cumulative_velocity*graphicOptions.WarpFieldStrength);
Vector vel = cumulative_velocity-VelocityRef;
- float speed = vel.Magnitude();
- //return vel*graphicOptions.WarpFieldStrength;
- if (speed > 0) {
- Vector veldir = vel*(1./speed);
- Vector facing = cumulative_transformation_matrix.getR();
- float ang = facing.Dot( veldir );
- float warpfield = graphicOptions.WarpFieldStrength;
- if (ang < 0) warpfield = 1./warpfield;
- return ang*facing*speed*(warpfield-1)+vel+VelocityRef;
- } else {return VelocityRef; }
+ if (graphicOptions.WarpFieldStrength == 1.) {
+ // Short circuit, most ships won't be at warp, so it simplifies math a lot
+ return vel+VelocityRef;
+ } else {
+ //return(cumulative_velocity*graphicOptions.WarpFieldStrength);
+ float speed = vel.Magnitude();
+ //return vel*graphicOptions.WarpFieldStrength;
+ if (speed > 0) {
+ Vector veldir = vel*(1./speed);
+ Vector facing = cumulative_transformation_matrix.getR();
+ float ang = facing.Dot( veldir );
+ float warpfield = graphicOptions.WarpFieldStrength;
+ if (ang < 0) warpfield = 1./warpfield;
+ return facing*(ang*speed*(warpfield-1.))+vel+VelocityRef;
+ } else {
+ return VelocityRef;
+ }
+ }
}
void Unit::SetPosition( const QVector &pos )
|
|
From: <kla...@us...> - 2016-06-30 21:15:09
|
Revision: 13710
http://sourceforge.net/p/vegastrike/code/13710
Author: klaussfreire
Date: 2016-06-30 21:15:06 +0000 (Thu, 30 Jun 2016)
Log Message:
-----------
Small profile-guided optimization: Unit::nummesh() doesn't really need
to be virtual, and having it so is burning lots of cycles in hot
draw/physics loops, so until it becomes necessary, make it nonvirtual
and inline
Modified Paths:
--------------
trunk/vegastrike/src/cmd/unit.cpp
trunk/vegastrike/src/cmd/unit.h
trunk/vegastrike/src/cmd/unit_generic.h
Modified: trunk/vegastrike/src/cmd/unit.cpp
===================================================================
--- trunk/vegastrike/src/cmd/unit.cpp 2016-06-30 21:13:28 UTC (rev 13709)
+++ trunk/vegastrike/src/cmd/unit.cpp 2016-06-30 21:15:06 UTC (rev 13710)
@@ -116,13 +116,6 @@
}
template < class UnitType >
-unsigned int GameUnit< UnitType >::nummesh() const
-{
- // return number of meshes but not the shield
- return (this->meshdata.size() - 1 );
-}
-
-template < class UnitType >
void GameUnit< UnitType >::UpgradeInterface( Unit *baseun )
{
string basename = ( ::getCargoUnitName( baseun->getFullname().c_str() ) );
Modified: trunk/vegastrike/src/cmd/unit.h
===================================================================
--- trunk/vegastrike/src/cmd/unit.h 2016-06-30 21:13:28 UTC (rev 13709)
+++ trunk/vegastrike/src/cmd/unit.h 2016-06-30 21:15:06 UTC (rev 13710)
@@ -72,7 +72,10 @@
GameUnit( const char *filename, bool SubUnit, int faction, std::string customizedUnit = std::string(
"" ), Flightgroup *flightgroup = NULL, int fg_subnumber = 0, std::string *netxml = NULL );
virtual ~GameUnit();
- unsigned int nummesh() const;
+ unsigned int nummesh() const
+ {
+ return UnitType::nummesh();
+ }
///fils in corner_min,corner_max and radial_size
///returns -1 if unit cannot dock, otherwise returns which dock it can dock at
UnitImages< void >& GetImageInformation();
Modified: trunk/vegastrike/src/cmd/unit_generic.h
===================================================================
--- trunk/vegastrike/src/cmd/unit_generic.h 2016-06-30 21:13:28 UTC (rev 13709)
+++ trunk/vegastrike/src/cmd/unit_generic.h 2016-06-30 21:15:06 UTC (rev 13710)
@@ -504,7 +504,7 @@
void RemoveFromSystem();
void RequestPhysics(); //Requeues the unit so that it is simulated ASAP
bool InCorrectStarSystem( StarSystem* );
- virtual unsigned int nummesh() const
+ unsigned int nummesh() const
{
// Return number of meshes except shield
return ( meshdata.size() - 1 );
|
|
From: <kla...@us...> - 2016-06-30 21:13:31
|
Revision: 13709
http://sourceforge.net/p/vegastrike/code/13709
Author: klaussfreire
Date: 2016-06-30 21:13:28 +0000 (Thu, 30 Jun 2016)
Log Message:
-----------
Small profile-guided optimization: avoid handling the heap if the new
occluder is going to be excluded anyway (ie: less relevant than the
least relevant occluder in a full heap)
Modified Paths:
--------------
trunk/vegastrike/src/gfx/occlusion.cpp
Modified: trunk/vegastrike/src/gfx/occlusion.cpp
===================================================================
--- trunk/vegastrike/src/gfx/occlusion.cpp 2016-06-30 21:12:02 UTC (rev 13708)
+++ trunk/vegastrike/src/gfx/occlusion.cpp 2016-06-30 21:13:28 UTC (rev 13709)
@@ -254,9 +254,11 @@
forced_occluders_set.insert(occHash);
}
} else {
- dynamic_occluders.push(occ);
- while (dynamic_occluders.size() > 16)
- dynamic_occluders.pop();
+ if (dynamic_occluders.size() < 16 || !(dynamic_occluders.top() < occ)) {
+ dynamic_occluders.push(occ);
+ while (dynamic_occluders.size() > 16)
+ dynamic_occluders.pop();
+ }
}
}
|