From 51657e10769faa2617d546a06c42e4c62a19bb50 Mon Sep 17 00:00:00 2001 From: Aki Date: Sun, 30 Jan 2022 17:41:24 +0100 Subject: Removed trailing whitespace all over the place --- Stars45/ActiveWindow.cpp | 12 ++--- Stars45/Archive.cpp | 52 ++++++++++----------- Stars45/Archive.h | 2 +- Stars45/AudioConfig.cpp | 2 +- Stars45/AviFile.cpp | 12 ++--- Stars45/AviFile.h | 4 +- Stars45/Bitmap.cpp | 28 +++++------ Stars45/Bmp.cpp | 8 ++-- Stars45/Bolt.cpp | 2 +- Stars45/Button.cpp | 22 ++++----- Stars45/CameraDirector.cpp | 18 ++++---- Stars45/CameraDirector.h | 6 +-- Stars45/CameraView.cpp | 2 +- Stars45/Campaign.cpp | 10 ++-- Stars45/CampaignMissionFighter.cpp | 30 ++++++------ Stars45/CampaignMissionFighter.h | 4 +- Stars45/CampaignMissionRequest.cpp | 2 +- Stars45/CampaignMissionStarship.cpp | 10 ++-- Stars45/CampaignMissionStarship.h | 4 +- Stars45/CampaignPlanEvent.cpp | 14 +++--- Stars45/CampaignPlanMission.cpp | 10 ++-- Stars45/CampaignSaveGame.cpp | 8 ++-- Stars45/CampaignSituationReport.cpp | 4 +- Stars45/CarrierAI.cpp | 6 +-- Stars45/CmdDlg.cpp | 2 +- Stars45/CmdDlg.h | 2 +- Stars45/CmdForceDlg.cpp | 16 +++---- Stars45/CmdMissionsDlg.cpp | 2 +- Stars45/CmdTheaterDlg.cpp | 2 +- Stars45/CmpSelectDlg.cpp | 30 ++++++------ Stars45/CmpnScreen.cpp | 6 +-- Stars45/Color.cpp | 32 ++++++------- Stars45/Color.h | 2 +- Stars45/CombatAction.h | 6 +-- Stars45/CombatAssignment.cpp | 4 +- Stars45/CombatAssignment.h | 2 +- Stars45/CombatEvent.cpp | 2 +- Stars45/CombatGroup.cpp | 42 ++++++++--------- Stars45/CombatGroup.h | 4 +- Stars45/CombatZone.cpp | 2 +- Stars45/CombatZone.h | 4 +- Stars45/Combatant.h | 2 +- Stars45/ComboBox.cpp | 8 ++-- Stars45/ComboList.cpp | 10 ++-- Stars45/Component.cpp | 2 +- Stars45/Contact.cpp | 4 +- Stars45/CtlDlg.cpp | 2 +- Stars45/D3DXImage.cpp | 20 ++++---- Stars45/DataLoader.cpp | 4 +- Stars45/Debris.cpp | 2 +- Stars45/DetailSet.cpp | 6 +-- Stars45/Director.h | 2 +- Stars45/DisplayView.cpp | 12 ++--- Stars45/DisplayView.h | 8 ++-- Stars45/Drive.cpp | 2 +- Stars45/DropShipAI.cpp | 2 +- Stars45/EditBox.cpp | 6 +-- Stars45/Encrypt.cpp | 10 ++-- Stars45/Encrypt.h | 2 +- Stars45/ExceptionHandler.cpp | 6 +-- Stars45/ExitDlg.cpp | 2 +- Stars45/Explosion.cpp | 14 +++--- Stars45/Explosion.h | 8 ++-- Stars45/Farcaster.cpp | 2 +- Stars45/FighterAI.cpp | 32 ++++++------- Stars45/FighterTacticalAI.cpp | 8 ++-- Stars45/FlightComp.cpp | 8 ++-- Stars45/FlightDeck.cpp | 4 +- Stars45/FlightPlanner.cpp | 2 +- Stars45/FltDlg.cpp | 12 ++--- Stars45/Font.cpp | 42 ++++++++--------- Stars45/Font.h | 2 +- Stars45/FormDef.cpp | 18 ++++---- Stars45/FormWindow.cpp | 4 +- Stars45/FormatUtil.cpp | 2 +- Stars45/Galaxy.cpp | 6 +-- Stars45/Game.cpp | 22 ++++----- Stars45/Game.h | 2 +- Stars45/GameScreen.cpp | 10 ++-- Stars45/Geometry.cpp | 8 ++-- Stars45/Geometry.h | 4 +- Stars45/Graphic.cpp | 2 +- Stars45/Grid.cpp | 4 +- Stars45/GroundAI.cpp | 2 +- Stars45/GroundAI.h | 2 +- Stars45/HUDSounds.cpp | 2 +- Stars45/HUDView.cpp | 92 ++++++++++++++++++------------------- Stars45/Hangar.cpp | 12 ++--- Stars45/Hangar.h | 10 ++-- Stars45/HardPoint.cpp | 4 +- Stars45/Hoop.cpp | 4 +- Stars45/ImageBox.cpp | 14 +++--- Stars45/ImageBox.h | 2 +- Stars45/Instruction.cpp | 6 +-- Stars45/Instruction.h | 8 ++-- Stars45/Joystick.cpp | 42 ++++++++--------- Stars45/KeyMap.cpp | 30 ++++++------ Stars45/Layout.cpp | 4 +- Stars45/Light.cpp | 2 +- Stars45/ListBox.cpp | 18 ++++---- Stars45/LoadDlg.cpp | 2 +- Stars45/Locale_ss.cpp | 2 +- Stars45/MCIWave.cpp | 82 ++++++++++++++++----------------- Stars45/MachineInfo.cpp | 6 +-- Stars45/Main.cpp | 2 +- Stars45/MapView.cpp | 60 ++++++++++++------------ Stars45/MapView.h | 4 +- Stars45/MenuDlg.cpp | 2 +- Stars45/MenuScreen.cpp | 4 +- Stars45/MenuView.cpp | 2 +- Stars45/Mfd.cpp | 12 ++--- Stars45/Mfd.h | 2 +- Stars45/Mission.cpp | 8 ++-- Stars45/Mission.h | 2 +- Stars45/MissionEvent.cpp | 20 ++++---- Stars45/MissionEvent.h | 4 +- Stars45/MissionTemplate.cpp | 4 +- Stars45/ModConfig.cpp | 8 ++-- Stars45/Mouse.cpp | 2 +- Stars45/MsnDlg.cpp | 2 +- Stars45/MsnElemDlg.cpp | 2 +- Stars45/MsnEventDlg.cpp | 2 +- Stars45/MsnPkgDlg.cpp | 14 +++--- Stars45/MultiController.cpp | 2 +- Stars45/MusicDirector.cpp | 4 +- Stars45/MusicTrack.cpp | 2 +- Stars45/NPClient.h | 4 +- Stars45/NPClientWraps.cpp | 14 +++--- Stars45/NavDlg.cpp | 28 +++++------ Stars45/NavLight.cpp | 2 +- Stars45/NetAddrDlg.cpp | 2 +- Stars45/NetAdminChat.cpp | 2 +- Stars45/NetAdminServer.cpp | 2 +- Stars45/NetAuth.cpp | 2 +- Stars45/NetClientConfig.cpp | 2 +- Stars45/NetData.cpp | 12 ++--- Stars45/NetData.h | 8 ++-- Stars45/NetFileServlet.cpp | 2 +- Stars45/NetGameClient.cpp | 8 ++-- Stars45/NetLobbyClient.cpp | 6 +-- Stars45/NetLobbyServer.cpp | 10 ++-- Stars45/NetPlayer.cpp | 4 +- Stars45/NetServerConfig.cpp | 4 +- Stars45/NetServerDlg.cpp | 2 +- Stars45/NetUnitDlg.cpp | 4 +- Stars45/Parser.cpp | 26 +++++------ Stars45/Particles.cpp | 6 +-- Stars45/Particles.h | 18 ++++---- Stars45/Physical.cpp | 4 +- Stars45/Player.cpp | 4 +- Stars45/PngImage.cpp | 4 +- Stars45/Polygon.cpp | 4 +- Stars45/Power.cpp | 10 ++-- Stars45/QuantumFlash.cpp | 2 +- Stars45/QuantumView.cpp | 2 +- Stars45/QuantumView.h | 2 +- Stars45/QuitView.cpp | 12 ++--- Stars45/RadioHandler.cpp | 6 +-- Stars45/RadioMessage.h | 2 +- Stars45/RadioTraffic.cpp | 10 ++-- Stars45/RadioView.cpp | 4 +- Stars45/RadioView.h | 2 +- Stars45/Reader.cpp | 8 ++-- Stars45/Reader.h | 6 +-- Stars45/RichTextBox.cpp | 10 ++-- Stars45/Scene.cpp | 24 +++++----- Stars45/Screen.cpp | 4 +- Stars45/SeekerAI.cpp | 4 +- Stars45/Sensor.cpp | 6 +-- Stars45/Sha1.cpp | 30 ++++++------ Stars45/Sha1.h | 2 +- Stars45/Shadow.cpp | 2 +- Stars45/Ship.cpp | 72 ++++++++++++++--------------- Stars45/Ship.h | 6 +-- Stars45/ShipAI.cpp | 24 +++++----- Stars45/ShipCtrl.cpp | 4 +- Stars45/ShipDesign.cpp | 26 +++++------ Stars45/ShipKiller.cpp | 48 +++++++++---------- Stars45/Shot.cpp | 6 +-- Stars45/Sim.cpp | 58 +++++++++++------------ Stars45/SimObject.h | 2 +- Stars45/Sky.cpp | 2 +- Stars45/Sky.h | 2 +- Stars45/Slider.cpp | 2 +- Stars45/Solid.cpp | 10 ++-- Stars45/SoundD3D.cpp | 22 ++++----- Stars45/Sprite.cpp | 12 ++--- Stars45/StarServer.cpp | 4 +- Stars45/StarSystem.cpp | 40 ++++++++-------- Stars45/StarSystem.h | 2 +- Stars45/Starshatter.cpp | 24 +++++----- Stars45/StarshipAI.cpp | 12 ++--- Stars45/StarshipTacticalAI.cpp | 6 +-- Stars45/SteerAI.cpp | 14 +++--- Stars45/System.cpp | 6 +-- Stars45/SystemDesign.cpp | 8 ++-- Stars45/TacRefDlg.cpp | 4 +- Stars45/TacticalAI.cpp | 20 ++++---- Stars45/TacticalView.cpp | 14 +++--- Stars45/TacticalView.h | 2 +- Stars45/Term.h | 10 ++-- Stars45/Terrain.cpp | 4 +- Stars45/TerrainClouds.cpp | 2 +- Stars45/TerrainPatch.cpp | 2 +- Stars45/TexDX9.cpp | 4 +- Stars45/TexDX9.h | 2 +- Stars45/Thruster.cpp | 8 ++-- Stars45/Token.cpp | 50 ++++++++++---------- Stars45/Token.h | 14 +++--- Stars45/TrackIR.cpp | 10 ++-- Stars45/Trail.cpp | 2 +- Stars45/Types.h | 14 +++--- Stars45/VidDlg.cpp | 6 +-- Stars45/Video.h | 10 ++-- Stars45/VideoDX9.cpp | 64 +++++++++++++------------- Stars45/VideoDX9.h | 10 ++-- Stars45/VideoDX9Enum.cpp | 70 ++++++++++++++-------------- Stars45/VideoDX9Enum.h | 2 +- Stars45/VideoDX9VertexBuffer.cpp | 10 ++-- Stars45/VideoDX9VertexBuffer.h | 2 +- Stars45/VideoFactory.cpp | 2 +- Stars45/Water.cpp | 14 +++--- Stars45/Wave.h | 10 ++-- Stars45/Weapon.cpp | 22 ++++----- Stars45/WeaponDesign.h | 2 +- Stars45/WeaponGroup.cpp | 2 +- Stars45/Weather.h | 4 +- Stars45/WebBrowser.cpp | 2 +- Stars45/WepView.cpp | 2 +- Stars45/Window.cpp | 6 +-- Stars45/resource.h | 2 +- 231 files changed, 1209 insertions(+), 1209 deletions(-) (limited to 'Stars45') diff --git a/Stars45/ActiveWindow.cpp b/Stars45/ActiveWindow.cpp index 4d78b72..39c1428 100644 --- a/Stars45/ActiveWindow.cpp +++ b/Stars45/ActiveWindow.cpp @@ -394,7 +394,7 @@ ActiveWindow::CalcGrid() mtl->tex_diffuse = texture; polys = new(__FILE__,__LINE__) Poly[npolys]; - + Poly* p = polys; ZeroMemory(polys, npolys*sizeof(Poly)); @@ -510,7 +510,7 @@ ActiveWindow::DrawStyleRect(int x1, int y1, int x2, int y2, int style) Color c = ShadeColor(back_color, 0.3); // full shadow DrawLine(x1+1,y1+1, x1+1, y2, c); DrawLine(x1+1,y1+1, x2, y1+1, c); - + c = ShadeColor(back_color, 0.6); // soft shadow DrawLine(x1, y1, x1, y2, c); DrawLine(x1, y1, x2, y1, c); @@ -582,11 +582,11 @@ ActiveWindow::DrawTabbedText() font->SetColor(shadow); DrawText(text.data(), 0, label_rect, text_flags); } - + label_rect.x--; label_rect.y--; } - + Color fore = ShadeColor(fore_color, 1); font->SetColor(fore); DrawText(text.data(), 0, label_rect, text_flags); @@ -609,7 +609,7 @@ ActiveWindow::SetTabStop(int n, int x) tab[n] = x; } -int +int ActiveWindow::GetTabStop(int n) const { if (n >= 0 && n < 10) @@ -831,7 +831,7 @@ ActiveWindow::ClientEvent(int eid, int x, int y) if (map->eid == eid) map->func(map->client, &event); } -} +} // +--------------------------------------------------------------------+ diff --git a/Stars45/Archive.cpp b/Stars45/Archive.cpp index 4b6462a..5f96466 100644 --- a/Stars45/Archive.cpp +++ b/Stars45/Archive.cpp @@ -90,7 +90,7 @@ void DataArchive::WriteEntry(int index, BYTE* buf) } else { - err = compress(dirbuf, &header.dir_size_comp, + err = compress(dirbuf, &header.dir_size_comp, (BYTE*) directory, header.nfiles * sizeof(DataEntry)); CHECK_ERR(err, "compress"); @@ -100,11 +100,11 @@ void DataArchive::WriteEntry(int index, BYTE* buf) _write(f, &header, sizeof(DataHeader)); _lseek(f, sizeof(DataHeader) + header.dir_offset, SEEK_SET); _write(f, dirbuf, header.dir_blocks); - + delete [] dirbuf; dirbuf = 0; } - + if (buf && directory && directory[index].size_comp) { _lseek(f, sizeof(DataHeader) + directory[index].offset, SEEK_SET); _write(f, buf, directory[index].size_comp); @@ -169,16 +169,16 @@ void DataArchive::CreateBlockMap() else { ZeroMemory(block_map, nblocks*sizeof(DWORD)); - DWORD first_block = header.dir_offset/BLOCK_SIZE + + DWORD first_block = header.dir_offset/BLOCK_SIZE + (header.dir_offset%BLOCK_SIZE > 0); - + for (j = 0; j < DirBlocks(); j++) block_map[first_block+j] = 1; for (i = 0; i < header.nfiles; i++) { - DWORD first_block = directory[i].offset/BLOCK_SIZE + + DWORD first_block = directory[i].offset/BLOCK_SIZE + (directory[i].offset%BLOCK_SIZE > 0); - + for (j = 0; j < FileBlocks(i); j++) block_map[first_block+j] = i+2; } @@ -195,9 +195,9 @@ int DataArchive::FindDataBlocks(int need) for (start = 0; start < nblocks-need; start++) { for (i = 0; block_map[start+i] == 0 && i < need; i++); - + if (i == need) return start*BLOCK_SIZE; - + start += i; } } @@ -217,11 +217,11 @@ void DataArchive::LoadDatafile(const char* name) ZeroMemory(this, sizeof(DataArchive)); strncpy_s(datafile, name, NAMELEN-1); - FILE* f; + FILE* f; fopen_s(&f, datafile, "rb"); if (f) { fread(&header, sizeof(DataHeader), 1, f); - + if (header.version != VERSION) { Print("ERROR: datafile '%s' invalid version '%d'\n", datafile, header.version); @@ -251,7 +251,7 @@ void DataArchive::LoadDatafile(const char* name) dirbuf, header.dir_size_comp); if (err != Z_OK) ZeroMemory(directory, sizeof(DataEntry) * dirsize); - + delete [] dirbuf; dirbuf = 0; @@ -260,15 +260,15 @@ void DataArchive::LoadDatafile(const char* name) } else { Print("Creating Archive '%s'...\n", datafile); - + header.version = VERSION; header.nfiles = 0; header.dir_blocks = 0; header.dir_size_comp = 0; header.dir_offset = 0; - + nblocks = DirBlocks(); - + delete [] block_map; block_map = 0; } @@ -328,7 +328,7 @@ BYTE* DataArchive::CompressEntry(int i) fclose(f); directory[i].size_orig = len; - + directory[i].size_comp = (int) (len * 1.1); BYTE* cbuf = new(__FILE__,__LINE__) BYTE[directory[i].size_comp]; @@ -429,7 +429,7 @@ int DataArchive::InsertEntry(const char* name) strncpy_s(directory[i].name, path, NAMELEN); directory[i].name[NAMELEN-1] = '\0'; directory[i].size_orig = 1; - + return i; } } @@ -479,16 +479,16 @@ void DataArchive::Insert(const char* name) if (index < 0) { old_dir_blocks = DirBlocks(); old_dir_offset = header.dir_offset; - + index = InsertEntry(name); - + if (index >= (int) header.nfiles) { header.nfiles = index+1; added = 1; } new_dir_blocks = DirBlocks(); - + if (new_dir_blocks > old_dir_blocks) { header.dir_offset = FindDataBlocks(new_dir_blocks); CreateBlockMap(); @@ -501,11 +501,11 @@ void DataArchive::Insert(const char* name) if (index >= 0) { DataEntry& e = directory[index]; - + if (verbose) Print(" Inserting: %-16s ", e.name); BYTE* buf = CompressEntry(index); - + if (!buf) { // this is (almost) unrecoverable, // so we quit before screwing things up: @@ -514,7 +514,7 @@ void DataArchive::Insert(const char* name) } new_blocks = FileBlocks(index); - + // the file is new, or got bigger, // need to find room for the data: if (new_blocks > old_blocks) { @@ -524,7 +524,7 @@ void DataArchive::Insert(const char* name) WriteEntry(index, buf); delete [] buf; - + if (verbose) { int ratio = (int) (100.0 * (double) e.size_comp / (double) e.size_orig); Print("%9d => %9d (%2d%%)\n", e.size_orig, e.size_comp, ratio); @@ -597,9 +597,9 @@ void DataArchive::List() for (DWORD i = 0; i < header.nfiles; i++) { DataEntry& e = directory[i]; int ratio = (int) (100.0 * (double) e.size_comp / (double) e.size_orig); - + printf("%5d %9d %9d %2d%% %s\n", i+1, e.size_orig, e.size_comp, ratio, e.name); //-V576 - + total_orig += e.size_orig; total_comp += e.size_comp; } diff --git a/Stars45/Archive.h b/Stars45/Archive.h index d56ad63..e8e46b9 100644 --- a/Stars45/Archive.h +++ b/Stars45/Archive.h @@ -62,7 +62,7 @@ struct DataEntry char name[NAMELEN]; DWORD size_orig; DWORD size_comp; - DWORD offset; + DWORD offset; }; class DataArchive diff --git a/Stars45/AudioConfig.cpp b/Stars45/AudioConfig.cpp index 2120ec3..63e1413 100644 --- a/Stars45/AudioConfig.cpp +++ b/Stars45/AudioConfig.cpp @@ -294,7 +294,7 @@ AudioConfig::Load() delete term; term = parser.ParseTerm(); - + if (term) { int v = 0; TermDef* def = term->isDef(); diff --git a/Stars45/AviFile.cpp b/Stars45/AviFile.cpp index abc1c35..f2e069c 100644 --- a/Stars45/AviFile.cpp +++ b/Stars45/AviFile.cpp @@ -75,11 +75,11 @@ ps(0), ps_comp(0), nframe(0), nsamp(0), iserr(false) Print("AviFile - open successful\n"); - AVISTREAMINFO strhdr; + AVISTREAMINFO strhdr; ZeroMemory(&strhdr,sizeof(strhdr)); strhdr.fccType = streamtypeVIDEO; - strhdr.fccHandler = 0; + strhdr.fccHandler = 0; strhdr.dwScale = 1000 / fps; strhdr.dwRate = 1000; strhdr.dwSuggestedBufferSize = frame_size; @@ -96,7 +96,7 @@ ps(0), ps_comp(0), nframe(0), nsamp(0), iserr(false) Print("AviFile - create stream successful\n"); - AVICOMPRESSOPTIONS opts; + AVICOMPRESSOPTIONS opts; ZeroMemory(&opts,sizeof(opts)); opts.fccType = streamtypeVIDEO; //opts.fccHandler = mmioFOURCC('W','M','V','3'); @@ -106,7 +106,7 @@ ps(0), ps_comp(0), nframe(0), nsamp(0), iserr(false) hr = AVIMakeCompressedStream(&ps_comp, ps, &opts, 0); if (hr != AVIERR_OK) { Print("AviFile - compressed stream failed. %08x\n", hr); - iserr=true; + iserr=true; return; } @@ -127,7 +127,7 @@ ps(0), ps_comp(0), nframe(0), nsamp(0), iserr(false) if (hr != AVIERR_OK) { Print("AviFile - stream format failed. %08x\n", hr); - iserr=true; + iserr=true; return; } @@ -177,7 +177,7 @@ AviFile::AddFrame(const Bitmap& bmp) #pragma warning(suppress: 6001) hr = AVIStreamWrite(ps_comp, nframe, 1, buffer, frame_size, AVIIF_KEYFRAME, 0, 0); - + if (SUCCEEDED(hr)) { nframe++; } diff --git a/Stars45/AviFile.h b/Stars45/AviFile.h index 34de68c..4c1c2ca 100644 --- a/Stars45/AviFile.h +++ b/Stars45/AviFile.h @@ -69,10 +69,10 @@ public: private: Rect rect; Text filename; - int fps; + int fps; IAVIFile* pfile; // created by CreateAvi - IAVIStream* ps; + IAVIStream* ps; IAVIStream* ps_comp; // video stream, when first created DWORD frame_size; // total bytes per frame of video DWORD nframe; // which frame will be added next diff --git a/Stars45/Bitmap.cpp b/Stars45/Bitmap.cpp index 65adf84..9fa3b85 100644 --- a/Stars45/Bitmap.cpp +++ b/Stars45/Bitmap.cpp @@ -199,7 +199,7 @@ Bitmap::BitBlt(int x, int y, const Bitmap& srcBmp, int sx, int sy, int w, int h, Color* pd = dst; for (int n = 0; n < w; n++) { - if (ps->Value()) + if (ps->Value()) pd->Set(Color::FormattedBlend(ps->Value(), pd->Value())); ps++; pd++; @@ -829,17 +829,17 @@ Bitmap::Default() def.mapsize = 64*64; def.ownpix = true; def.pix = new(__FILE__,__LINE__) ColorIndex[def.mapsize]; - + // 8 bit palette mode if (def.pix) { ColorIndex* p = def.pix; - + for (int y = 0; y < 64; y++) { for (int x = 0; x < 64; x++) { double distance = sqrt((x-32.0)*(x-32.0) + (y-32.0)*(y-32.0)); if (distance > 31.0) distance = 31.0; BYTE color = 24 + (BYTE) distance; - + if (x == 0 || y == 0) color = 255; else if (x == 32 || y == 32) color = 251; @@ -976,7 +976,7 @@ Bitmap::ClipLine(int& x1, int& y1, int& x2, int& y2) goto clip_vertical; if (y1 == y2) - goto clip_horizontal; + goto clip_horizontal; return true; } @@ -1035,7 +1035,7 @@ Bitmap::ClipLine(double& x1, double& y1, double& x2, double& y2) goto clip_vertical; if (y1 == y2) - goto clip_horizontal; + goto clip_horizontal; return true; } @@ -1109,7 +1109,7 @@ Bitmap::DrawLine(int x1, int y1, int x2, int y2, Color color) goto draw_vertical; if (y1 == y2) - goto draw_horizontal; + goto draw_horizontal; // plot the line using /* @@ -1455,15 +1455,15 @@ Bitmap::DrawEllipse(int x1, int y1, int x2, int y2, Color color, BYTE quad) // clip super-giant ellipses: if (x1 < 0 && y1 < 0 && x2 > width && y2 > height) { double r2 = (a2 32 * height) return; - + double ul = (x1-x0)*(x1-x0) + (y1-y0)*(y1-y0); double ur = (x2-x0)*(x2-x0) + (y1-y0)*(y1-y0); double ll = (x1-x0)*(x1-x0) + (y2-y0)*(y2-y0); double lr = (x2-x0)*(x2-x0) + (y2-y0)*(y2-y0); - + if (ul > r2 && ur > r2 && ll > r2 && lr > r2) return; } @@ -1525,7 +1525,7 @@ Bitmap::DrawEllipsePoints(int x0, int y0, int x, int y, Color c, BYTE quad) if (left >= 0 && top >= 0 && quad&1) { dst = s + top*pitch + left*pixsize; - + switch (pixsize) { case 1: *dst = (BYTE) cf; break; case 2: { LPWORD sw = (LPWORD) dst; *sw = (WORD) cf; } break; @@ -1535,7 +1535,7 @@ Bitmap::DrawEllipsePoints(int x0, int y0, int x, int y, Color c, BYTE quad) if (right < width && top >= 0 && quad&2) { dst = s + top*pitch + right*pixsize; - + switch (pixsize) { case 1: *dst = (BYTE) cf; break; case 2: { LPWORD sw = (LPWORD) dst; *sw = (WORD) cf; } break; @@ -1545,7 +1545,7 @@ Bitmap::DrawEllipsePoints(int x0, int y0, int x, int y, Color c, BYTE quad) if (left >= 0 && bottom < height && quad&4) { dst = s + bottom*pitch + left*pixsize; - + switch (pixsize) { case 1: *dst = (BYTE) cf; break; case 2: { LPWORD sw = (LPWORD) dst; *sw = (WORD) cf; } break; @@ -1555,7 +1555,7 @@ Bitmap::DrawEllipsePoints(int x0, int y0, int x, int y, Color c, BYTE quad) if (right < width && bottom < height && quad&4) { dst = s + bottom*pitch + right*pixsize; - + switch (pixsize) { case 1: *dst = (BYTE) cf; break; case 2: { LPWORD sw = (LPWORD) dst; *sw = (WORD) cf; } break; diff --git a/Stars45/Bmp.cpp b/Stars45/Bmp.cpp index d191d4d..c6eb772 100644 --- a/Stars45/Bmp.cpp +++ b/Stars45/Bmp.cpp @@ -104,8 +104,8 @@ int BmpImage::Load(char *filename) fread(&file_hdr.offset, sizeof(DWORD), 1, f); fread(&info_hdr, BMP_INFO_HDR_SIZE, 1, f); - if (info_hdr.width > 32768 || info_hdr.height > 32768 || - (info_hdr.width&3) || (info_hdr.height&3) || + if (info_hdr.width > 32768 || info_hdr.height > 32768 || + (info_hdr.width&3) || (info_hdr.height&3) || info_hdr.compression != 0) { fclose(f); return BMP_INVALID; @@ -175,8 +175,8 @@ int BmpImage::LoadBuffer(unsigned char* buf, int len) memcpy(&info_hdr, buf + BMP_FILE_HDR_SIZE, BMP_INFO_HDR_SIZE); fp += BMP_FILE_HDR_SIZE + BMP_INFO_HDR_SIZE; - if (info_hdr.width > 32768 || info_hdr.height > 32768 || - (info_hdr.width&3) || (info_hdr.height&3) || + if (info_hdr.width > 32768 || info_hdr.height > 32768 || + (info_hdr.width&3) || (info_hdr.height&3) || info_hdr.compression != 0) { return BMP_INVALID; } diff --git a/Stars45/Bolt.cpp b/Stars45/Bolt.cpp index f9ffd2c..6ca7c27 100644 --- a/Stars45/Bolt.cpp +++ b/Stars45/Bolt.cpp @@ -173,7 +173,7 @@ Bolt::SetOrientation(const Matrix& o) void Bolt::SetDirection(const Point& v) -{ +{ vpn = v; origin = loc + (vpn * -length); } diff --git a/Stars45/Button.cpp b/Stars45/Button.cpp index 292e29a..c4a8de1 100644 --- a/Stars45/Button.cpp +++ b/Stars45/Button.cpp @@ -262,7 +262,7 @@ Button::Draw() DrawText(text.data(), 0, label_rect, DT_CALCRECT | align); vert_space = (vert_space - label_rect.h)/2; - + label_rect.w = horz_space; if (vert_space > 0) @@ -276,14 +276,14 @@ Button::Draw() if (drop_shadow) { label_rect.x++; label_rect.y++; - + font->SetColor(back_color); DrawText(text.data(), text.length(), label_rect, align); - + label_rect.x--; label_rect.y--; } - + font->SetColor(fore_color); DrawText(text.data(), text.length(), label_rect, align); } @@ -351,13 +351,13 @@ Button::CalcPictureRect() int h = rect.h; int img_w = picture.Width(); int img_h = picture.Height(); - + if (img_h > h) img_h = h-2; if (img_w > w) img_w = w-2; - + int img_x_offset = bevel_width; int img_y_offset = bevel_width; - + switch (picture_loc) { default: @@ -391,7 +391,7 @@ Button::CalcPictureRect() img_y_offset = h - img_h - bevel_width; break; } - + Rect img_rect; img_rect.x = img_x_offset; img_rect.y = img_y_offset; @@ -557,11 +557,11 @@ int Button::OnClick() } int Button::OnMouseEnter(int mx, int my) -{ +{ if (button_state >= 0) pre_state = button_state; - if (button_state == 0) + if (button_state == 0) button_state = -1; if (IsEnabled() && IsShown()) @@ -571,7 +571,7 @@ int Button::OnMouseEnter(int mx, int my) } int Button::OnMouseExit(int mx, int my) -{ +{ if (button_state == -1) button_state = pre_state; diff --git a/Stars45/CameraDirector.cpp b/Stars45/CameraDirector.cpp index 5358e97..e1eea21 100644 --- a/Stars45/CameraDirector.cpp +++ b/Stars45/CameraDirector.cpp @@ -337,7 +337,7 @@ CameraDirector::CycleViewObject() if (c_ship && !current) { external_ship = c_ship; } - + else if (current && c_ship == current) { while (++iter && !external_ship) { c = iter.value(); @@ -407,7 +407,7 @@ CameraDirector::SetViewObject(Ship* obj, bool quick) if (obj->GetIFF() != ship->GetIFF() && !stars->InCutscene()) { // only view solid contacts: Contact* c = ship->FindContact(obj); - if (!c || !c->ActLock()) + if (!c || !c->ActLock()) return; } @@ -439,7 +439,7 @@ CameraDirector::SetViewObject(Ship* obj, bool quick) if (!quick) SetMode(MODE_ZOOM); } - + else if (external_ship) { external_ship = 0; } @@ -816,7 +816,7 @@ CameraDirector::ExecFrame(double seconds) case MODE_DROP: Drop(seconds); break; } - if (ship->Shake() > 0 && + if (ship->Shake() > 0 && (op_mode < MODE_ORBIT || (op_mode == MODE_VIRTUAL && ship->Cockpit()))) { @@ -877,7 +877,7 @@ CameraDirector::Cockpit(double seconds) camera.Clone(ship->Cam()); Point bridge = ship->BridgeLocation(); - Point cpos = camera.Pos() + + Point cpos = camera.Pos() + camera.vrt() * bridge.x + camera.vpn() * bridge.y + camera.vup() * bridge.z; @@ -893,7 +893,7 @@ CameraDirector::Virtual(double seconds) camera.Clone(ship->Cam()); Point bridge = ship->BridgeLocation(); - Point cpos = camera.Pos() + + Point cpos = camera.Pos() + camera.vrt() * (bridge.x + virt_x) + camera.vpn() * (bridge.y + virt_z) + camera.vup() * (bridge.z + virt_y); @@ -951,11 +951,11 @@ CameraDirector::Chase(double seconds) Point chase = ship->ChaseLocation(); Point bridge = ship->BridgeLocation(); - Point cpos = camera.Pos() + + Point cpos = camera.Pos() + camera.vrt() * bridge.x * (1-step) + camera.vpn() * bridge.y * (1-step) + camera.vup() * bridge.z * (1-step) + - velocity * chase.y * step + + velocity * chase.y * step + camera.vup() * chase.z * step; camera.MoveTo(cpos); @@ -1000,7 +1000,7 @@ CameraDirector::Target(double seconds) Point delta = target_loc - ship->Location(); delta.Normalize(); delta *= -5 * ship->Radius() * step; - delta.y += ship->Radius() * step; + delta.y += ship->Radius() * step; camera.MoveTo(ship->Location() + delta); camera.LookAt(target_loc); diff --git a/Stars45/CameraDirector.h b/Stars45/CameraDirector.h index f9678c2..79bf378 100644 --- a/Stars45/CameraDirector.h +++ b/Stars45/CameraDirector.h @@ -61,9 +61,9 @@ public: enum CAM_MODE { MODE_NONE, - MODE_COCKPIT, - MODE_CHASE, - MODE_TARGET, + MODE_COCKPIT, + MODE_CHASE, + MODE_TARGET, MODE_THREAT, MODE_ORBIT, MODE_VIRTUAL, diff --git a/Stars45/CameraView.cpp b/Stars45/CameraView.cpp index 0dbb984..a746076 100644 --- a/Stars45/CameraView.cpp +++ b/Stars45/CameraView.cpp @@ -341,7 +341,7 @@ CameraView::MarkVisibleObjects() if (graphic->Hidden()) continue; - + if (graphic->CheckVisibility(projector)) { graphic->Update(); graphics.append(graphic); diff --git a/Stars45/Campaign.cpp b/Stars45/Campaign.cpp index 1b23d14..6767f84 100644 --- a/Stars45/Campaign.cpp +++ b/Stars45/Campaign.cpp @@ -474,7 +474,7 @@ Campaign::LoadCampaign(DataLoader* loader, bool full) do { delete term; term = 0; term = parser.ParseTerm(); - + if (term) { TermDef* def = term->isDef(); if (def) { @@ -917,7 +917,7 @@ Campaign::ParseAction(TermStruct* val, const char* filename) else if (gtype) action->AddRequirement(c1, gtype, gid, comp, score, intel); - + else action->AddRequirement(c1, c2, comp, score); } @@ -1014,7 +1014,7 @@ Campaign::LoadMissionList(DataLoader* loader) do { delete term; term = 0; term = parser.ParseTerm(); - + if (term) { TermDef* def = term->isDef(); if (def) { @@ -1156,7 +1156,7 @@ Campaign::LoadCustomMissions(DataLoader* loader) do { delete term; term = 0; term = parser.ParseTerm(); - + if (term) { TermDef* def = term->isDef(); if (def) { @@ -1269,7 +1269,7 @@ Campaign::LoadTemplateList(DataLoader* loader) do { delete term; term = 0; term = parser.ParseTerm(); - + if (term) { TermDef* def = term->isDef(); if (def) { diff --git a/Stars45/CampaignMissionFighter.cpp b/Stars45/CampaignMissionFighter.cpp index 06db25e..f59d24e 100644 --- a/Stars45/CampaignMissionFighter.cpp +++ b/Stars45/CampaignMissionFighter.cpp @@ -126,12 +126,12 @@ CampaignMissionFighter::CreateMission(CampaignMissionRequest* req) ::Print("\n-----------------------------------------------\n"); if (req->Script().length()) - ::Print("CMF CreateMission() request: %s '%s'\n", + ::Print("CMF CreateMission() request: %s '%s'\n", Mission::RoleName(req->Type()), (const char*) req->Script()); else - ::Print("CMF CreateMission() request: %s %s\n", + ::Print("CMF CreateMission() request: %s %s\n", Mission::RoleName(req->Type()), req->GetObjective() ? req->GetObjective()->Name().data() : "(no target)"); @@ -362,7 +362,7 @@ CampaignMissionFighter::SelectRegion() StarSystem* system = mission->GetStarSystem(); OrbitalRegion* rgn = 0; - + if (system) rgn = system->FindRegion(air_region); @@ -617,7 +617,7 @@ CampaignMissionFighter::CreateSingleElement(CombatGroup* g, CombatUnit* u) elem->SetMissionRole(Mission::ESCORT); } } - else if (u->Type() == Ship::STATION || + else if (u->Type() == Ship::STATION || u->Type() == Ship::STARBASE) { elem->SetMissionRole(Mission::FLIGHT_OPS); @@ -808,15 +808,15 @@ CampaignMissionFighter::CreatePatrols() StarSystem* system = mission->GetStarSystem(); CombatGroup* base = squadron->FindCarrier(); - + if (!base) continue; - + OrbitalRegion* region = system->FindRegion(base->GetRegion()); - + if (!region) continue; - + int patrol_type = Mission::PATROL; Point base_loc; @@ -1206,7 +1206,7 @@ CampaignMissionFighter::CreateTargetsPatrol() if (!airbase) PlanetaryInsertion(player_elem); region = air_region; - patrol_loc = base_loc + + patrol_loc = base_loc + RandomDirection() * Random( 60e3, 100e3); } else { @@ -1604,7 +1604,7 @@ CampaignMissionFighter::CreateTargetsStrike() rloc.SetAzimuthVar(30*DEGREES); n = new(__FILE__,__LINE__) Instruction(carrier_elem->Region(), - Point(), + Point(), Instruction::RTB); if (n) { n->SetSpeed(750); @@ -1748,12 +1748,12 @@ CampaignMissionFighter::CreateRandomTarget(const char* rgn, Point base_loc) if (ttype < 8) { CombatGroup* s = 0; - + if (ttype < 4) s = FindSquadron(enemy, CombatGroup::INTERCEPT_SQUADRON); else s = FindSquadron(enemy, CombatGroup::FIGHTER_SQUADRON); - + if (s) { MissionElement* elem = CreateFighterPackage(s, 2, Mission::SWEEP); if (elem) { @@ -1815,7 +1815,7 @@ CampaignMissionFighter::CreateRandomTarget(const char* rgn, Point base_loc) else if (ttype < 15) { if (oca) { CombatGroup* s = 0; - + if (airborne) s = FindSquadron(enemy, CombatGroup::LCA_SQUADRON); else @@ -2142,8 +2142,8 @@ CampaignMissionFighter::DescribeMission() sprintf_s(name, "MSN-%03d %s", mission->Identity(), Game::GetText(mission->TypeName()).data()); if (player_elem) { - sprintf_s(player_info, "%d x %s %s '%s'", - player_elem->Count(), + sprintf_s(player_info, "%d x %s %s '%s'", + player_elem->Count(), (const char*) player_elem->GetDesign()->abrv, (const char*) player_elem->GetDesign()->name, (const char*) player_elem->Name()); diff --git a/Stars45/CampaignMissionFighter.h b/Stars45/CampaignMissionFighter.h index 844d33a..139834a 100644 --- a/Stars45/CampaignMissionFighter.h +++ b/Stars45/CampaignMissionFighter.h @@ -108,8 +108,8 @@ protected: CreateSingleElement(CombatGroup* g, CombatUnit* u); virtual MissionElement* - CreateFighterPackage(CombatGroup* squadron, - int count, + CreateFighterPackage(CombatGroup* squadron, + int count, int role); virtual CombatGroup* FindSquadron(int iff, int type); diff --git a/Stars45/CampaignMissionRequest.cpp b/Stars45/CampaignMissionRequest.cpp index b29e131..44a78ad 100644 --- a/Stars45/CampaignMissionRequest.cpp +++ b/Stars45/CampaignMissionRequest.cpp @@ -33,7 +33,7 @@ OVERVIEW ======== - CampaignMissionRequest + CampaignMissionRequest */ #include "MemDebug.h" diff --git a/Stars45/CampaignMissionStarship.cpp b/Stars45/CampaignMissionStarship.cpp index 78ce103..df50b3f 100644 --- a/Stars45/CampaignMissionStarship.cpp +++ b/Stars45/CampaignMissionStarship.cpp @@ -90,12 +90,12 @@ CampaignMissionStarship::CreateMission(CampaignMissionRequest* req) ::Print("\n-----------------------------------------------\n"); if (req->Script().length()) - ::Print("CMS CreateMission() request: %s '%s'\n", + ::Print("CMS CreateMission() request: %s '%s'\n", Mission::RoleName(req->Type()), (const char*) req->Script()); else - ::Print("CMS CreateMission() request: %s %s\n", + ::Print("CMS CreateMission() request: %s %s\n", Mission::RoleName(req->Type()), req->GetObjective() ? req->GetObjective()->Name().data() : "(no target)"); @@ -1074,9 +1074,9 @@ CampaignMissionStarship::CreateRandomTarget(const char* rgn, Point base_loc) switch (ttype) { case 0: { CombatGroup* s = 0; - + s = FindSquadron(enemy, CombatGroup::DESTROYER_SQUADRON); - + if (s) { for (int i = 0; i < 2; i++) { CombatUnit* u = s->GetRandomUnit(); @@ -1199,7 +1199,7 @@ CampaignMissionStarship::CreateRandomTarget(const char* rgn, Point base_loc) default: { CombatGroup* s = 0; - + s = FindSquadron(enemy, CombatGroup::FREIGHT); if (s) { diff --git a/Stars45/CampaignMissionStarship.h b/Stars45/CampaignMissionStarship.h index d461378..fdaa8f0 100644 --- a/Stars45/CampaignMissionStarship.h +++ b/Stars45/CampaignMissionStarship.h @@ -96,8 +96,8 @@ protected: CreateSingleElement(CombatGroup* g, CombatUnit* u); virtual MissionElement* - CreateFighterPackage(CombatGroup* squadron, - int count, + CreateFighterPackage(CombatGroup* squadron, + int count, int role); virtual CombatGroup* FindSquadron(int iff, int type); diff --git a/Stars45/CampaignPlanEvent.cpp b/Stars45/CampaignPlanEvent.cpp index d8978a8..0086080 100644 --- a/Stars45/CampaignPlanEvent.cpp +++ b/Stars45/CampaignPlanEvent.cpp @@ -113,7 +113,7 @@ CampaignPlanEvent::ExecScriptedEvents() case CombatAction::COMBAT_EVENT: { CombatEvent* event = new(__FILE__,__LINE__) - CombatEvent(campaign, + CombatEvent(campaign, action->Subtype(), (int) campaign->GetTime(), action->GetIFF(), @@ -482,7 +482,7 @@ CampaignPlanEvent::ExecStatisticalEvents() CombatGroup* objective = a->GetObjective(); CombatGroup* player = campaign->GetPlayerGroup(); - if (objective && player && + if (objective && player && objective->GetCurrentZone() == player->GetCurrentZone()) a = ChooseAssignment(c->GetForce()); } @@ -642,7 +642,7 @@ CampaignPlanEvent::CreateEventDefend(CombatAssignment* a) Text info; event = new(__FILE__,__LINE__) CombatEvent(campaign, - CombatEvent::DEFEND, + CombatEvent::DEFEND, event_time, group->GetIFF(), CombatEvent::TACNET, @@ -721,7 +721,7 @@ CampaignPlanEvent::CreateEventFighterAssault(CombatAssignment* a) Text info; event = new(__FILE__,__LINE__) CombatEvent(campaign, - CombatEvent::ATTACK, + CombatEvent::ATTACK, event_time, group->GetIFF(), CombatEvent::TACNET, @@ -850,7 +850,7 @@ CampaignPlanEvent::CreateEventFighterStrike(CombatAssignment* a) Text info; event = new(__FILE__,__LINE__) CombatEvent(campaign, - CombatEvent::ATTACK, + CombatEvent::ATTACK, event_time, group->GetIFF(), CombatEvent::TACNET, @@ -990,7 +990,7 @@ CampaignPlanEvent::CreateEventFighterSweep(CombatAssignment* a) Text info; event = new(__FILE__,__LINE__) CombatEvent(campaign, - CombatEvent::ATTACK, + CombatEvent::ATTACK, event_time, group->GetIFF(), CombatEvent::TACNET, @@ -1136,7 +1136,7 @@ CampaignPlanEvent::CreateEventStarship(CombatAssignment* a) Text info; event = new(__FILE__,__LINE__) CombatEvent(campaign, - CombatEvent::ATTACK, + CombatEvent::ATTACK, event_time, group->GetIFF(), CombatEvent::TACNET, diff --git a/Stars45/CampaignPlanMission.cpp b/Stars45/CampaignPlanMission.cpp index 2db5ede..02636b0 100644 --- a/Stars45/CampaignPlanMission.cpp +++ b/Stars45/CampaignPlanMission.cpp @@ -181,14 +181,14 @@ CampaignPlanMission::PlanCampaignMission() action->AssetType(), action->AssetId()); - if (g && (g == player_group || + if (g && (g == player_group || (player_group->Type() == CombatGroup::WING && player_group->FindGroup(g->Type(), g->GetID())))) { request = new(__FILE__,__LINE__) - CampaignMissionRequest(campaign, + CampaignMissionRequest(campaign, action->Subtype(), - start, + start, g); if (request) { @@ -236,9 +236,9 @@ CampaignPlanMission::PlanStrategicMission() CombatAssignment* a = assignments[assignment_index++]; request = new(__FILE__,__LINE__) - CampaignMissionRequest(campaign, + CampaignMissionRequest(campaign, a->Type(), - start, + start, a->GetResource()); if (request) diff --git a/Stars45/CampaignSaveGame.cpp b/Stars45/CampaignSaveGame.cpp index b63fc4e..4caf0d6 100644 --- a/Stars45/CampaignSaveGame.cpp +++ b/Stars45/CampaignSaveGame.cpp @@ -226,7 +226,7 @@ CampaignSaveGame::Load(const char* filename) Sleep(5); delete term; term = 0; term = parser.ParseTerm(); - + if (term) { TermDef* def = term->isDef(); if (def) { @@ -505,7 +505,7 @@ CampaignSaveGame::Load(const char* filename) CombatGroup* player_group = campaign->FindGroup(grp_iff, grp_type, grp_id); if (player_group) { CombatUnit* player_unit = 0; - + if (unit.length()) player_unit = player_group->FindUnit(unit); @@ -633,7 +633,7 @@ CampaignSaveGame::Save(const char* name) while (++a_iter) { CombatAction* a = a_iter.value(); fprintf(f, "action: { id:%4d, stat:%d", a->Identity(), a->Status()); - + if (a->Status() == CombatAction::PENDING) { if (a->Count()) fprintf(f, ", count:%d", a->Count()); @@ -734,7 +734,7 @@ CampaignSaveGame::GetResumeFile() // check for auto save game: FILE* f; ::fopen_s(&f, GetSaveDirectory() + "/AutoSave", "r"); - + if (f) { ::fclose(f); diff --git a/Stars45/CampaignSituationReport.cpp b/Stars45/CampaignSituationReport.cpp index 24cd39a..9940c23 100644 --- a/Stars45/CampaignSituationReport.cpp +++ b/Stars45/CampaignSituationReport.cpp @@ -378,11 +378,11 @@ CampaignSituationReport::GetThreatInfo() while (++elem) { if (elem->GetIFF() > 0 && elem->GetIFF() != iff && elem->IntelLevel() > Intel::SECRET) { if (elem->IsGroundUnit()) { - if (!elem->GetDesign() || + if (!elem->GetDesign() || elem->GetDesign()->type != Ship::SAM) continue; - if (elem->Region() != rgn0 && + if (elem->Region() != rgn0 && elem->Region() != rgn1) continue; } diff --git a/Stars45/CarrierAI.cpp b/Stars45/CarrierAI.cpp index 2c1f50b..3f2bf51 100644 --- a/Stars45/CarrierAI.cpp +++ b/Stars45/CarrierAI.cpp @@ -94,7 +94,7 @@ CarrierAI::ExecFrame(double secs) if (!sim || !ship || !hangar) return; - if (((int) Game::GameTime() - hold_time >= INIT_HOLD) && + if (((int) Game::GameTime() - hold_time >= INIT_HOLD) && ((int) Game::GameTime() - exec_time > EXEC_PERIOD)) { CheckHostileElements(); @@ -280,7 +280,7 @@ CarrierAI::CreateStrike(Element* elem) if (strike) { strike->SetAssignment(elem); - + if (flight_planner) flight_planner->CreateStrikeRoute(strike, elem); @@ -314,7 +314,7 @@ CarrierAI::CreatePackage(int squadron, int size, int code, const char* target, c FlightDeck* deck = 0; int queue = 1000; int* load = 0; - const ShipDesign* + const ShipDesign* design = hangar->SquadronDesign(squadron); elem->SetSquadron(hangar->SquadronName(squadron)); diff --git a/Stars45/CmdDlg.cpp b/Stars45/CmdDlg.cpp index f51aca4..5ad2b66 100644 --- a/Stars45/CmdDlg.cpp +++ b/Stars45/CmdDlg.cpp @@ -141,7 +141,7 @@ CmdDlg::ExecFrame() if (btn_mode[MODE_INTEL]) { if (unread > 0) { char text[64]; - sprintf_s(text, "INTEL (%d)", unread); + sprintf_s(text, "INTEL (%d)", unread); btn_mode[MODE_INTEL]->SetText(text); } else { diff --git a/Stars45/CmdDlg.h b/Stars45/CmdDlg.h index 0a97663..a51abc1 100644 --- a/Stars45/CmdDlg.h +++ b/Stars45/CmdDlg.h @@ -62,7 +62,7 @@ class Starshatter; class CmdDlg { public: - enum MODE { + enum MODE { MODE_ORDERS, MODE_THEATER, MODE_FORCES, diff --git a/Stars45/CmdForceDlg.cpp b/Stars45/CmdForceDlg.cpp index c73fe82..0e75049 100644 --- a/Stars45/CmdForceDlg.cpp +++ b/Stars45/CmdForceDlg.cpp @@ -184,7 +184,7 @@ CmdForceDlg::IsVisible(Combatant* c) CombatGroup* g = groups[i]; if (g->Type() < CombatGroup::CIVILIAN && - g->CountUnits() > 0 && + g->CountUnits() > 0 && g->IntelLevel() >= Intel::KNOWN) nvis++; @@ -258,9 +258,9 @@ CmdForceDlg::AddCombatGroup(CombatGroup* grp, bool last_child) } int index = lst_combat->AddItemWithData( - Text(pipe_stack) + - Text(prefix) + - grp->GetDescription(), + Text(pipe_stack) + + Text(prefix) + + grp->GetDescription(), (DWORD) grp); lst_combat->SetItemData(index-1, 1, 0); blank_line = false; @@ -286,7 +286,7 @@ CmdForceDlg::AddCombatGroup(CombatGroup* grp, bool last_child) CombatUnit* unit = unit_iter.value(); char info[512]; int damage = (int) (100 * unit->GetSustainedDamage() / unit->GetDesign()->integrity); - + if (damage < 1 || unit->DeadCount() >= unit->Count()) { sprintf_s(info, "%s%s%s", pipe_stack, prefix, unit->GetDescription()); } else { @@ -337,7 +337,7 @@ CmdForceDlg::OnForces(AWEvent* event) while (++iter) { Combatant* c = iter.value(); - + if (name == c->Name()) { ShowCombatant(c); break; @@ -583,7 +583,7 @@ CmdForceDlg::OnCombat(AWEvent* event) for (int i = 0; i < combatants.size(); i++) { c = combatants[i]; - + if (name == c->Name()) { break; } @@ -600,7 +600,7 @@ CmdForceDlg::OnCombat(AWEvent* event) } if (btn_transfer && campaign && current_group) - btn_transfer->SetEnabled( campaign->IsActive() && + btn_transfer->SetEnabled( campaign->IsActive() && CanTransfer(current_group) ); } diff --git a/Stars45/CmdMissionsDlg.cpp b/Stars45/CmdMissionsDlg.cpp index 4c1abb3..784ff5a 100644 --- a/Stars45/CmdMissionsDlg.cpp +++ b/Stars45/CmdMissionsDlg.cpp @@ -224,7 +224,7 @@ CmdMissionsDlg::ExecFrame() for (int i = 0; i < lst_missions->NumItems(); i++) if (lst_missions->IsSelected(i)) seln = i; - + if (seln >= 0) seln_id = lst_missions->GetItemData(seln); diff --git a/Stars45/CmdTheaterDlg.cpp b/Stars45/CmdTheaterDlg.cpp index 4100fb7..b3b7ead 100644 --- a/Stars45/CmdTheaterDlg.cpp +++ b/Stars45/CmdTheaterDlg.cpp @@ -162,7 +162,7 @@ CmdTheaterDlg::ExecFrame() (zoom_in_btn && zoom_in_btn->GetButtonState() > 0)) { map_view->ZoomIn(); } - else if (Keyboard::KeyDown(VK_SUBTRACT) || + else if (Keyboard::KeyDown(VK_SUBTRACT) || (zoom_out_btn && zoom_out_btn->GetButtonState() > 0)) { map_view->ZoomOut(); } diff --git a/Stars45/CmpSelectDlg.cpp b/Stars45/CmpSelectDlg.cpp index 2a322e5..fa5acff 100644 --- a/Stars45/CmpSelectDlg.cpp +++ b/Stars45/CmpSelectDlg.cpp @@ -160,12 +160,12 @@ CmpSelectDlg::ExecFrame() lst_campaigns->SetItemImage(load_index, images[load_index]); } - description->SetText(Text("") + - campaign->Name() + + description->SetText(Text("") + + campaign->Name() + Text("\n\n") + Text("") + Game::GetText("CmpSelectDlg.scenario") + - Text("\n\t") + + Text("\n\t") + campaign->Description()); } else { @@ -177,21 +177,21 @@ CmpSelectDlg::ExecFrame() sprintf_s(score_buf, "%d", campaign->GetPlayerTeamScore()); - Text desc = Text("") + - campaign->Name() + + Text desc = Text("") + + campaign->Name() + Text("\n\n") + Text("") + Game::GetText("CmpSelectDlg.scenario") + - Text("\n\t") + + Text("\n\t") + campaign->Description() + Text("\n\n") + Game::GetText("CmpSelectDlg.campaign-time") + - Text("\n\t") + + Text("\n\t") + time_buf + Text("\n\n") + Game::GetText("CmpSelectDlg.assignment") + Text("\n\t"); - + if (campaign->GetPlayerGroup()) desc += campaign->GetPlayerGroup()->GetDescription(); else @@ -199,14 +199,14 @@ CmpSelectDlg::ExecFrame() desc += Text("\n\n") + Game::GetText("CmpSelectDlg.team-score") + - Text("\n\t") + + Text("\n\t") + score_buf; description->SetText(desc); } btn_accept->SetEnabled(true); - + if (btn_delete) btn_delete->SetEnabled(show_saved); } @@ -233,7 +233,7 @@ CmpSelectDlg::ShowNewCampaigns() AutoThreadSync a(sync); if (loading && description) { - description->SetText(Game::GetText("CmpSelectDlg.already-loading")); + description->SetText(Game::GetText("CmpSelectDlg.already-loading")); Button::PlaySound(Button::SND_REJECT); return; } @@ -273,7 +273,7 @@ CmpSelectDlg::ShowNewCampaigns() // if campaign is not available, show the grayed-out image // FULL GAME CRITERIA (based on player record): - if (c->GetCampaignId() > 2 && c->GetCampaignId() < 10 && + if (c->GetCampaignId() > 2 && c->GetCampaignId() < 10 && !player->HasCompletedCampaign(c->GetCampaignId()-1)) { images[n]->CopyBitmap(*c->GetImage(2)); lst_campaigns->SetItemImage(n, images[n]); @@ -310,7 +310,7 @@ CmpSelectDlg::ShowSavedCampaigns() AutoThreadSync a(sync); if (loading && description) { - description->SetText(Game::GetText("CmpSelectDlg.already-loading")); + description->SetText(Game::GetText("CmpSelectDlg.already-loading")); Button::PlaySound(Button::SND_REJECT); return; } @@ -359,7 +359,7 @@ CmpSelectDlg::OnCampaignSelect(AWEvent* event) AutoThreadSync a(sync); if (loading) { - description->SetText(Game::GetText("CmpSelectDlg.already-loading")); + description->SetText(Game::GetText("CmpSelectDlg.already-loading")); Button::PlaySound(Button::SND_REJECT); return; } @@ -379,7 +379,7 @@ CmpSelectDlg::OnCampaignSelect(AWEvent* event) // is campaign available? // FULL GAME CRITERIA (based on player record): - if (c->GetCampaignId() <= 2 || + if (c->GetCampaignId() <= 2 || player->HasCompletedCampaign(c->GetCampaignId()-1)) { diff --git a/Stars45/CmpnScreen.cpp b/Stars45/CmpnScreen.cpp index 60f67be..4cbef77 100644 --- a/Stars45/CmpnScreen.cpp +++ b/Stars45/CmpnScreen.cpp @@ -71,7 +71,7 @@ // +--------------------------------------------------------------------+ CmpnScreen::CmpnScreen() -: screen(0), +: screen(0), cmd_force_dlg(0), cmd_missions_dlg(0), cmd_orders_dlg(0), cmd_intel_dlg(0), cmd_theater_dlg(0), cmd_msg_dlg(0), cmp_file_dlg(0), cmp_end_dlg(0), cmp_scene_dlg(0), @@ -275,7 +275,7 @@ CmpnScreen::ExecFrame() else if (campaign->IsComplete() || campaign->IsFailed()) { bool cutscene = false; CombatEvent* event = campaign->GetLastEvent(); - + if (event && !event->Visited() && event->SceneFile() && *event->SceneFile()) { stars->ExecCutscene(event->SceneFile(), campaign->Path()); @@ -366,7 +366,7 @@ CmpnScreen::Show() bool cutscene = false; CombatEvent* event = 0; - + if (campaign->IsActive() && !campaign->GetEvents().isEmpty()) { ListIter iter = campaign->GetEvents(); while (++iter) { diff --git a/Stars45/Color.cpp b/Stars45/Color.cpp index 5991d44..58b25f4 100644 --- a/Stars45/Color.cpp +++ b/Stars45/Color.cpp @@ -194,7 +194,7 @@ Color::Formatted() const DWORD g = Green()>>format.gdown; DWORD b = Blue() >>format.bdown; DWORD a = Alpha()>>format.adown; - + return (r<>format.gdown; DWORD b = Blue() >>format.bdown; DWORD a = Alpha()>>format.adown; - + return (r<>tf.adown; } @@ -271,7 +271,7 @@ Color::TextureFormat(int keep_alpha) const // transparent: a = 255>>tf.adown; } - + else if (texture_alpha_level == 2) { // translucent: if (r || g || b) @@ -304,7 +304,7 @@ Color::ShadeColor(int shade) const } else if (shade > SHADE_LEVELS) { // shade towards white double step = (shade - range)/range; - + sr = fr - (fr - 1.0) * step; sg = fg - (fg - 1.0) * step; sb = fb - (fb - 1.0) * step; @@ -339,7 +339,7 @@ Color::Unformat(DWORD formatted_color) BYTE g = (BYTE) ((formatted_color & format.gmask)>>format.gshift) << format.gdown; BYTE b = (BYTE) ((formatted_color & format.bmask)>>format.bshift) << format.bdown; BYTE a = (BYTE) ((formatted_color & format.amask)>>format.ashift) << format.adown; - + return Color(r,g,b,a); } } @@ -465,13 +465,13 @@ static BYTE MatchRGB(PALETTEENTRY* pal, BYTE r, BYTE g, BYTE b) double dr = p->peRed - r; double dg = p->peGreen - g; double db = p->peBlue - b; - + double d = (dr*dr) + (dg*dg) + (db*db); if (d < mindist) { mindist = d; match = i; - + if (d < 1.0) return match; } @@ -497,9 +497,9 @@ Color::SetPalette(PALETTEENTRY* pal, int palsize, BYTE* invpal) BYTE r = (i >> 10) & 0x1f; BYTE g = (i >> 5) & 0x1f; BYTE b = (i ) & 0x1f; - + Color c(r<<3, g<<3, b<<3); - + table[i] = MatchRGB(palette, r<<3, g<<3, b<<3); } } @@ -556,7 +556,7 @@ Color::SetFade(double f, Color c, int build_shade) // modify the video palette as well: if (format.pal && video) { PALETTEENTRY fade_palette[256]; - + double step = (1.0 - fade); for (int i = 0; i < 256; i++) { PALETTEENTRY& entry = fade_palette[i]; @@ -569,7 +569,7 @@ Color::SetFade(double f, Color c, int build_shade) } } - // otherwise, we need to re-compute + // otherwise, we need to re-compute // the shade table: else { if (build_shade) { @@ -601,11 +601,11 @@ Color::BuildBlendTable() for (int dst = 0; dst < 256; dst++) { ColorIndex src_clr = ColorIndex(src); ColorIndex dst_clr = ColorIndex(dst); - + int r = src_clr.Red() + dst_clr.Red(); int g = src_clr.Green() + dst_clr.Green(); int b = src_clr.Blue() + dst_clr.Blue(); - + if (r>255) r=255; if (g>255) g=255; if (b>255) b=255; @@ -700,7 +700,7 @@ inline BYTE bclamp(float x) { return (BYTE) ((x<0) ? 0 : (x>255) ? 255 : x); } Color ColorValue::ToColor() const { - return Color(bclamp(r * 255.0f), + return Color(bclamp(r * 255.0f), bclamp(g * 255.0f), bclamp(b * 255.0f), bclamp(a * 255.0f)); diff --git a/Stars45/Color.h b/Stars45/Color.h index 7788875..38e973d 100644 --- a/Stars45/Color.h +++ b/Stars45/Color.h @@ -101,7 +101,7 @@ public: Color(const Color& c) : rgba(c.rgba) { } Color(BYTE r, BYTE g, BYTE b, BYTE a=255) { rgba = (r<Name()); else - sprintf_s(desc, "%s %s %s", + sprintf_s(desc, "%s %s %s", (const char*) resource->Name(), (const char*) Mission::RoleName(type), (const char*) objective->Name()); diff --git a/Stars45/CombatAssignment.h b/Stars45/CombatAssignment.h index a366af4..7b1e627 100644 --- a/Stars45/CombatAssignment.h +++ b/Stars45/CombatAssignment.h @@ -71,7 +71,7 @@ public: const char* GetDescription() const; bool IsActive() const { return resource != 0; } -private: +private: int type; CombatGroup* objective; CombatGroup* resource; diff --git a/Stars45/CombatEvent.cpp b/Stars45/CombatEvent.cpp index 315e755..2c534b1 100644 --- a/Stars45/CombatEvent.cpp +++ b/Stars45/CombatEvent.cpp @@ -51,7 +51,7 @@ // +----------------------------------------------------------------------+ -CombatEvent::CombatEvent(Campaign* c, int typ, int tim, int tem, +CombatEvent::CombatEvent(Campaign* c, int typ, int tim, int tem, int src, const char* rgn) : campaign(c), type(typ), time(tim), team(tem), source(src), region(rgn), points(0), visited(false) diff --git a/Stars45/CombatGroup.cpp b/Stars45/CombatGroup.cpp index a8cf988..9b5088a 100644 --- a/Stars45/CombatGroup.cpp +++ b/Stars45/CombatGroup.cpp @@ -108,9 +108,9 @@ CombatGroup::IsTargetable() const return false; // civilian / non-combatant are not strategic targets: - if (type == PASSENGER || - type == PRIVATE || - type == MEDICAL || + if (type == PASSENGER || + type == PRIVATE || + type == MEDICAL || type == HABITAT) return false; @@ -135,9 +135,9 @@ CombatGroup::IsStrikeTarget() const { if (type < BATTALION || type == MINEFIELD || // assault, not strike - type == PASSENGER || - type == PRIVATE || - type == MEDICAL || + type == PASSENGER || + type == PRIVATE || + type == MEDICAL || type == HABITAT) return false; @@ -466,7 +466,7 @@ CombatGroup::GetOrdinal() const if (last_two_digits > 10 && last_two_digits < 20) { sprintf_s(ordinal, "ordinal.%d", last_two_digits); Text suffix = Game::GetText(ordinal); - + if (suffix != ordinal) sprintf_s(ordinal, "%d%s", id, suffix.data()); else @@ -536,7 +536,7 @@ CombatGroup::GetDescription() const case MEDICAL: sprintf_s(desc, "%s %s%s", GetOrdinal(), Game::GetText("CombatGroup.MEDICAL").data(), name_desc); break; case CIVILIAN: - case WAR_PRODUCTION: + case WAR_PRODUCTION: case FACTORY: case REFINERY: case RESOURCE: strcpy_s(desc, (const char*) name); break; @@ -594,7 +594,7 @@ CombatGroup::GetShortDescription() const case REPAIR: sprintf_s(desc, "%s %s", GetOrdinal(), Game::GetText("CombatGroup.abrv.REPAIR").data()); break; case CIVILIAN: - case WAR_PRODUCTION: + case WAR_PRODUCTION: case FACTORY: case REFINERY: case RESOURCE: strcpy_s(desc, (const char*) name); break; @@ -791,7 +791,7 @@ CombatGroup::FindCarrier() { CombatGroup* p = GetParent(); - while (p != 0 && + while (p != 0 && p->Type() != CombatGroup::CARRIER_GROUP && p->Type() != CombatGroup::STATION && p->Type() != CombatGroup::STARBASE) @@ -1014,7 +1014,7 @@ CombatGroup::LoadOrderOfBattle(const char* filename, int team, Combatant* combat do { delete term; term = 0; term = parser.ParseTerm(); - + if (term) { TermDef* def = term->isDef(); if (def) { @@ -1047,7 +1047,7 @@ CombatGroup::LoadOrderOfBattle(const char* filename, int team, Combatant* combat int unit_damage = 0; int unit_heading= 0; int unit_index = 0; - + *name = 0; *type = 0; *intel = 0; @@ -1064,7 +1064,7 @@ CombatGroup::LoadOrderOfBattle(const char* filename, int team, Combatant* combat // all groups in this OOB default to the IFF of the main force if (force) iff = force->GetIFF(); - + for (int i = 0; i < val->elements()->size(); i++) { TermDef* pdef = val->elements()->at(i)->isDef(); if (pdef && (iff < 0 || team < 0 || iff == team)) { @@ -1094,7 +1094,7 @@ CombatGroup::LoadOrderOfBattle(const char* filename, int team, Combatant* combat ZeroMemory(unit_region, sizeof(unit_region)); ZeroMemory(design, sizeof(design)); - + for (int i = 0; i < val->elements()->size(); i++) { TermDef* pdef = val->elements()->at(i)->isDef(); if (pdef) { @@ -1258,7 +1258,7 @@ CombatGroup::MergeOrderOfBattle(BYTE* block, const char* filename, int team, Com do { delete term; term = 0; term = parser.ParseTerm(); - + if (term) { TermDef* def = term->isDef(); if (def) { @@ -1293,7 +1293,7 @@ CombatGroup::MergeOrderOfBattle(BYTE* block, const char* filename, int team, Com int unit_damage = 0; int unit_heading= 0; int unit_index = 0; - + *name = 0; *type = 0; *intel = 0; @@ -1309,7 +1309,7 @@ CombatGroup::MergeOrderOfBattle(BYTE* block, const char* filename, int team, Com // all groups in this OOB default to the IFF of the main force if (force) iff = force->GetIFF(); - + for (int i = 0; i < val->elements()->size(); i++) { TermDef* pdef = val->elements()->at(i)->isDef(); if (pdef && (iff < 0 || team < 0 || iff == team)) { @@ -1342,7 +1342,7 @@ CombatGroup::MergeOrderOfBattle(BYTE* block, const char* filename, int team, Com ZeroMemory(unit_region, sizeof(unit_region)); ZeroMemory(design, sizeof(design)); - + for (int i = 0; i < val->elements()->size(); i++) { TermDef* pdef = val->elements()->at(i)->isDef(); if (pdef) { @@ -1410,7 +1410,7 @@ CombatGroup::MergeOrderOfBattle(BYTE* block, const char* filename, int team, Com if (!force) continue; - // if we already have a force, and we find a second one, + // if we already have a force, and we find a second one, // it must be the start of a different combatant. // So don't process any further: if (TypeFromName(type) == CombatGroup::FORCE) { @@ -1541,8 +1541,8 @@ SaveCombatUnit(FILE* f, CombatUnit* u) } fprintf(f, " dead_count: %d, damage: %d, heading: %d },", - (int) u->DeadCount(), - (int) u->GetSustainedDamage(), + (int) u->DeadCount(), + (int) u->GetSustainedDamage(), (int) (u->GetHeading() / DEGREES)); } diff --git a/Stars45/CombatGroup.h b/Stars45/CombatGroup.h index 7a49c1d..879cd24 100644 --- a/Stars45/CombatGroup.h +++ b/Stars45/CombatGroup.h @@ -60,7 +60,7 @@ class CombatGroup public: static const char* TYPENAME() { return "CombatGroup"; } - enum GROUP_TYPE { + enum GROUP_TYPE { FORCE = 1, // Commander In Chief WING, // Air Force @@ -214,7 +214,7 @@ public: static int TypeFromName(const char* name); static const char* NameFromType(int type); -private: +private: const char* GetOrdinal() const; // attributes: diff --git a/Stars45/CombatZone.cpp b/Stars45/CombatZone.cpp index 3e2cac4..fc9f201 100644 --- a/Stars45/CombatZone.cpp +++ b/Stars45/CombatZone.cpp @@ -188,7 +188,7 @@ CombatZone::Load(const char* filename) do { delete term; term = 0; term = parser.ParseTerm(); - + if (term) { TermDef* def = term->isDef(); if (def) { diff --git a/Stars45/CombatZone.h b/Stars45/CombatZone.h index b53c844..2067b14 100644 --- a/Stars45/CombatZone.h +++ b/Stars45/CombatZone.h @@ -84,7 +84,7 @@ public: static List& Load(const char* filename); -private: +private: // attributes: Text name; Text system; @@ -112,7 +112,7 @@ public: void SetNeed(int group_type, int needed); void AddNeed(int group_type, int needed); -private: +private: // attributes: int iff; List groups; diff --git a/Stars45/Combatant.h b/Stars45/Combatant.h index e3a79be..d690995 100644 --- a/Stars45/Combatant.h +++ b/Stars45/Combatant.h @@ -80,7 +80,7 @@ public: double GetTargetStratFactor(int type); void SetTargetStratFactor(int type, double f); -private: +private: Text name; int iff; int score; diff --git a/Stars45/ComboBox.cpp b/Stars45/ComboBox.cpp index 4a5d919..bb01bcd 100644 --- a/Stars45/ComboBox.cpp +++ b/Stars45/ComboBox.cpp @@ -179,7 +179,7 @@ ComboBox::Draw() DrawText(caption.data(), 0, label_rect, DT_CALCRECT | DT_WORDBREAK | text_align); vert_space = (vert_space - label_rect.h)/2; - + label_rect.w = horz_space; if (vert_space > 0) @@ -290,7 +290,7 @@ int ComboBox::OnClick() } int ComboBox::OnMouseEnter(int mx, int my) -{ +{ if (button_state == 0) button_state = -1; @@ -320,7 +320,7 @@ void ComboBox::MoveTo(const Rect& r) void ComboBox::ShowList() { if (!list) { - list = new(__FILE__,__LINE__) ComboList(this, screen, + list = new(__FILE__,__LINE__) ComboList(this, screen, rect.x, rect.y, rect.w, rect.h, items.size()); @@ -366,7 +366,7 @@ void ComboBox::OnListSelect(AWEvent* event) { if (list) { int new_seln = list->GetSelectedIndex(); - + if (new_seln >= 0 && new_seln < items.size()) seln = new_seln; diff --git a/Stars45/ComboList.cpp b/Stars45/ComboList.cpp index d070b9f..982f2b9 100644 --- a/Stars45/ComboList.cpp +++ b/Stars45/ComboList.cpp @@ -173,7 +173,7 @@ ComboList::Draw() // opening: if (scrolling > 0) { int limit = std::min(items.size(), max_entries); - + if (scroll < limit) { if (limit > 6) scroll += 4; @@ -254,7 +254,7 @@ ComboList::DrawItem(Text label, Rect& btn_rect, int state) DrawText(label.data(), 0, label_rect, DT_CALCRECT | DT_WORDBREAK | text_align); vert_space = (vert_space - label_rect.h)/2; - + label_rect.w = horz_space; if (vert_space > 0) @@ -307,7 +307,7 @@ int ComboList::OnMouseMove(int x, int y) int new_seln = CalcSeln(x,y); if (new_seln != seln) { - seln = new_seln; + seln = new_seln; Button::PlaySound(Button::SND_COMBO_HILITE); } @@ -343,7 +343,7 @@ int ComboList::OnClick() } int ComboList::OnMouseEnter(int mx, int my) -{ +{ if (button_state == 0) button_state = -1; @@ -351,7 +351,7 @@ int ComboList::OnMouseEnter(int mx, int my) } int ComboList::OnMouseExit(int mx, int my) -{ +{ if (button_state == -1) button_state = 0; diff --git a/Stars45/Component.cpp b/Stars45/Component.cpp index aa48285..5029639 100644 --- a/Stars45/Component.cpp +++ b/Stars45/Component.cpp @@ -33,7 +33,7 @@ OVERVIEW ======== - Generic ship system sub-component class + Generic ship system sub-component class */ #include "MemDebug.h" diff --git a/Stars45/Contact.cpp b/Stars45/Contact.cpp index 9a4d419..a2115df 100644 --- a/Stars45/Contact.cpp +++ b/Stars45/Contact.cpp @@ -87,7 +87,7 @@ Contact::~Contact() // +----------------------------------------------------------------------+ -int +int Contact::operator == (const Contact& c) const { if (ship) @@ -113,7 +113,7 @@ Contact::Update(SimObject* obj) ClearTrack(); } - return SimObserver::Update(obj); + return SimObserver::Update(obj); } const char* diff --git a/Stars45/CtlDlg.cpp b/Stars45/CtlDlg.cpp index 0908f89..6b33c31 100644 --- a/Stars45/CtlDlg.cpp +++ b/Stars45/CtlDlg.cpp @@ -345,7 +345,7 @@ CtlDlg::OnCommand(AWEvent* event) // double-click: if (list_index == command_index && Game::RealTime() - command_click_time < 350) { KeyDlg* key_dlg = 0; - + if (manager) key_dlg = manager->GetKeyDlg(); diff --git a/Stars45/D3DXImage.cpp b/Stars45/D3DXImage.cpp index 1947137..f2f7dd8 100644 --- a/Stars45/D3DXImage.cpp +++ b/Stars45/D3DXImage.cpp @@ -128,11 +128,11 @@ bool D3DXImage::LoadBuffer(BYTE* buf, int len) IDirect3DDevice9* dev = VideoDX9::GetD3DDevice9(); - hr = dev->CreateOffscreenPlainSurface( width, - height, - D3DFMT_A8R8G8B8, - D3DPOOL_SYSTEMMEM, - &surf, + hr = dev->CreateOffscreenPlainSurface( width, + height, + D3DFMT_A8R8G8B8, + D3DPOOL_SYSTEMMEM, + &surf, NULL); if (FAILED(hr)) @@ -194,11 +194,11 @@ bool D3DXImage::Save(char *filename) IDirect3DSurface9* surf = 0; IDirect3DDevice9* dev = VideoDX9::GetD3DDevice9(); - hr = dev->CreateOffscreenPlainSurface( width, - height, - D3DFMT_A8R8G8B8, - D3DPOOL_SYSTEMMEM, - &surf, + hr = dev->CreateOffscreenPlainSurface( width, + height, + D3DFMT_A8R8G8B8, + D3DPOOL_SYSTEMMEM, + &surf, NULL); diff --git a/Stars45/DataLoader.cpp b/Stars45/DataLoader.cpp index 6998112..c57c4a5 100644 --- a/Stars45/DataLoader.cpp +++ b/Stars45/DataLoader.cpp @@ -122,7 +122,7 @@ DataLoader::EnableDatafile(const char* name) ::fclose(f); DataArchive* a = new(__FILE__,__LINE__) DataArchive(name); - + if (a && a->NumFiles() >= 1) { status = DATAFILE_OK; @@ -445,7 +445,7 @@ DataLoader::LoadPartialFile(const char* name, BYTE*& buf, int max_load, bool opt strcat_s(filename, name); // first check current directory: - FILE* f; + FILE* f; ::fopen_s(&f, filename, "rb"); if (f) { diff --git a/Stars45/Debris.cpp b/Stars45/Debris.cpp index d867fb9..dda7a9d 100644 --- a/Stars45/Debris.cpp +++ b/Stars45/Debris.cpp @@ -53,7 +53,7 @@ // +--------------------------------------------------------------------+ Debris::Debris(Model* model, const Vec3& pos, const Vec3& vel, double m) -: SimObject("Debris", SimObject::SIM_DEBRIS) +: SimObject("Debris", SimObject::SIM_DEBRIS) { MoveTo(pos); diff --git a/Stars45/DetailSet.cpp b/Stars45/DetailSet.cpp index 0181005..6aec815 100644 --- a/Stars45/DetailSet.cpp +++ b/Stars45/DetailSet.cpp @@ -193,7 +193,7 @@ DetailSet::GetDetailLevel() for (int i = 1; i < levels && rad[i] > 0; i++) { double apparent_feature_size = (rad[i] * screen_width) / distance; - + if (apparent_feature_size > 0.4) index = i; } @@ -210,7 +210,7 @@ DetailSet::GetRep(int level, int n) if (level >= 0 && level < levels && n >= 0 && n < rep[level].size()) return rep[level].at(n); - return 0; + return 0; } Point @@ -219,7 +219,7 @@ DetailSet::GetOffset(int level, int n) if (level >= 0 && level < levels && n >= 0 && n < off[level].size()) return *(off[level].at(n)); - return Point(); + return Point(); } Point diff --git a/Stars45/Director.h b/Stars45/Director.h index d34805d..39d8e68 100644 --- a/Stars45/Director.h +++ b/Stars45/Director.h @@ -51,7 +51,7 @@ class Physical; class Director { public: - Director() { } + Director() { } virtual ~Director() { } // accessors: diff --git a/Stars45/DisplayView.cpp b/Stars45/DisplayView.cpp index bdd84e6..91b29e4 100644 --- a/Stars45/DisplayView.cpp +++ b/Stars45/DisplayView.cpp @@ -165,7 +165,7 @@ DisplayView::Refresh() // draw image: else if (elem->image) { - window->FadeBitmap( elem_rect.x, + window->FadeBitmap( elem_rect.x, elem_rect.y, elem_rect.x + elem_rect.w, elem_rect.y + elem_rect.h, @@ -216,9 +216,9 @@ void DisplayView::AddText( const char* text, Font* font, Color color, -const Rect& rect, -double hold, -double fade_in, +const Rect& rect, +double hold, +double fade_in, double fade_out) { DisplayElement* elem = new(__FILE__,__LINE__) DisplayElement; @@ -242,8 +242,8 @@ DisplayView::AddImage(Bitmap* bmp, Color color, int blend, const Rect& rect, -double hold, -double fade_in, +double hold, +double fade_in, double fade_out) { DisplayElement* elem = new(__FILE__,__LINE__) DisplayElement; diff --git a/Stars45/DisplayView.h b/Stars45/DisplayView.h index 3fec85e..4a102ec 100644 --- a/Stars45/DisplayView.h +++ b/Stars45/DisplayView.h @@ -65,16 +65,16 @@ public: virtual void ExecFrame(); virtual void ClearDisplay(); - virtual void AddText(const char* txt, - Font* font, - Color color, + virtual void AddText(const char* txt, + Font* font, + Color color, const Rect& rect, double hold = 1e9, double fade_in = 0, double fade_out = 0); virtual void AddImage(Bitmap* bmp, - Color color, + Color color, int blend, const Rect& rect, double hold = 1e9, diff --git a/Stars45/Drive.cpp b/Stars45/Drive.cpp index 570721d..c8d9721 100644 --- a/Stars45/Drive.cpp +++ b/Stars45/Drive.cpp @@ -367,7 +367,7 @@ Drive::GetRequest(double seconds) const bool Drive::IsAugmenterOn() const { - return augmenter > 0 && + return augmenter > 0 && augmenter_throttle > 0.05 && IsPowerOn() && status > CRITICAL; diff --git a/Stars45/DropShipAI.cpp b/Stars45/DropShipAI.cpp index e8356a5..873ff11 100644 --- a/Stars45/DropShipAI.cpp +++ b/Stars45/DropShipAI.cpp @@ -87,7 +87,7 @@ DropShipAI::FindObjective() Point dst = dst_rgn->GetOrbitalRegion()->Location() - self_rgn->GetOrbitalRegion()->Location() + Point(0, 0, -1e6); - + obj_w = dst.OtherHand(); } diff --git a/Stars45/EditBox.cpp b/Stars45/EditBox.cpp index c2ed3a1..7102302 100644 --- a/Stars45/EditBox.cpp +++ b/Stars45/EditBox.cpp @@ -135,14 +135,14 @@ EditBox::DrawTabbedText() if (style & WIN_TEXT_SHADOW) { label_rect.x++; label_rect.y++; - + font->SetColor(back_color); DrawText(s.data() + h_offset, 0, label_rect, text_flags); - + label_rect.x--; label_rect.y--; } - + font->SetColor(fore_color); DrawText(s.data() + h_offset, 0, label_rect, text_flags); } diff --git a/Stars45/Encrypt.cpp b/Stars45/Encrypt.cpp index 48ffcdf..176d7d0 100644 --- a/Stars45/Encrypt.cpp +++ b/Stars45/Encrypt.cpp @@ -80,7 +80,7 @@ static void decypher(long* v) sum=delta<<5; while (n-->0) { - z-= (y<<4)+k[2] ^ y+sum ^ (y>>5)+k[3]; + z-= (y<<4)+k[2] ^ y+sum ^ (y>>5)+k[3]; y-= (z<<4)+k[0] ^ z+sum ^ (z>>5)+k[1]; sum-=delta; } @@ -91,7 +91,7 @@ static void decypher(long* v) // +-------------------------------------------------------------------+ -Text +Text Encryption::Encrypt(Text block) { int len = block.length(); @@ -123,7 +123,7 @@ Encryption::Encrypt(Text block) // +-------------------------------------------------------------------+ -Text +Text Encryption::Decrypt(Text block) { int len = block.length(); @@ -151,7 +151,7 @@ Encryption::Decrypt(Text block) static const char* codes = "abcdefghijklmnop"; -Text +Text Encryption::Encode(Text block) { int len = block.length() * 2; @@ -172,7 +172,7 @@ Encryption::Encode(Text block) // +-------------------------------------------------------------------+ -Text +Text Encryption::Decode(Text block) { int len = block.length() / 2; diff --git a/Stars45/Encrypt.h b/Stars45/Encrypt.h index d4336bf..bbba0bc 100644 --- a/Stars45/Encrypt.h +++ b/Stars45/Encrypt.h @@ -48,7 +48,7 @@ class Encryption { public: - // private key encryption / decryption of + // private key encryption / decryption of // arbitrary blocks of data static Text Encrypt(Text block); static Text Decrypt(Text block); diff --git a/Stars45/ExceptionHandler.cpp b/Stars45/ExceptionHandler.cpp index 6233b7a..1e86e7d 100644 --- a/Stars45/ExceptionHandler.cpp +++ b/Stars45/ExceptionHandler.cpp @@ -77,7 +77,7 @@ private: typedef BOOL (__stdcall * STACKWALKPROC)(DWORD, HANDLE, - HANDLE, + HANDLE, LPSTACKFRAME, LPVOID, PREAD_PROCESS_MEMORY_ROUTINE, @@ -317,7 +317,7 @@ ExceptionHandler::IntelStackTrace(CONTEXT* context) if (pFrame <= pPrevFrame) break; - // Can two DWORDs be read from the supposed frame address? + // Can two DWORDs be read from the supposed frame address? if (IsBadWritePtr(pFrame, sizeof(PVOID)*2)) break; @@ -451,6 +451,6 @@ ExceptionHandler::InitImageHelp() } Print("Loaded IMAGEHLP.DLL\n"); - return TRUE; + return TRUE; } diff --git a/Stars45/ExitDlg.cpp b/Stars45/ExitDlg.cpp index 53a349f..ca2fdba 100644 --- a/Stars45/ExitDlg.cpp +++ b/Stars45/ExitDlg.cpp @@ -57,7 +57,7 @@ DEF_MAP_CLIENT(ExitDlg, OnCancel); // +--------------------------------------------------------------------+ ExitDlg::ExitDlg(Screen* s, FormDef& def, MenuScreen* mgr) -: FormWindow(s, 0, 0, s->Width(), s->Height()), +: FormWindow(s, 0, 0, s->Width(), s->Height()), manager(mgr), exit_latch(false), credits(0), apply(0), cancel(0), def_rect(def.GetRect()) diff --git a/Stars45/Explosion.cpp b/Stars45/Explosion.cpp index 131aac8..06dbbc0 100644 --- a/Stars45/Explosion.cpp +++ b/Stars45/Explosion.cpp @@ -83,7 +83,7 @@ static bool recycles[MAX_EXPLOSION_TYPES]; // +--------------------------------------------------------------------+ Explosion::Explosion(int t, const Vec3& pos, const Vec3& vel, -float exp_scale, float part_scale, +float exp_scale, float part_scale, SimRegion* rgn, SimObject* src) : SimObject("Explosion", t), type(t), particles(0), source(src) { @@ -131,10 +131,10 @@ SimRegion* rgn, SimObject* src) if (num_parts[type] > 0) { particles = new(__FILE__,__LINE__) Particles(particle_bitmaps[type], - num_parts[type], - pos, - Vec3(0.0f, 0.0f, 0.0f), - part_speeds[type] * part_scale, + num_parts[type], + pos, + Vec3(0.0f, 0.0f, 0.0f), + part_speeds[type] * part_scale, part_drags[type], part_scales[type] * part_scale, part_blooms[type] * part_scale, @@ -151,7 +151,7 @@ SimRegion* rgn, SimObject* src) if (rep) rep->MoveTo(pos); - if (light) + if (light) light->MoveTo(pos); } @@ -542,7 +542,7 @@ Explosion::ExecFrame(double seconds) if (source == Sim::GetSim()->GetPlayerShip()) { Ship* ship = (Ship*) source; - if (CameraDirector::GetCameraMode() == CameraDirector::MODE_COCKPIT && + if (CameraDirector::GetCameraMode() == CameraDirector::MODE_COCKPIT && !ship->IsDying()) { if (rep) rep->Hide(); if (particles) particles->Hide(); diff --git a/Stars45/Explosion.h b/Stars45/Explosion.h index f277131..78c48f9 100644 --- a/Stars45/Explosion.h +++ b/Stars45/Explosion.h @@ -52,7 +52,7 @@ class System; // +--------------------------------------------------------------------+ -class Explosion : public SimObject, +class Explosion : public SimObject, public SimObserver { public: @@ -66,7 +66,7 @@ public: HULL_FIRE = 6, PLASMA_LEAK = 7, SMOKE_TRAIL = 8, - SMALL_FIRE = 9, + SMALL_FIRE = 9, SMALL_EXPLOSION = 10, LARGE_EXPLOSION = 11, LARGE_BURST = 12, @@ -75,7 +75,7 @@ public: HYPER_FLASH = 15 }; - Explosion(int type, const Vec3& pos, const Vec3& vel, + Explosion(int type, const Vec3& pos, const Vec3& vel, float exp_scale, float part_scale, SimRegion* rgn=0, SimObject* source=0); virtual ~Explosion(); @@ -94,7 +94,7 @@ public: protected: int type; - Particles* particles; + Particles* particles; float scale; float scale1; diff --git a/Stars45/Farcaster.cpp b/Stars45/Farcaster.cpp index 6792b46..e54b8fb 100644 --- a/Stars45/Farcaster.cpp +++ b/Stars45/Farcaster.cpp @@ -204,7 +204,7 @@ Farcaster::Jump() SimRegion* rgn = ship->GetRegion(); SimRegion* dst = dest->GetRegion(); - sim->CreateExplosion(jumpship->Location(), Point(0,0,0), + sim->CreateExplosion(jumpship->Location(), Point(0,0,0), Explosion::QUANTUM_FLASH, 1.0f, 0, rgn); sim->RequestHyperJump(jumpship, dst, dest->Location().OtherHand(), 0, ship, dest); diff --git a/Stars45/FighterAI.cpp b/Stars45/FighterAI.cpp index 3cb2776..b6a720a 100644 --- a/Stars45/FighterAI.cpp +++ b/Stars45/FighterAI.cpp @@ -174,7 +174,7 @@ FighterAI::ExecFrame(double s) ship->CloneCam(landing_cam); ship->MoveTo(dst); - + if (!ship->IsAirborne()) { ship->SetVelocity(carrier->Velocity()); } @@ -193,8 +193,8 @@ FighterAI::ExecFrame(double s) else { Instruction* orders = ship->GetRadioOrders(); - if (orders && - (orders->Action() == RadioMessage::WEP_HOLD || + if (orders && + (orders->Action() == RadioMessage::WEP_HOLD || orders->Action() == RadioMessage::FORM_UP)) { form_up = true; rtb_code = 0; @@ -301,7 +301,7 @@ FighterAI::FindObjective() } // not inbound yet, check for RTB order: - else { + else { Instruction* orders = (Instruction*) ship->GetRadioOrders(); int action = 0; @@ -659,7 +659,7 @@ FighterAI::Navigator() z_shift = 0; hold = false; - if ((ship->GetElement() && ship->GetElement()->GetHoldTime() > 0) || + if ((ship->GetElement() && ship->GetElement()->GetHoldTime() > 0) || (navpt && navpt->Status() == Instruction::COMPLETE && navpt->HoldTime() > 0)) hold = true; @@ -860,7 +860,7 @@ FighterAI::ThrottleControl() throttle = 0; // holding short? - if (inbound->Approach() == 0 && !inbound->Cleared() && + if (inbound->Approach() == 0 && !inbound->Cleared() && distance < 2000 && !ship->IsAirborne()) desired = 0; @@ -1038,7 +1038,7 @@ FighterAI::ThrottleControl() throttle = 50; } } - + else if (ward) { double d = (ship->Location() - ward->Location()).length(); @@ -1221,7 +1221,7 @@ FighterAI::SeekTarget() result.brake = 1; result.stop = 1; } - + return result; } @@ -1264,7 +1264,7 @@ FighterAI::SeekTarget() result.brake = 1; result.stop = 1; } - + else if (!inbound->Cleared() && distance < 2000) { ship->SetDirectorInfo(Game::GetText("ai.hold-final")); result = Steer(); @@ -1321,7 +1321,7 @@ FighterAI::SeekTarget() s.pitch = -0.1; if (objective.x > 0) s.yaw = 0.1; - else s.yaw = -0.1; + else s.yaw = -0.1; return s; } @@ -1459,7 +1459,7 @@ FighterAI::Seek(const Point& point) if (point.z > 0.0f) { az[0] = atan2(fabs(point.x), point.z) * seek_gain; el[0] = atan2(fabs(point.y), point.z) * seek_gain; - + if (point.x < 0) az[0] = -az[0]; if (point.y > 0) el[0] = -el[0]; @@ -1628,7 +1628,7 @@ FighterAI::EvadeThreat() else { evading = true; - + if (target != nullptr) { if (target == threat) { if (target->Type() == SimObject::SIM_SHIP) { @@ -1753,7 +1753,7 @@ FighterAI::FireControl() double dy = fabs(objective.y / distance); if (primary->GetFiringOrders() == Weapon::MANUAL && - dx < gun_basket && dy < gun_basket && + dx < gun_basket && dy < gun_basket && distance > dsgn_primary->min_range && distance < dsgn_primary->max_range && !primary->IsBlockedFriendly()) @@ -1785,7 +1785,7 @@ FighterAI::FireControl() extra_time = 10; s_range = 0.75; } - + else if (!tgt_ship->IsDropship()) { extra_time = 0.5 * factor + 0.5; s_range = 0.9; @@ -1838,8 +1838,8 @@ FighterAI::CalcDefensePerimeter(Ship* starship) while (++w_iter) { Weapon* weapon = w_iter.value(); - if (weapon->Ammo() && - weapon->GetTarget() == ship && + if (weapon->Ammo() && + weapon->GetTarget() == ship && !weapon->IsBlockedFriendly()) { double range = weapon->Design()->max_range * 1.2; diff --git a/Stars45/FighterTacticalAI.cpp b/Stars45/FighterTacticalAI.cpp index a1d2cce..9463a92 100644 --- a/Stars45/FighterTacticalAI.cpp +++ b/Stars45/FighterTacticalAI.cpp @@ -368,7 +368,7 @@ FighterTacticalAI::SelectSecondaryForTarget(Ship* tgt) WeaponGroup* best = 0; List weps; - + if (ListSecondariesForTarget(tgt, weps)) { winchester[wix] = false; @@ -417,7 +417,7 @@ FighterTacticalAI::SelectSecondaryForTarget(Ship* tgt) } } } - + else { winchester[wix] = true; @@ -498,9 +498,9 @@ FighterTacticalAI::FindThreat() while (++c_iter) { Contact* contact = c_iter.value(); - if (contact->Threat(ship) && + if (contact->Threat(ship) && (Game::GameTime() - contact->AcquisitionTime()) > THREAT_REACTION_TIME) { - + double rng = contact->Range(ship); if (contact->GetShot()) { diff --git a/Stars45/FlightComp.cpp b/Stars45/FlightComp.cpp index a5fc818..d2eb45c 100644 --- a/Stars45/FlightComp.cpp +++ b/Stars45/FlightComp.cpp @@ -46,7 +46,7 @@ FlightComp::FlightComp(int comp_type, const char* comp_name) : Computer(comp_type, comp_name), mode(0), vlimit(0.0f), -trans_x_limit(0.0f), trans_y_limit(0.0f), trans_z_limit(0.0f), +trans_x_limit(0.0f), trans_y_limit(0.0f), trans_z_limit(0.0f), throttle(0.0f), halt(0) { } @@ -54,7 +54,7 @@ throttle(0.0f), halt(0) FlightComp::FlightComp(const Computer& c) : Computer(c), mode(0), vlimit(0.0f), -trans_x_limit(0.0f), trans_y_limit(0.0f), trans_z_limit(0.0f), +trans_x_limit(0.0f), trans_y_limit(0.0f), trans_z_limit(0.0f), throttle(0.0f), halt(0) { } @@ -240,8 +240,8 @@ FlightComp::ExecTrans() if (current_bank < 0 && desired_bank < 0 || current_bank > 0 && desired_bank > 0) { - double coord_pitch = compass_pitch - - ship->GetHelmPitch() + double coord_pitch = compass_pitch + - ship->GetHelmPitch() - fabs(helm) * fabs(current_bank); ship->ApplyPitch(coord_pitch); } diff --git a/Stars45/FlightDeck.cpp b/Stars45/FlightDeck.cpp index 36053a7..78800b8 100644 --- a/Stars45/FlightDeck.cpp +++ b/Stars45/FlightDeck.cpp @@ -91,7 +91,7 @@ public: // +======================================================================+ -InboundSlot::InboundSlot(Ship* s, FlightDeck* d, int squad, int index) +InboundSlot::InboundSlot(Ship* s, FlightDeck* d, int squad, int index) : ship(s), deck(d), squadron(squad), slot(index), cleared(0), final(0), approach(0) { if (ship) @@ -220,7 +220,7 @@ azimuth(0), light(0), num_catsounds(0), num_approach_pts(0) // +----------------------------------------------------------------------+ FlightDeck::FlightDeck(const FlightDeck& s) -: System(s), +: System(s), carrier(0), index(0), start_rel(s.start_rel), end_rel(s.end_rel), cam_rel(s.cam_rel), cycle_time(s.cycle_time), diff --git a/Stars45/FlightPlanner.cpp b/Stars45/FlightPlanner.cpp index eb43e9c..8b9208c 100644 --- a/Stars45/FlightPlanner.cpp +++ b/Stars45/FlightPlanner.cpp @@ -259,7 +259,7 @@ FlightPlanner::CreateStrikeRoute(Element* elem, Element* target) rloc.SetAzimuthVar(5*DEGREES); int action = Instruction::ASSAULT; - + if (tgt_ship->IsGroundUnit()) action = Instruction::STRIKE; diff --git a/Stars45/FltDlg.cpp b/Stars45/FltDlg.cpp index c432b82..5a2d1b2 100644 --- a/Stars45/FltDlg.cpp +++ b/Stars45/FltDlg.cpp @@ -267,7 +267,7 @@ FltDlg::UpdateSelection() switch (hangar->GetState(s)) { case Hangar::STORAGE: alert = true; break; - case Hangar::ALERT: launch = true; + case Hangar::ALERT: launch = true; stand = true; break; case Hangar::QUEUED: stand = true; break; case Hangar::ACTIVE: recall = true; break; @@ -328,7 +328,7 @@ FltDlg::UpdateSelection() if (!design) design = hangar->GetDesign(s); switch (hangar->GetState(s)) { - case Hangar::ALERT: launch = true; + case Hangar::ALERT: launch = true; stand = true; break; case Hangar::QUEUED: stand = true; break; } @@ -432,7 +432,7 @@ FltDlg::UpdateSelection() bool pkg_ok = alert && mission_type > -1; if (pkg_ok && mission_type > 0) { - pkg_ok = objective_list && + pkg_ok = objective_list && objective_list->GetSelCount() > 0; if (pkg_ok) { @@ -731,7 +731,7 @@ FltDlg::OnPackage(AWEvent* event) if (d && d->IsLaunchDeck()) { int dq = hangar->PreflightQueue(d); - + if (dq < queue) { queue = dq; deck = d; @@ -947,7 +947,7 @@ FltDlg::OnRecall(AWEvent* event) nsquad = hangar_list->GetItemData(i, 1); nslot = hangar_list->GetItemData(i, 2); } - + const HangarSlot* slot = hangar->GetSlot(nsquad, nslot); Ship* recall = hangar->GetShip(slot); @@ -957,7 +957,7 @@ FltDlg::OnRecall(AWEvent* event) } } } - } + } } // +--------------------------------------------------------------------+ diff --git a/Stars45/Font.cpp b/Stars45/Font.cpp index 83f0430..13380bd 100644 --- a/Stars45/Font.cpp +++ b/Stars45/Font.cpp @@ -166,7 +166,7 @@ Font::Load(const char* name) } } - return true; + return true; } void @@ -300,7 +300,7 @@ Font::LoadDef(char* defname, char* imgname) if (k < 100) kern_tweak[a[0]][b[0]] = k; } - + else { Print("WARNING: unknown object '%s' in '%s'\n", def->name()->value().data(), defname); @@ -334,7 +334,7 @@ Font::GlyphOffset(BYTE c) const if (islower(c)) c = toupper(c); - return (c/row_items * row_size * scale * scale + + return (c/row_items * row_size * scale * scale + c%row_items * char_width * scale); } @@ -728,7 +728,7 @@ Font::DrawTextSingle(const char* text, int count, const Rect& text_rect, Rect& c if (flags & DT_RIGHT) align = DT_RIGHT; else if (flags & DT_CENTER) - align = DT_CENTER; + align = DT_CENTER; int max_width = 0; @@ -800,7 +800,7 @@ Font::DrawTextWrap(const char* text, int count, const Rect& text_rect, Rect& cli if (flags & DT_RIGHT) align = DT_RIGHT; else if (flags & DT_CENTER) - align = DT_CENTER; + align = DT_CENTER; int nlines = 0; int max_width = 0; @@ -821,7 +821,7 @@ Font::DrawTextWrap(const char* text, int count, const Rect& text_rect, Rect& cli // repeat for each line of text: while (count_remaining > 0) { int length = 0; - + // find the end of the last whole word that fits on the line: for (;;) { next_word_end = find_next_word_end(text, curr_word_end+1); @@ -833,14 +833,14 @@ Font::DrawTextWrap(const char* text, int count, const Rect& text_rect, Rect& cli eol_index = curr_word_end = next_word_end; break; } - + int word_len = next_word_end - line_start + 1; length = StringWidth(text+line_start, word_len); - + if (length < text_rect.w) { curr_word_end = next_word_end; - + // check for a newline in the next block of white space: eol_index = 0; const char* eol = &text[curr_word_end+1]; @@ -878,7 +878,7 @@ Font::DrawTextWrap(const char* text, int count, const Rect& text_rect, Rect& cli case DT_CENTER: xoffset = (text_rect.w - length)/2; break; } } - + if (length > max_width) max_width = length; if (eol_index > 0) @@ -911,7 +911,7 @@ Font::DrawTextWrap(const char* text, int count, const Rect& text_rect, Rect& cli } } } - + nlines++; yoffset += Height(); if (eol_index > 0) @@ -939,7 +939,7 @@ Font::DrawTextMulti(const char* text, int count, const Rect& text_rect, Rect& cl if (flags & DT_RIGHT) align = DT_RIGHT; else if (flags & DT_CENTER) - align = DT_CENTER; + align = DT_CENTER; int max_width = 0; int line_start = 0; @@ -953,7 +953,7 @@ Font::DrawTextMulti(const char* text, int count, const Rect& text_rect, Rect& cl while (count_remaining > 0) { int length = 0; int line_count = 0; - + // find the end of line: while (line_count < count_remaining) { char c = text[line_start+line_count]; @@ -976,7 +976,7 @@ Font::DrawTextMulti(const char* text, int count, const Rect& text_rect, Rect& cl case DT_CENTER: xoffset = (text_rect.w - length)/2; break; } } - + if (length > max_width) max_width = length; if (length && !nodraw) { @@ -985,7 +985,7 @@ Font::DrawTextMulti(const char* text, int count, const Rect& text_rect, Rect& cl DrawString(text+line_start, line_count, x1, y1, text_rect); } - + nlines++; yoffset += Height(); @@ -1033,14 +1033,14 @@ Font::DrawString(const char* str, int len, int x1, int y1, const Rect& clip, Bit if ((flags & FONT_ALL_CAPS) && islower(c)) c = toupper(c); - + int cw = glyph[c].width + interspace; int ch = height; int k = 0; if (i < len-1) k = kern[c][str[i+1]]; - + // horizontal clip: if (x1 < clip.x) { if (isspace(c) && (c < PIPE_NBSP || c > ARROW_RIGHT)) { @@ -1098,7 +1098,7 @@ Font::DrawString(const char* str, int len, int x1, int y1, const Rect& clip, Bit x1 += cw + k; maxw -= cw + k; } - + count++; } } @@ -1144,13 +1144,13 @@ Font::DrawString(const char* str, int len, int x1, int y1, const Rect& clip, Bit if ((flags & FONT_ALL_CAPS) && islower(c)) c = toupper(c); - + int cw = glyph[c].width + interspace; int k = 0; if (i < len-1) k = kern[c][str[i+1]]; - + // horizontal clip: if (x1 < clip.x) { if (isspace(c) && (c < PIPE_NBSP || c > ARROW_RIGHT)) { @@ -1215,7 +1215,7 @@ Font::DrawString(const char* str, int len, int x1, int y1, const Rect& clip, Bit } if (count) { - // this small hack is an optimization to reduce the + // this small hack is an optimization to reduce the // size of vertex buffer needed for font rendering: int old_nverts = vset->nverts; diff --git a/Stars45/Font.h b/Stars45/Font.h index e8005a6..551a432 100644 --- a/Stars45/Font.h +++ b/Stars45/Font.h @@ -72,7 +72,7 @@ public: }; enum CHARS { PIPE_NBSP = 16, - PIPE_VERT = 17, + PIPE_VERT = 17, PIPE_LT = 18, PIPE_TEE = 19, PIPE_UL = 20, diff --git a/Stars45/FormDef.cpp b/Stars45/FormDef.cpp index ec1bc92..636b21a 100644 --- a/Stars45/FormDef.cpp +++ b/Stars45/FormDef.cpp @@ -57,7 +57,7 @@ color(Color::White), use_color(false) // +----------------------------------------------------------------------+ WinDef::WinDef(DWORD a_id, DWORD a_type, const char* a_text, DWORD a_style) -: id(a_id), pid(0), type(a_type), text(a_text), style(a_style) +: id(a_id), pid(0), type(a_type), text(a_text), style(a_style) { rect = Rect(0,0,0,0); text_align = 0; @@ -624,7 +624,7 @@ FormDef::Load(const char* fname) delete term; term = parser.ParseTerm(); - + if (term) { TermDef* def = term->isDef(); if (def) { @@ -727,7 +727,7 @@ FormDef::Load(const char* fname) form->SetStyle(s); } - else if (pdef->name()->value() == "align" || + else if (pdef->name()->value() == "align" || pdef->name()->value() == "text_align") { DWORD a = DT_LEFT; @@ -739,7 +739,7 @@ FormDef::Load(const char* fname) else if (!_stricmp(buf, "center")) a = DT_CENTER; } - + else { GetDefNumber(a, pdef, filename); } @@ -794,7 +794,7 @@ FormDef::Load(const char* fname) } // end form params } // end form struct } // end form - + else Print("WARNING: unknown object '%s' in '%s'\n", def->name()->value().data(), filename); @@ -1071,7 +1071,7 @@ void FormDef::ParseCtrlDef(CtrlDef* ctrl, TermStruct* val) ctrl->SetStyle(s); } - else if (pdef->name()->value() == "align" || + else if (pdef->name()->value() == "align" || pdef->name()->value() == "text_align") { DWORD a = DT_LEFT; @@ -1083,7 +1083,7 @@ void FormDef::ParseCtrlDef(CtrlDef* ctrl, TermStruct* val) else if (!_stricmp(buf, "center")) a = DT_CENTER; } - + else { GetDefNumber(a, pdef, filename); } @@ -1225,7 +1225,7 @@ void FormDef::ParseColumnDef(CtrlDef* ctrl, TermStruct* val) else if (!_stricmp(buf, "center")) align = DT_CENTER; } - + else { GetDefNumber(align, pdef, filename); } @@ -1274,7 +1274,7 @@ void FormDef::ParseLayoutDef(LayoutDef* def, TermStruct* val) GetDefArray(def->y_mins, pdef, filename); } - else + else if (pdef->name()->value() == "x_weights" || pdef->name()->value() == "col_wts") { GetDefArray(def->x_weights, pdef, filename); diff --git a/Stars45/FormWindow.cpp b/Stars45/FormWindow.cpp index 83595b9..dc9d1d6 100644 --- a/Stars45/FormWindow.cpp +++ b/Stars45/FormWindow.cpp @@ -94,7 +94,7 @@ FormWindow::AddControl(ActiveWindow* ctrl) children.append(ctrl); ctrl->SetForm(this); - + if (!shown) ctrl->Hide(); } @@ -296,7 +296,7 @@ void FormWindow::Init(const FormDef& def) { if (def.GetRect().w > 0 && def.GetRect().h > 0) { - // if form size is specified in def, and it is + // if form size is specified in def, and it is // smaller than the current screen size, // center the form on the display: diff --git a/Stars45/FormatUtil.cpp b/Stars45/FormatUtil.cpp index 43a5c58..205b9bb 100644 --- a/Stars45/FormatUtil.cpp +++ b/Stars45/FormatUtil.cpp @@ -59,7 +59,7 @@ void FormatNumber(char* txt, double n) else if (a < 1e15) sprintf(txt, "%.1f T", (n/1e12)); - else + else sprintf(txt, "%.1e", n); } diff --git a/Stars45/Galaxy.cpp b/Stars45/Galaxy.cpp index 543693c..f59b2af 100644 --- a/Stars45/Galaxy.cpp +++ b/Stars45/Galaxy.cpp @@ -144,7 +144,7 @@ Galaxy::Load(const char* filename) do { delete term; term = parser.ParseTerm(); - + if (term) { TermDef* def = term->isDef(); if (def) { @@ -166,7 +166,7 @@ Galaxy::Load(const char* filename) int star_class = Star::G; sys_name[0] = 0; - + for (int i = 0; i < val->elements()->size(); i++) { TermDef* pdef = val->elements()->at(i)->isDef(); if (pdef) { @@ -222,7 +222,7 @@ Galaxy::Load(const char* filename) int star_class = Star::G; star_name[0] = 0; - + for (int i = 0; i < val->elements()->size(); i++) { TermDef* pdef = val->elements()->at(i)->isDef(); if (pdef) { diff --git a/Stars45/Game.cpp b/Stars45/Game.cpp index 04c84d0..93fd3dd 100644 --- a/Stars45/Game.cpp +++ b/Stars45/Game.cpp @@ -88,7 +88,7 @@ static LARGE_INTEGER perf_cnt2; Game::Game() : world(0), video_factory(0), video(0), video_settings(0), soundcard(0), - gamma(128), max_tex_size(2048), screen(0), totaltime(0), + gamma(128), max_tex_size(2048), screen(0), totaltime(0), hInst(0), hwnd(0), frame_rate(0), frame_count(0), frame_count0(0), frame_time(0), frame_time0(0), gui_seconds(0), content(0), status(Game::OK), exit_code(0), window_style(0), avi_file(0) @@ -195,7 +195,7 @@ Game::MaxTexSize() { if (game && game->video) { int max_vid_size = game->video->MaxTexSize(); - return max_vid_size < game->max_tex_size ? + return max_vid_size < game->max_tex_size ? max_vid_size : game->max_tex_size; } else if (Video::GetInstance()) { @@ -403,7 +403,7 @@ Game::InitInstance(HINSTANCE hInstance, int nCmdShow) rctmp.right = x_offset + s_width; rctmp.bottom = y_offset + s_height; - window_style = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | + window_style = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_VISIBLE; AdjustWindowRect(&rctmp, window_style, 1); @@ -622,7 +622,7 @@ Game::ToggleFullscreen() SetWindowPos(hwnd, HWND_NOTOPMOST, - bounds_rect.left, + bounds_rect.left, bounds_rect.top, bounds_rect.right - bounds_rect.left, bounds_rect.bottom - bounds_rect.top, @@ -647,7 +647,7 @@ Game::ToggleFullscreen() if (is_windowed) { SetWindowPos(hwnd, HWND_NOTOPMOST, - bounds_rect.left, + bounds_rect.left, bounds_rect.top, bounds_rect.right - bounds_rect.left, bounds_rect.bottom - bounds_rect.top, @@ -799,7 +799,7 @@ Game::SetupPalette() } return false; -} +} // +--------------------------------------------------------------------+ @@ -848,7 +848,7 @@ Game::LoadPalette(PALETTEENTRY* pal, BYTE* inv) // +--------------------------------------------------------------------+ -int +int Game::Run() { MSG msg; @@ -1366,9 +1366,9 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM uParam, LPARAM lParam) game->ResizeVideo(); } else { - // If we're neither maximized nor minimized, the window size - // is changing by the user dragging the window edges. In this - // case, we don't reset the device yet -- we wait until the + // If we're neither maximized nor minimized, the window size + // is changing by the user dragging the window edges. In this + // case, we don't reset the device yet -- we wait until the // user stops dragging, and a WM_EXITSIZEMOVE message comes. } } @@ -1510,7 +1510,7 @@ BufferKey(int vkey) vkext++; if (vkext >= MAX_KEY_BUF) vkext = 0; - } + } } int diff --git a/Stars45/Game.h b/Stars45/Game.h index 378fdc6..cce3c35 100644 --- a/Stars45/Game.h +++ b/Stars45/Game.h @@ -84,7 +84,7 @@ public: virtual bool Init(HINSTANCE hi, HINSTANCE hpi, LPSTR cmdline, int nCmdShow); virtual int Run(); virtual void Exit(); - virtual bool OnPaint() { return false; } + virtual bool OnPaint() { return false; } virtual bool OnHelp() { return false; } virtual void Activate(bool f); diff --git a/Stars45/GameScreen.cpp b/Stars45/GameScreen.cpp index a0f4238..5b89941 100644 --- a/Stars45/GameScreen.cpp +++ b/Stars45/GameScreen.cpp @@ -88,12 +88,12 @@ static bool mouse_active = false; // +--------------------------------------------------------------------+ GameScreen::GameScreen() -: screen(0), gamewin(0), +: screen(0), gamewin(0), navdlg(0), wep_view(0), engdlg(0), fltdlg(0), HUDfont(0), GUIfont(0), GUI_small_font(0), title_font(0), cam_view(0), isShown(false), disp_view(0), hud_view(0), tac_view(0), radio_view(0), quantum_view(0), quit_view(0), ctldlg(0), joydlg(0), keydlg(0), auddlg(0), -viddlg(0), moddlg(0), modInfoDlg(0), +viddlg(0), moddlg(0), modInfoDlg(0), flare1(0), flare2(0), flare3(0), flare4(0), optdlg(0), cam_dir(0), sim(0) { @@ -166,7 +166,7 @@ GameScreen::Setup(Screen* s) disp_view = DisplayView::GetInstance(); - // note: quit view must be last in chain + // note: quit view must be last in chain // so it can release window surface quit_view = new(__FILE__,__LINE__) QuitView(gamewin); gamewin->AddView(quit_view); @@ -665,8 +665,8 @@ GameScreen::ShowExternal() { if (!gamewin) return; - if ((navdlg && navdlg->IsShown()) || - (engdlg && engdlg->IsShown()) || + if ((navdlg && navdlg->IsShown()) || + (engdlg && engdlg->IsShown()) || (fltdlg && fltdlg->IsShown()) || (auddlg && auddlg->IsShown()) || (viddlg && viddlg->IsShown()) || diff --git a/Stars45/Geometry.cpp b/Stars45/Geometry.cpp index 74d6f53..3293ad2 100644 --- a/Stars45/Geometry.cpp +++ b/Stars45/Geometry.cpp @@ -427,7 +427,7 @@ Matrix::ComputeEulerAngles(double& roll, double& pitch, double& yaw) const roll = PI - roll; if (sign(cos(pitch)*cy) != sign(elem[2][2])) - pitch = PI - pitch; + pitch = PI - pitch; } // +--------------------------------------------------------------------+ @@ -482,7 +482,7 @@ Matrix::operator*(const Vec3& v) const // +--------------------------------------------------------------------+ -double +double Matrix::Cofactor(int i, int j) const { int i1=0; @@ -498,12 +498,12 @@ Matrix::Cofactor(int i, int j) const if ((i+j) & 1) factor *= -1; - return factor; + return factor; } // +--------------------------------------------------------------------+ -void +void Matrix::Invert() { double f[3][3]; diff --git a/Stars45/Geometry.h b/Stars45/Geometry.h index f8ddcdf..68df836 100644 --- a/Stars45/Geometry.h +++ b/Stars45/Geometry.h @@ -265,8 +265,8 @@ struct Quaternion static const char* TYPENAME() { return "Quaternion"; } Quaternion() : x(0), y(0), z(0), w(0) { } - Quaternion(double ix, - double iy, + Quaternion(double ix, + double iy, double iz, double iw) : x(ix), y(iy), z(iz), w(iw) { } Quaternion(const Quaternion& q) : x(q.x), y(q.y), z(q.z), w(q.w) { } diff --git a/Stars45/Graphic.cpp b/Stars45/Graphic.cpp index 551da18..f4e8bc9 100644 --- a/Stars45/Graphic.cpp +++ b/Stars45/Graphic.cpp @@ -189,6 +189,6 @@ Graphic::CheckVisibility(Projector& projector) screen_rect.w = 0; screen_rect.h = 0; } - + return visible; } diff --git a/Stars45/Grid.cpp b/Stars45/Grid.cpp index 584f01a..1f1fbbc 100644 --- a/Stars45/Grid.cpp +++ b/Stars45/Grid.cpp @@ -75,7 +75,7 @@ void Grid::Render(Video* video, DWORD flags) Point p2( i, 0, size); p2 += Location(); Point p3(-i, 0, -size); p3 += Location(); Point p4(-i, 0, size); p4 += Location(); - + if (c) line = DARK_LINE; else line = LITE_LINE; @@ -93,7 +93,7 @@ void Grid::Render(Video* video, DWORD flags) Point p2( size, 0, i); p2 += Location(); Point p3(-size, 0, -i); p3 += Location(); Point p4( size, 0, -i); p4 += Location(); - + if (c) line = DARK_LINE; else line = LITE_LINE; diff --git a/Stars45/GroundAI.cpp b/Stars45/GroundAI.cpp index d60731c..add0ab7 100644 --- a/Stars45/GroundAI.cpp +++ b/Stars45/GroundAI.cpp @@ -100,7 +100,7 @@ GroundAI::SetTarget(SimObject* targ, System* sub) { if (target != targ) { target = targ; - + if (target) Observe(target); } diff --git a/Stars45/GroundAI.h b/Stars45/GroundAI.h index bad2143..850bc41 100644 --- a/Stars45/GroundAI.h +++ b/Stars45/GroundAI.h @@ -52,7 +52,7 @@ class CarrierAI; // +--------------------------------------------------------------------+ -class GroundAI : public Director, +class GroundAI : public Director, public SimObserver { public: diff --git a/Stars45/HUDSounds.cpp b/Stars45/HUDSounds.cpp index ccbfeff..3be8417 100644 --- a/Stars45/HUDSounds.cpp +++ b/Stars45/HUDSounds.cpp @@ -120,7 +120,7 @@ void HUDSounds::PlaySound(int n) case SND_TAC_REJECT: if (tac_reject) sound = tac_reject->Duplicate(); break; // RED ALERT IS A SPECIAL CASE! - case SND_RED_ALERT: + case SND_RED_ALERT: if (red_alert) { sound = red_alert; } diff --git a/Stars45/HUDView.cpp b/Stars45/HUDView.cpp index 9f1888d..3e87e01 100644 --- a/Stars45/HUDView.cpp +++ b/Stars45/HUDView.cpp @@ -265,7 +265,7 @@ enum TXT { static HUDText hud_text[TXT_LAST]; -void +void HUDView::DrawHUDText(int index, const char* txt, Rect& rect, int align, int upcase, bool box) { if (index < 0 || index >= TXT_LAST) @@ -303,15 +303,15 @@ HUDView::DrawHUDText(int index, const char* txt, Rect& rect, int align, int upca if (index <= TXT_LAST_ACTIVE) hc = Color::White; - + if (Mouse::LButton() && !mouse_latch) { mouse_latch = 2; mouse_index = index; } } - if (cockpit_hud_texture && - index >= TXT_HUD_MODE && + if (cockpit_hud_texture && + index >= TXT_HUD_MODE && index <= TXT_TARGET_ETA && ht.font != big_font) { @@ -893,8 +893,8 @@ HUDView::MarkerColor(Contact* contact) c = c * 0.5; } } - - return c; + + return c; } // +--------------------------------------------------------------------+ @@ -928,7 +928,7 @@ HUDView::DrawContactMarkers() DrawContact(c, index++); } - Color c = ship->MarkerColor(); + Color c = ship->MarkerColor(); // draw own ship track ladder: if (CameraDirector::GetCameraMode() == CameraDirector::MODE_ORBIT && ship->TrackLength() > 0) { @@ -956,7 +956,7 @@ HUDView::DrawContactMarkers() // clip: if (CameraDirector::GetCameraMode() == CameraDirector::MODE_ORBIT && mark_pt.z > 1.0) { projector->Project(mark_pt); - + int x = (int) mark_pt.x; int y = (int) mark_pt.y; @@ -1253,7 +1253,7 @@ HUDView::DrawTrack(Contact* contact) return; int ctl = contact->TrackLength(); - Color c = MarkerColor(contact); + Color c = MarkerColor(contact); Point t1 = contact->Location(); Point t2 = contact->TrackPoint(0); @@ -1283,13 +1283,13 @@ HUDView::DrawRect(SimObject* targ) c = ((Ship*) targ)->MarkerColor(); else c = ((Shot*) targ)->MarkerColor(); - + if (r.w > 0 && r.h > 0) { if (r.w < 8) { r.x -= (8-r.w)/2; r.w = 8; } - + if (r.h < 8) { r.y -= (8-r.h)/2; r.h = 8; @@ -1303,19 +1303,19 @@ HUDView::DrawRect(SimObject* targ) // clip: if (mark_pt.z < 1.0) return; - + projector->Project(mark_pt); - + int x = (int) mark_pt.x; int y = (int) mark_pt.y; - + if (x < 4 || x > width-4 || y < 4 || y > height-4) return; - + r.x = x-4; r.y = y-4; r.w = 8; - r.h = 8; + r.h = 8; } // horizontal @@ -1374,7 +1374,7 @@ HUDView::DrawBars() if (ship->Velocity() * ship->Heading() < 0) speed = -speed; - + FormatNumber(txt, speed); if (tactical) { @@ -1503,7 +1503,7 @@ HUDView::DrawBars() if (mode == HUD_MODE_NAV) { Instruction* next = ship->GetNextNavPoint(); - + if (next) { double distance = ship->RangeToNavPoint(next); FormatNumber(txt, distance); @@ -1916,8 +1916,8 @@ HUDView::DrawLCOS(SimObject* targ, double dist) projector->Project(tloc); // DRAW THE OFFSCREEN CHASE INDICATOR: - if (behind || - tloc.x <= 0 || tloc.x >= width-1 || + if (behind || + tloc.x <= 0 || tloc.x >= width-1 || tloc.y <= 0 || tloc.y >= height-1) { // Left side: @@ -1929,7 +1929,7 @@ HUDView::DrawLCOS(SimObject* targ, double dist) chase_sprite->SetAnimation(&chase_left); chase_sprite->MoveTo(Point(aw, tloc.y, 1)); } - + // Right side: else if (tloc.x >= width-1 || behind) { if (tloc.y < ah) tloc.y = ah; @@ -1949,7 +1949,7 @@ HUDView::DrawLCOS(SimObject* targ, double dist) chase_sprite->SetAnimation(&chase_top); chase_sprite->MoveTo(Point(tloc.x, ah, 1)); } - + // Bottom edge: else if (tloc.y >= height-1) { chase_sprite->Show(); @@ -2146,7 +2146,7 @@ HUDView::DrawTarget() switch (sys->Status()) { case System::DEGRADED: stat = Color(255,255, 0); break; - case System::CRITICAL: + case System::CRITICAL: case System::DESTROYED: stat = Color(255, 0, 0); break; case System::MAINT: if (blink_delta < 250) @@ -2198,8 +2198,8 @@ HUDView::DrawNavInfo() if (arcade) { if (ship->IsAutoNavEngaged()) { Rect info_rect(width/2-box_width, height/2+bar_height, box_width*2, 12); - - if (big_font) + + if (big_font) hud_text[TXT_NAV_INDEX].font = big_font; DrawHUDText(TXT_NAV_INDEX, Game::GetText("HUDView.Auto-Nav"), info_rect, DT_CENTER); @@ -2225,7 +2225,7 @@ HUDView::DrawNavInfo() double speed = ship->Velocity().length(); int etr = 0; char txt[256]; - + if (speed > 10) etr = (int) (distance/speed); @@ -2680,13 +2680,13 @@ HUDView::DrawWarningPanel() int x = box_left; int y = cockpit_hud_texture ? 410 : height-97; int c = cockpit_hud_texture ? 3 : 4; - + static DWORD blink = Game::RealTime(); for (int index = 0; index < 12; index++) { int stat = -1; Text abrv = Game::GetText("HUDView.UNKNOWN"); - + switch (index) { case 0: stat = GetReactorStatus(ship); abrv = Game::GetText("HUDView.REACTOR"); break; case 1: stat = GetDriveStatus(ship); abrv = Game::GetText("HUDView.DRIVE"); break; @@ -2736,18 +2736,18 @@ HUDView::DrawWarningPanel() } warn_rect.y += 4; - + hud_font->SetColor(tc); - hud_font->DrawText(abrv, -1, - warn_rect, - DT_CENTER | DT_SINGLELINE, + hud_font->DrawText(abrv, -1, + warn_rect, + DT_CENTER | DT_SINGLELINE, cockpit_hud_texture); - + warn_rect.y -= 4; } else { DrawHUDText(TXT_CAUTION_TXT + index, - abrv, + abrv, warn_rect, DT_CENTER); @@ -2768,7 +2768,7 @@ HUDView::DrawWarningPanel() blink = Game::RealTime(); // reset for next time - SetStatusColor(System::NOMINAL); + SetStatusColor(System::NOMINAL); } } @@ -3200,8 +3200,8 @@ HUDView::DrawNavPoint(Instruction& navpt, int index, int next) projector->Project(tloc); // DRAW THE OFFSCREEN CHASE INDICATOR: - if (behind || - tloc.x <= 0 || tloc.x >= width-1 || + if (behind || + tloc.x <= 0 || tloc.x >= width-1 || tloc.y <= 0 || tloc.y >= height-1) { // Left side: @@ -3233,7 +3233,7 @@ HUDView::DrawNavPoint(Instruction& navpt, int index, int next) chase_sprite->SetAnimation(&chase_top); chase_sprite->MoveTo(Point(tloc.x, ah, 1)); } - + // Bottom edge: else if (tloc.y >= height-1) { chase_sprite->Show(); @@ -3566,7 +3566,7 @@ HUDView::Refresh() else SetTacticalMode(!cockpit_hud_texture); - sim->ShowGrid(tactical && + sim->ShowGrid(tactical && !ship->IsAirborne() && CameraDirector::GetCameraMode() != CameraDirector::MODE_VIRTUAL); @@ -3591,7 +3591,7 @@ HUDView::Refresh() DrawNav(); DrawILS(); - + // FOR DEBUG PURPOSES ONLY: // DrawObjective(); @@ -3696,8 +3696,8 @@ HUDView::DrawOrbitalBody(OrbitalBody* body) r = projector->ProjectRadius(p, r); projector->Project(p, false); - window->DrawEllipse((int) (p.x-r), - (int) (p.y-r), + window->DrawEllipse((int) (p.x-r), + (int) (p.y-r), (int) (p.x+r), (int) (p.y+r), Color::Cyan); @@ -4146,7 +4146,7 @@ HUDView::Message(const char* fmt, ...) // +--------------------------------------------------------------------+ -void +void HUDView::ClearMessages() { if (hud_view) { @@ -4159,7 +4159,7 @@ HUDView::ClearMessages() // +--------------------------------------------------------------------+ -void +void HUDView::PrepareBitmap(const char* name, Bitmap& img, BYTE*& shades) { delete [] shades; @@ -4184,7 +4184,7 @@ HUDView::PrepareBitmap(const char* name, Bitmap& img, BYTE*& shades) shades[y*w+x] = (BYTE) (img.GetColor(x,y).Red() * 0.66); } -void +void HUDView::TransferBitmap(const Bitmap& src, Bitmap& img, BYTE*& shades) { delete [] shades; @@ -4206,7 +4206,7 @@ HUDView::TransferBitmap(const Bitmap& src, Bitmap& img, BYTE*& shades) shades[y*w+x] = (BYTE) (img.GetColor(x,y).Red() * 0.5); } -void +void HUDView::ColorizeBitmap(Bitmap& img, BYTE* shades, Color color, bool force_alpha) { if (!shades) return; diff --git a/Stars45/Hangar.cpp b/Stars45/Hangar.cpp index 9eb3998..32b2add 100644 --- a/Stars45/Hangar.cpp +++ b/Stars45/Hangar.cpp @@ -88,13 +88,13 @@ private: HangarSlot::HangarSlot() : ship(0), group(0), design(0), deck(0), slot(0), state(0), time(0), package(0), alert_hold(false) -{ +{ for (int i = 0; i < 16; i++) loadout[i] = -1; } HangarSlot::~HangarSlot() -{ +{ } // +======================================================================+ @@ -250,8 +250,8 @@ Hangar::FinishPrep(HangarSlot* slot) } char name[64]; - sprintf_s(name, "%s %d", - (const char*) slot->package->Name(), + sprintf_s(name, "%s %d", + (const char*) slot->package->Name(), slot->ship->GetElementIndex()); slot->ship->SetName(name); } @@ -392,8 +392,8 @@ Hangar::GotoActiveFlight(int squadron, int slot_index, Element* elem, int* loado } char name[64]; - sprintf_s(name, "%s %d", - (const char*) elem->Name(), + sprintf_s(name, "%s %d", + (const char*) elem->Name(), slot->ship->GetElementIndex()); slot->ship->SetName(name); diff --git a/Stars45/Hangar.h b/Stars45/Hangar.h index 511cef6..49820c2 100644 --- a/Stars45/Hangar.h +++ b/Stars45/Hangar.h @@ -66,13 +66,13 @@ public: Hangar(const Hangar& rhs); virtual ~Hangar(); - enum HANGAR_STATE { UNAVAIL = -2, - MAINT = -1, - STORAGE = 0, + enum HANGAR_STATE { UNAVAIL = -2, + MAINT = -1, + STORAGE = 0, PREP, ALERT, - QUEUED, - LOCKED, + QUEUED, + LOCKED, LAUNCH, ACTIVE, APPROACH, diff --git a/Stars45/HardPoint.cpp b/Stars45/HardPoint.cpp index b273911..6ef4da5 100644 --- a/Stars45/HardPoint.cpp +++ b/Stars45/HardPoint.cpp @@ -98,11 +98,11 @@ HardPoint::CreateWeapon(int type_index) if (type_index >= 0 && type_index < MAX_DESIGNS && designs[type_index]) { Vec3 zero_pt = Vec3(0.0f, 0.0f, 0.0f); Vec3* muzzle_pt = &zero_pt; - + if (designs[type_index]->turret.length() == 0) muzzle_pt = &muzzle; - Weapon* missile = new(__FILE__,__LINE__) Weapon(designs[type_index], + Weapon* missile = new(__FILE__,__LINE__) Weapon(designs[type_index], 1, muzzle_pt, aim_azimuth, diff --git a/Stars45/Hoop.cpp b/Stars45/Hoop.cpp index 101c7d9..8da076a 100644 --- a/Stars45/Hoop.cpp +++ b/Stars45/Hoop.cpp @@ -69,8 +69,8 @@ Hoop::~Hoop() // +--------------------------------------------------------------------+ void Hoop::SetColor(Color c) -{ - ils_color = c; +{ + ils_color = c; } // +--------------------------------------------------------------------+ diff --git a/Stars45/ImageBox.cpp b/Stars45/ImageBox.cpp index bdec199..242ad74 100644 --- a/Stars45/ImageBox.cpp +++ b/Stars45/ImageBox.cpp @@ -116,7 +116,7 @@ ImageBox::Draw() DrawText(text.data(), 0, label_rect, DT_CALCRECT | DT_WORDBREAK | DT_CENTER); vert_space = (vert_space - label_rect.h)/2; - + label_rect.w = horz_space; if (vert_space > 0) @@ -214,13 +214,13 @@ ImageBox::CalcPictureRect() int h = rect.h; int img_w = picture.Width(); int img_h = picture.Height(); - + if (img_h > h) img_h = h-2; if (img_w > w) img_w = w-2; - + int img_x_offset = 0; int img_y_offset = 0; - + switch (picture_loc) { default: // TOP ROW: @@ -253,7 +253,7 @@ ImageBox::CalcPictureRect() img_y_offset = h - img_h; break; } - + Rect img_rect; img_rect.x = img_x_offset; img_rect.y = img_y_offset; @@ -286,12 +286,12 @@ int ImageBox::OnClick() } int ImageBox::OnMouseEnter(int mx, int my) -{ +{ return ActiveWindow::OnMouseEnter(mx, my); } int ImageBox::OnMouseExit(int mx, int my) -{ +{ return ActiveWindow::OnMouseExit(mx, my); } diff --git a/Stars45/ImageBox.h b/Stars45/ImageBox.h index 8f00bb1..7f0ac4b 100644 --- a/Stars45/ImageBox.h +++ b/Stars45/ImageBox.h @@ -75,7 +75,7 @@ public: int GetPictureLocation() const; void SetPictureLocation(int nNewValue); Rect GetTargetRect() const { return target_rect; } - void SetTargetRect(const Rect& r) { target_rect = r; } + void SetTargetRect(const Rect& r) { target_rect = r; } protected: virtual void DrawTabbedText(); diff --git a/Stars45/Instruction.cpp b/Stars45/Instruction.cpp index a14b950..4ee3a9c 100644 --- a/Stars45/Instruction.cpp +++ b/Stars45/Instruction.cpp @@ -58,7 +58,7 @@ Instruction::Instruction(const char* rgn, Point loc, int act) : region(0), action(act), formation(0), status(PENDING), speed(0), target(0), emcon(0), wep_free(0), priority(PRIMARY), farcast(0), hold_time(0) -{ +{ rgn_name = rgn; rloc.SetBaseLocation(loc); rloc.SetDistance(0); @@ -68,7 +68,7 @@ Instruction::Instruction(SimRegion* rgn, Point loc, int act) : region(rgn), action(act), formation(0), status(PENDING), speed(0), target(0), emcon(0), wep_free(0), priority(PRIMARY), farcast(0), hold_time(0) -{ +{ rgn_name = region->Name(); rloc.SetBaseLocation(loc); rloc.SetDistance(0); @@ -248,7 +248,7 @@ Instruction::Evaluate(Ship* ship) if (e->IsFinished() || e->IsSquadron()) continue; - if (e->Name() == tgt_name || + if (e->Name() == tgt_name || (e->GetCommander() && e->GetCommander()->Name() == tgt_name)) { found = true; diff --git a/Stars45/Instruction.h b/Stars45/Instruction.h index 9f3e1dc..6827bf7 100644 --- a/Stars45/Instruction.h +++ b/Stars45/Instruction.h @@ -56,7 +56,7 @@ class Instruction : public SimObserver public: static const char* TYPENAME() { return "Instruction"; } - enum ACTION + enum ACTION { VECTOR, LAUNCH, @@ -78,8 +78,8 @@ public: NUM_ACTIONS }; - enum STATUS - { + enum STATUS + { PENDING, ACTIVE, SKIPPED, @@ -90,7 +90,7 @@ public: NUM_STATUS }; - enum FORMATION + enum FORMATION { DIAMOND, SPREAD, diff --git a/Stars45/Joystick.cpp b/Stars45/Joystick.cpp index 5a30f8d..9693c9d 100644 --- a/Stars45/Joystick.cpp +++ b/Stars45/Joystick.cpp @@ -112,11 +112,11 @@ Joystick::Joystick() else if (!pdi) { HRESULT hr = DirectInput8Create(Game::GetHINST(), - DIRECTINPUT_VERSION, - IID_IDirectInput7, + DIRECTINPUT_VERSION, + IID_IDirectInput7, (void**)&pdi, - NULL); - if FAILED(hr) { + NULL); + if FAILED(hr) { DirectInputError("Failed to initialize DI7", hr); pdi = 0; pdev = 0; @@ -232,7 +232,7 @@ Joystick::MapKeys(KeyMapEntry* mapping, int nkeys) static inline double sqr(double a) { return a*a; } -BOOL FAR PASCAL EnumJoystick(LPCDIDEVICEINSTANCE pdinst, LPVOID pvSelect) +BOOL FAR PASCAL EnumJoystick(LPCDIDEVICEINSTANCE pdinst, LPVOID pvSelect) { CopyMemory(&devices[ndev++], pdinst, pdinst->dwSize); @@ -273,14 +273,14 @@ bool CreateDevice(int select) HRESULT hr = DI_OK; // Create the DirectInput joystick device: - hr = pdi->CreateDeviceEx(pdinst->guidInstance, - IID_IDirectInputDevice7, - (void**)&pdev, + hr = pdi->CreateDeviceEx(pdinst->guidInstance, + IID_IDirectInputDevice7, + (void**)&pdev, NULL); - if (hr != DI_OK || pdev == 0) { + if (hr != DI_OK || pdev == 0) { DirectInputError("Create Device Ex failed", hr); - return false; + return false; } // Set the data format: @@ -296,14 +296,14 @@ bool CreateDevice(int select) // Set the coop level: hr = pdev->SetCooperativeLevel(Game::GetHWND(), DISCL_NONEXCLUSIVE | DISCL_FOREGROUND); - if (hr != DI_OK) { - DirectInputError("Set Cooperative Level failed", hr); - pdev->Release(); - return false; + if (hr != DI_OK) { + DirectInputError("Set Cooperative Level failed", hr); + pdev->Release(); + return false; } // Set data ranges - DIPROPRANGE diprg; + DIPROPRANGE diprg; diprg.lMin = -32768; diprg.lMax = +32768; @@ -351,10 +351,10 @@ Joystick::EnumerateDevices() Print("Joystick: preparing to enumerate devices\n"); ndev = 0; - HRESULT hr = + HRESULT hr = pdi->EnumDevices(DI8DEVTYPE_JOYSTICK, EnumJoystick, - (LPVOID) 0, + (LPVOID) 0, DIEDFL_ATTACHEDONLY); if (FAILED(hr)) { @@ -556,7 +556,7 @@ Joystick::Acquire() return; //============================================================ - // + // // FIRST TRY DIRECT INPUT bool acquired = false; @@ -617,7 +617,7 @@ Joystick::Acquire() } //============================================================ - // + // // THEN TRY WINDOWS MULTIMEDIA LIBRARY if (!acquired) { @@ -791,7 +791,7 @@ bool Joystick::KeyDown(int key) { if (!joystick) return false; - + if (key >= KEY_JOY_1 && key <= KEY_JOY_32) return joystick->action[key - KEY_JOY_1]; @@ -872,7 +872,7 @@ const char* DIErrStr(HRESULT hr) return "The device buffer overflowed and some input was lost. This value is equal to the S_FALSE standard COM return value."; case DI_DOWNLOADSKIPPED: return "The parameters of the effect were successfully updated, but the effect could not be downloaded because the associated device was not acquired in exclusive mode."; - case DI_EFFECTRESTARTED: + case DI_EFFECTRESTARTED: return "The effect was stopped, the parameters were updated, and the effect was restarted."; case DI_POLLEDDEVICE: return "The device is a polled device. As a result, device buffering does not collect any data and event notifications is not signaled until the IDirectInputDevice7::Poll method is called."; diff --git a/Stars45/KeyMap.cpp b/Stars45/KeyMap.cpp index 3eea238..c2e7cc1 100644 --- a/Stars45/KeyMap.cpp +++ b/Stars45/KeyMap.cpp @@ -67,8 +67,8 @@ static KeyName key_action_table[] = { { KeyMap::KEY_FLIGHT, KEY_ROLL_LEFT, "KEY_ROLL_LEFT", "Roll Left" }, { KeyMap::KEY_FLIGHT, KEY_ROLL_RIGHT, "KEY_ROLL_RIGHT", "Roll Right" }, { KeyMap::KEY_FLIGHT, KEY_CENTER, "KEY_CENTER", "Center" }, - { KeyMap::KEY_FLIGHT, KEY_ROLL_ENABLE, "KEY_ROLL_ENABLE", "Roll Enable" }, - { KeyMap::KEY_FLIGHT, KEY_SWAP_ROLL_YAW, "KEY_SWAP_ROLL_YAW", "Swap Ctrl Axes" }, + { KeyMap::KEY_FLIGHT, KEY_ROLL_ENABLE, "KEY_ROLL_ENABLE", "Roll Enable" }, + { KeyMap::KEY_FLIGHT, KEY_SWAP_ROLL_YAW, "KEY_SWAP_ROLL_YAW", "Swap Ctrl Axes" }, { KeyMap::KEY_WEAPONS, KEY_ACTION_0, "KEY_ACTION_0", "Fire Primary" }, { KeyMap::KEY_WEAPONS, KEY_ACTION_1, "KEY_ACTION_1", "Fire Secondary" }, @@ -236,7 +236,7 @@ static KeyName key_key_table[] = { { 0, 144, "NUM", "NumLock" }, { 0, 145, "SCROLL", "Scroll" }, { 0, 44, "PRINT", "PrintScr" }, - + { 0, VK_NUMPAD0, "VK_NUMPAD0", "Num 0" }, { 0, VK_NUMPAD1, "VK_NUMPAD1", "Num 1" }, { 0, VK_NUMPAD2, "VK_NUMPAD2", "Num 2" }, @@ -596,7 +596,7 @@ KeyMap::Bind(int a, int k, int s) // +----------------------------------------------------------------------+ -int +int KeyMap::LoadKeyMap(const char* filename, int max_keys) { FILE* f; @@ -657,7 +657,7 @@ KeyMap::LoadKeyMap(const char* filename, int max_keys) // +----------------------------------------------------------------------+ -int +int KeyMap::SaveKeyMap(const char* filename, int max_keys) { FILE* f; @@ -682,21 +682,21 @@ KeyMap::SaveKeyMap(const char* filename, int max_keys) if (a > -1) { if (j > -1) { if (s > -1) { - fprintf(f, "%-24s %-16s %-16s %-16s\n", + fprintf(f, "%-24s %-16s %-16s %-16s\n", key_action_table[a].name, key_key_table[ k].name, key_key_table[ s].name, key_key_table[ j].name); } else if (k > -1) { - fprintf(f, "%-24s %-16s %-16s %-16s\n", + fprintf(f, "%-24s %-16s %-16s %-16s\n", key_action_table[a].name, key_key_table[ k].name, "null", key_key_table[ j].name); } else { - fprintf(f, "%-24s %-16s %-16s %-16s\n", + fprintf(f, "%-24s %-16s %-16s %-16s\n", key_action_table[a].name, "null", "null", @@ -704,14 +704,14 @@ KeyMap::SaveKeyMap(const char* filename, int max_keys) } } else if (s > -1) { - fprintf(f, "%-24s %-16s %-16s\n", - key_action_table[a].name, - key_key_table[ k].name, + fprintf(f, "%-24s %-16s %-16s\n", + key_action_table[a].name, + key_key_table[ k].name, key_key_table[ s].name); } else if (k > -1) { - fprintf(f, "%-24s %-16s\n", - key_action_table[a].name, + fprintf(f, "%-24s %-16s\n", + key_action_table[a].name, key_key_table[ k].name); } } @@ -724,7 +724,7 @@ KeyMap::SaveKeyMap(const char* filename, int max_keys) // +----------------------------------------------------------------------+ -int +int KeyMap::GetCategory(int n) { int nactions = sizeof(key_action_table) / sizeof(KeyName); @@ -751,7 +751,7 @@ KeyMap::FindMapIndex(int act) // +----------------------------------------------------------------------+ -const char* +const char* KeyMap::DescribeAction(int n) { int nactions = sizeof(key_action_table) / sizeof(KeyName); diff --git a/Stars45/Layout.cpp b/Stars45/Layout.cpp index 05c1eb2..ad4320f 100644 --- a/Stars45/Layout.cpp +++ b/Stars45/Layout.cpp @@ -110,7 +110,7 @@ Layout::DoLayout(ActiveWindow* panel) } } - return true; + return true; } // +--------------------------------------------------------------------+ @@ -232,7 +232,7 @@ const std::vector& weight_y) { Clear(); - if (min_x.size() == weight_x.size() && + if (min_x.size() == weight_x.size() && min_y.size() == weight_y.size()) { for (auto iter = min_x.begin(); iter != min_x.end(); ++iter) diff --git a/Stars45/Light.cpp b/Stars45/Light.cpp index 7815078..88cd436 100644 --- a/Stars45/Light.cpp +++ b/Stars45/Light.cpp @@ -47,7 +47,7 @@ int Light::id_key = 1; // +--------------------------------------------------------------------+ Light::Light(float l, float dl, int time) -: id(id_key++), type(LIGHT_POINT), life(time), +: id(id_key++), type(LIGHT_POINT), life(time), light(l), dldt(dl), color(255,255,255), active(true), shadow(false), scene(0) { } diff --git a/Stars45/ListBox.cpp b/Stars45/ListBox.cpp index 2992393..a4782c7 100644 --- a/Stars45/ListBox.cpp +++ b/Stars45/ListBox.cpp @@ -157,7 +157,7 @@ int ListBoxItem::operator <=(const ListBoxItem& item) const if (listbox && listbox == item.listbox) { int sort_column = listbox->GetSortColumn() - 1; int sort_criteria = listbox->GetSortCriteria(); - + if (sort_column == -1) { switch (sort_criteria) { case ListBox::LIST_SORT_NUMERIC_DESCENDING: @@ -204,7 +204,7 @@ int ListBoxItem::operator == (const ListBoxItem& item) const if (listbox && listbox == item.listbox) { int sort_column = listbox->GetSortColumn() - 1; int sort_criteria = listbox->GetSortCriteria(); - + if (sort_column == -1) { switch (sort_criteria) { case ListBox::LIST_SORT_NUMERIC_DESCENDING: @@ -384,7 +384,7 @@ ListBox::DrawContent(const Rect& ctrl_rect) } else { text_rect.Deflate(2,0); - DrawText(item->text.data(), + DrawText(item->text.data(), item->text.length(), text_rect, GetColumnAlign(column)|DT_SINGLELINE); @@ -580,7 +580,7 @@ void ListBox::SetItemText(int index, int column, const char* text) if (index >= 0 && index < items.size()) { ListBoxItem* item = items[index]; - + column--; if (column >= 0 && column < columns.size()-1) { while (column >= item->subitems.size()) { @@ -602,7 +602,7 @@ DWORD ListBox::GetItemData(int index, int column) if (index >= 0 && index < items.size()) { ListBoxItem* item = items[index]; - + column--; if (column >= 0 && column < item->subitems.size()) return item->subitems[column]->data; @@ -620,7 +620,7 @@ void ListBox::SetItemData(int index, int column, DWORD data) if (index >= 0 && index < items.size()) { ListBoxItem* item = items[index]; - + column--; if (column >= 0 && column < columns.size()-1) { while (column >= item->subitems.size()) { @@ -642,7 +642,7 @@ Bitmap* ListBox::GetItemImage(int index, int column) if (index >= 0 && index < items.size()) { ListBoxItem* item = items[index]; - + column--; if (column >= 0 && column < item->subitems.size()) return item->subitems[column]->image; @@ -660,7 +660,7 @@ void ListBox::SetItemImage(int index, int column, Bitmap* img) if (index >= 0 && index < items.size()) { ListBoxItem* item = items[index]; - + column--; if (column >= 0 && column < columns.size()-1) { while (column >= item->subitems.size()) { @@ -1141,7 +1141,7 @@ int ListBox::OnLButtonDown(int x, int y) int next_col_start = 0; int max_column = columns.size()-1; int column; - + for (column = 0; column < max_column; column++) { next_col_start += GetColumnWidth(column); diff --git a/Stars45/LoadDlg.cpp b/Stars45/LoadDlg.cpp index 623206c..f324de5 100644 --- a/Stars45/LoadDlg.cpp +++ b/Stars45/LoadDlg.cpp @@ -54,7 +54,7 @@ // +--------------------------------------------------------------------+ LoadDlg::LoadDlg(Screen* s, FormDef& def) -: FormWindow(s, 0, 0, s->Width(), s->Height()), +: FormWindow(s, 0, 0, s->Width(), s->Height()), progress(0), activity(0) { Init(def); diff --git a/Stars45/Locale_ss.cpp b/Stars45/Locale_ss.cpp index d079791..bf8ea03 100644 --- a/Stars45/Locale_ss.cpp +++ b/Stars45/Locale_ss.cpp @@ -185,7 +185,7 @@ Locale::CreateLocale(const char* l, const char* c, const char* v) // +--------------------------------------------------------------------+ -const List& +const List& Locale::GetAllLocales() { return locales; diff --git a/Stars45/MCIWave.cpp b/Stars45/MCIWave.cpp index 1424b7d..4e72a38 100644 --- a/Stars45/MCIWave.cpp +++ b/Stars45/MCIWave.cpp @@ -60,7 +60,7 @@ static int mci_send_string(const char* cmd_str) Print("Error (%s): '%s'\n", cmd_str, err_str); else Print("Error (%s): %d - UNKNOWN\n", cmd_str, mci_err); - return 0; + return 0; } return 1; @@ -78,72 +78,72 @@ static void print_wav_error() int load_wave_file(const char* fname, LPWAVEHDR hdr, LPWAVEFORMATEX format) { - HMMIO hmmio; /* file handle for open file */ - MMCKINFO mmckinfoParent; /* parent chunk information structure */ - MMCKINFO mmckinfoSubchunk; /* subchunk information structure */ - DWORD dwFmtSize; /* size of "fmt" chunk */ - DWORD dwDataSize; /* size of "data" chunk */ - - /* - * Open the given file for reading with buffered I/O - * using the default internal buffer. - */ - hmmio = mmioOpen((LPSTR) fname, NULL, MMIO_READ | MMIO_ALLOCBUF); + HMMIO hmmio; /* file handle for open file */ + MMCKINFO mmckinfoParent; /* parent chunk information structure */ + MMCKINFO mmckinfoSubchunk; /* subchunk information structure */ + DWORD dwFmtSize; /* size of "fmt" chunk */ + DWORD dwDataSize; /* size of "data" chunk */ + + /* + * Open the given file for reading with buffered I/O + * using the default internal buffer. + */ + hmmio = mmioOpen((LPSTR) fname, NULL, MMIO_READ | MMIO_ALLOCBUF); if (hmmio == NULL) { - Print("load_wave_file(): '%s' - Failed to open file.\n", fname); + Print("load_wave_file(): '%s' - Failed to open file.\n", fname); return 0; } - /* - * Locate a "RIFF" chunk with a "WAVE" form type - * to make sure the file is a WAVE file. - */ - mmckinfoParent.fccType = mmioFOURCC('W', 'A', 'V', 'E'); - if (mmioDescend(hmmio, (LPMMCKINFO) &mmckinfoParent, NULL, MMIO_FINDRIFF)) { + /* + * Locate a "RIFF" chunk with a "WAVE" form type + * to make sure the file is a WAVE file. + */ + mmckinfoParent.fccType = mmioFOURCC('W', 'A', 'V', 'E'); + if (mmioDescend(hmmio, (LPMMCKINFO) &mmckinfoParent, NULL, MMIO_FINDRIFF)) { Print("load_wave_file(): '%s' - This is not a WAVE file.\n", fname); mmioClose(hmmio, 0); return 0; } - /* - * Find the "fmt " chunk (form type "fmt "); it must be - * a subchunk of the "RIFF" parent chunk. - */ - mmckinfoSubchunk.ckid = mmioFOURCC('f', 'm', 't', ' '); - if (mmioDescend(hmmio, &mmckinfoSubchunk, &mmckinfoParent, MMIO_FINDCHUNK)) { + /* + * Find the "fmt " chunk (form type "fmt "); it must be + * a subchunk of the "RIFF" parent chunk. + */ + mmckinfoSubchunk.ckid = mmioFOURCC('f', 'm', 't', ' '); + if (mmioDescend(hmmio, &mmckinfoSubchunk, &mmckinfoParent, MMIO_FINDCHUNK)) { Print("load_wave_file(): '%s' - WAVE file has no \"fmt\" chunk\n", fname); mmioClose(hmmio, 0); return 0; } - /* - * Get the size of the "fmt " chunk--allocate and lock memory for it. - */ - dwFmtSize = mmckinfoSubchunk.cksize; + /* + * Get the size of the "fmt " chunk--allocate and lock memory for it. + */ + dwFmtSize = mmckinfoSubchunk.cksize; - /* Read the "fmt " chunk. */ + /* Read the "fmt " chunk. */ if (mmioRead(hmmio, (HPSTR) format, dwFmtSize) != (LRESULT)dwFmtSize) { Print("load_wave_file(): '%s' - Failed to read format chunk.\n", fname); mmioClose(hmmio, 0); return 0; } - /* Ascend out of the "fmt " subchunk. */ - mmioAscend(hmmio, &mmckinfoSubchunk, 0); + /* Ascend out of the "fmt " subchunk. */ + mmioAscend(hmmio, &mmckinfoSubchunk, 0); - /* - * Find the data subchunk. The current file position - * should be at the beginning of the data chunk. - */ - mmckinfoSubchunk.ckid = mmioFOURCC('d', 'a', 't', 'a'); + /* + * Find the data subchunk. The current file position + * should be at the beginning of the data chunk. + */ + mmckinfoSubchunk.ckid = mmioFOURCC('d', 'a', 't', 'a'); if (mmioDescend(hmmio, &mmckinfoSubchunk, &mmckinfoParent, MMIO_FINDCHUNK)) { Print("load_wave_file(): '%s' - WAVE file has no data chunk.\n", fname); - mmioClose(hmmio, 0); - return 0; - } + mmioClose(hmmio, 0); + return 0; + } - /* Get the size of the data subchunk. */ + /* Get the size of the data subchunk. */ dwDataSize = mmckinfoSubchunk.cksize; if (dwDataSize == 0L) { Print("load_wave_file(): '%s' - The data chunk contains no data.\n", fname); diff --git a/Stars45/MachineInfo.cpp b/Stars45/MachineInfo.cpp index 7485ac3..7437584 100644 --- a/Stars45/MachineInfo.cpp +++ b/Stars45/MachineInfo.cpp @@ -71,8 +71,8 @@ MachineInfo::GetShortDescription() static char desc[256]; static const char* cpu_names[] = { - "8088", - "8086", + "8088", + "8086", "80286", "80386", "80486", @@ -414,7 +414,7 @@ MachineInfo::DescribeMachine() int swap_max = (int) (mem_info.dwTotalPageFile/(1024*1024)); int swap_avail = (int) (mem_info.dwAvailPageFile/(1024*1024)); - sprintf_s(txt, "%d MB RAM %d MB Max Swap %d MB Avail Swap", + sprintf_s(txt, "%d MB RAM %d MB Max Swap %d MB Avail Swap", total_ram, swap_max, swap_avail); diff --git a/Stars45/Main.cpp b/Stars45/Main.cpp index 70a78e5..075ddcd 100644 --- a/Stars45/Main.cpp +++ b/Stars45/Main.cpp @@ -143,7 +143,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, else { Starshatter* stars = 0; - + stars = new(__FILE__,__LINE__) Starshatter; stars->SetTestMode(test_mode); diff --git a/Stars45/MapView.cpp b/Stars45/MapView.cpp index de7c567..20c61b5 100644 --- a/Stars45/MapView.cpp +++ b/Stars45/MapView.cpp @@ -188,7 +188,7 @@ MapView::SetSystem(StarSystem* s) ListIter planet = star->Satellites(); while (++planet) { planets.append(planet.value()); - + ListIter moon = planet->Satellites(); while (++moon) { planets.append(moon.value()); @@ -446,7 +446,7 @@ MapView::ProcessMenuItem(int action) if (action >= MAP_OBJECTIVE) { int index = action - MAP_OBJECTIVE; - + if (current_navpt && can_command) { current_navpt->SetTarget(objective_menu->GetItem(index)->GetText()); send_nav_data = true; @@ -657,7 +657,7 @@ MapView::SetViewMode(int mode) // switch mode: view_mode = mode; - + // restore state: if (view_mode == VIEW_GALAXY) { @@ -687,7 +687,7 @@ MapView::Update(SimObject* obj) active_menu = map_menu; } - return SimObserver::Update(obj); + return SimObserver::Update(obj); } // +--------------------------------------------------------------------+ @@ -696,7 +696,7 @@ void MapView::SelectShip(Ship* selship) { if (selship != current_ship) { - current_ship = selship; + current_ship = selship; if (current_ship) { if (current_ship->Life() == 0 || current_ship->IsDying() || current_ship->IsDead()) { @@ -718,7 +718,7 @@ MapView::SelectElem(MissionElement* elem) { if (elem != current_elem) { current_elem = elem; - + if (current_elem) { if (current_elem->IsStarship()) { ship_menu->GetItem(3)->SetEnabled(true); @@ -861,11 +861,11 @@ MapView::SetSelectionMode(int mode) if (mode != seln_mode && mode <= SELECT_FIGHTER) { seln_mode = mode; - - // when changing mode, + + // when changing mode, // select the item closest to the current center: if (system && view_mode == VIEW_SYSTEM) - SelectAt(rect.x + rect.w/2, + SelectAt(rect.x + rect.w/2, rect.y + rect.h/2); } } @@ -1089,12 +1089,12 @@ MapView::SetSelectedShip(Ship* ship) { if (ship) { SimRegion* simrgn = ship->GetRegion(); - + if (simrgn && simrgn->NumShips()) { selship = simrgn->Ships().find(ship); } } - + SelectShip(selship); } break; @@ -1338,7 +1338,7 @@ MapView::SelectAt(int x, int y) index++; } - + current_star = closest; } s = stars[current_star]; @@ -1352,7 +1352,7 @@ MapView::SelectAt(int x, int y) double dx = (planet->Location().x - test_x); double dy = (planet->Location().y - test_y); double d = sqrt(dx*dx + dy*dy); - + if (d < dist) { dist = d; closest = index; @@ -1360,7 +1360,7 @@ MapView::SelectAt(int x, int y) index++; } - + current_planet = closest; } s = planets[current_planet]; @@ -1375,7 +1375,7 @@ MapView::SelectAt(int x, int y) double dx = (region->Location().x - test_x); double dy = (region->Location().y - test_y); double d = sqrt(dx*dx + dy*dy); - + if (d < dist) { dist = d; closest = index; @@ -1383,7 +1383,7 @@ MapView::SelectAt(int x, int y) index++; } - + current_region = closest; } s = regions[current_region]; @@ -1604,7 +1604,7 @@ MapView::GetSelectionIndex() if (sim && rgn) simrgn = sim->FindRegion(rgn->Name()); - + if (simrgn) { if (current_ship && simrgn->NumShips()) { s = simrgn->Ships().index(current_ship); @@ -1896,7 +1896,7 @@ MapView::DrawSystem() DrawOrbital(*region, 1); } } - + ListIter region = star->Regions(); while (++region) { DrawOrbital(*region, 1); @@ -2275,7 +2275,7 @@ MapView::GetMinRadius(int type) // +--------------------------------------------------------------------+ -static void +static void ColorizeBitmap(Bitmap& img, Color color) { int w = img.Width(); @@ -2349,9 +2349,9 @@ MapView::DrawShip(Ship& s, bool current, int rep) Point heading = s.Heading().OtherHand(); heading.z = 0; heading.Normalize(); - + double theta = 0; - + if (heading.y > 0) theta = acos(heading.x); else @@ -2486,7 +2486,7 @@ MapView::DrawElem(MissionElement& s, bool current, int rep) int sprite_index = (int) ((theta + THETA_OFFSET) * THETA_SLICE); int nsprites = 0; - + if (s.GetDesign()) nsprites = s.GetDesign()->map_sprites.size(); @@ -2904,7 +2904,7 @@ MapView::DrawCombatGroup(CombatGroup* group, int rep) if (group->GetUnits().size() > 0) { CombatUnit* unit = 0; - + for (int i = 0; i < group->GetUnits().size(); i++) { unit = group->GetUnits().at(i); @@ -2936,7 +2936,7 @@ MapView::DrawCombatGroup(CombatGroup* group, int rep) else { int sprite_index = 2; int nsprites = 0; - + if (unit->GetDesign()) nsprites = unit->GetDesign()->map_sprites.size(); @@ -3088,11 +3088,11 @@ MapView::GetShipLoc(Ship& s, POINT& shiploc) } } - if (view_mode == VIEW_SYSTEM || + if (view_mode == VIEW_SYSTEM || (view_mode == VIEW_REGION && rgn == s.GetRegion()->GetOrbitalRegion())) { double sx = (s.Location().x + rlx) * scale; double sy = (s.Location().y + rly) * scale; - + shiploc.x = (int) (cx + sx + ox); shiploc.y = (int) (cy + sy + oy); } @@ -3167,11 +3167,11 @@ MapView::GetElemLoc(MissionElement& s, POINT& shiploc) } } - if (view_mode == VIEW_SYSTEM || + if (view_mode == VIEW_SYSTEM || (view_mode == VIEW_REGION && !_stricmp(s.Region(), rgn->Name()))) { double sx = (s.Location().x + rlx) * scale; double sy = (s.Location().y + rly) * scale; - + shiploc.x = (int) (cx + sx + ox); shiploc.y = (int) (cy + sy + oy); } @@ -3185,7 +3185,7 @@ MapView::GetElemLoc(MissionElement& s, POINT& shiploc) OrbitalRegion* MapView::GetRegion() const -{ +{ OrbitalRegion* result = 0; if (current_region < regions.size()) @@ -3316,7 +3316,7 @@ MapView::OnMouseMove(int x, int y) if (dragging) { int delta_x = x - mouse_x; int delta_y = y - mouse_y; - + offset_x += delta_x * r / c; offset_y += delta_y * r / c; diff --git a/Stars45/MapView.h b/Stars45/MapView.h index e6b2abf..b652af8 100644 --- a/Stars45/MapView.h +++ b/Stars45/MapView.h @@ -69,8 +69,8 @@ const int EID_MAP_CLICK = 1000; // +--------------------------------------------------------------------+ -class MapView : public View, -public EventTarget, +class MapView : public View, +public EventTarget, public SimObserver { public: diff --git a/Stars45/MenuDlg.cpp b/Stars45/MenuDlg.cpp index b114ac2..d09f4bd 100644 --- a/Stars45/MenuDlg.cpp +++ b/Stars45/MenuDlg.cpp @@ -74,7 +74,7 @@ extern const char* versionInfo; // +--------------------------------------------------------------------+ MenuDlg::MenuDlg(Screen* s, FormDef& def, MenuScreen* mgr) -: FormWindow(s, 0, 0, s->Width(), s->Height()), +: FormWindow(s, 0, 0, s->Width(), s->Height()), manager(mgr), btn_start(0), btn_campaign(0), btn_mission(0), btn_player(0), btn_multi(0), btn_mod(0), btn_tac(0), diff --git a/Stars45/MenuScreen.cpp b/Stars45/MenuScreen.cpp index 39fa195..8ac618e 100644 --- a/Stars45/MenuScreen.cpp +++ b/Stars45/MenuScreen.cpp @@ -91,10 +91,10 @@ // +--------------------------------------------------------------------+ MenuScreen::MenuScreen() -: screen(0), menudlg(0), +: screen(0), menudlg(0), fadewin(0), fadeview(0), exitdlg(0), auddlg(0), viddlg(0), optdlg(0), ctldlg(0), joydlg(0), keydlg(0), -playdlg(0), confirmdlg(0), firstdlg(0), awarddlg(0), cmpSelectDlg(0), +playdlg(0), confirmdlg(0), firstdlg(0), awarddlg(0), cmpSelectDlg(0), msnSelectDlg(0), modDlg(0), modInfoDlg(0), msnEditDlg(0), msnElemDlg(0), msnEventDlg(0), msnEditNavDlg(0), netClientDlg(0), netAddrDlg(0), netPassDlg(0), netLobbyDlg(0), netServerDlg(0), diff --git a/Stars45/MenuView.cpp b/Stars45/MenuView.cpp index 745ec83..042e2f3 100644 --- a/Stars45/MenuView.cpp +++ b/Stars45/MenuView.cpp @@ -33,7 +33,7 @@ OVERVIEW ======== - + */ #include "MemDebug.h" diff --git a/Stars45/Mfd.cpp b/Stars45/Mfd.cpp index 44d5719..55f7cae 100644 --- a/Stars45/Mfd.cpp +++ b/Stars45/Mfd.cpp @@ -110,7 +110,7 @@ cockpit_hud_texture(0) } MFD::~MFD() -{ +{ GRAPHIC_DESTROY(sprite); } @@ -223,8 +223,8 @@ MFD::SetRect(const Rect& r) rect = r; if (sprite) - sprite->MoveTo(Point(rect.x + sprite->Width()/2, - rect.y + sprite->Height()/2, + sprite->MoveTo(Point(rect.x + sprite->Width()/2, + rect.y + sprite->Height()/2, 1)); } @@ -1112,14 +1112,14 @@ MFD::DrawGameMFD() if (!HUDView::IsArcade() && HUDView::ShowFPS()) { sprintf_s(txt, "FPS: %6.2f", Game::FrameRate()); - DrawMFDText(t++, txt, txt_rect, DT_LEFT); + DrawMFDText(t++, txt, txt_rect, DT_LEFT); txt_rect.y += 10; if (lines <= 1) return; Starshatter* game = Starshatter::GetInstance(); sprintf_s(txt, "Polys: %d", game->GetPolyStats().npolys); - DrawMFDText(t++, txt, txt_rect, DT_LEFT); + DrawMFDText(t++, txt, txt_rect, DT_LEFT); txt_rect.y += 10; } @@ -1136,7 +1136,7 @@ MFD::DrawGameMFD() if (ship) { DWORD clock = ship->MissionClock(); - + hours = (clock / 3600000) ; minutes = (clock / 60000) % 60; seconds = (clock / 1000) % 60; diff --git a/Stars45/Mfd.h b/Stars45/Mfd.h index 955e69c..5cc8181 100644 --- a/Stars45/Mfd.h +++ b/Stars45/Mfd.h @@ -56,7 +56,7 @@ class Window; class MFD { public: - enum Modes { MFD_MODE_OFF, MFD_MODE_GAME, MFD_MODE_SHIP, + enum Modes { MFD_MODE_OFF, MFD_MODE_GAME, MFD_MODE_SHIP, MFD_MODE_FOV, /*MFD_MODE_FWD, MFD_MODE_MAP,*/ MFD_MODE_HSD, MFD_MODE_3D }; diff --git a/Stars45/Mission.cpp b/Stars45/Mission.cpp index ee9f9b6..6438cc4 100644 --- a/Stars45/Mission.cpp +++ b/Stars45/Mission.cpp @@ -479,7 +479,7 @@ Mission::Save() FILE* f; fopen_s(&f, fname, "w"); if (f) { - fwrite(content.data(), content.length(), 1, f); + fwrite(content.data(), content.length(), 1, f); fclose(f); } @@ -1082,7 +1082,7 @@ Mission::ParseInstruction(TermStruct* val, MissionElement* element) if (defname == "cmd") { GetDefText(order_name, pdef, filename); - + for (int cmd = 0; cmd < Instruction::NUM_ACTIONS; cmd++) if (!_stricmp(order_name, Instruction::ActionName(cmd))) order = cmd; @@ -1090,7 +1090,7 @@ Mission::ParseInstruction(TermStruct* val, MissionElement* element) else if (defname == "status") { GetDefText(status_name, pdef, filename); - + for (int n = 0; n < Instruction::NUM_STATUS; n++) if (!_stricmp(status_name, Instruction::StatusName(n))) status = n; @@ -1373,7 +1373,7 @@ Mission::Serialize(const char* player_elem, int player_index) ListIter sys_iter = system_list; while (++sys_iter) { StarSystem* sys = sys_iter.value(); - + if (sys != star_system) { s += "\"\nsystem: \""; s += sys->Name(); diff --git a/Stars45/Mission.h b/Stars45/Mission.h index c8c4738..92e8dea 100644 --- a/Stars45/Mission.h +++ b/Stars45/Mission.h @@ -80,7 +80,7 @@ class Mission public: static const char* TYPENAME() { return "Mission"; } - enum TYPE + enum TYPE { PATROL, SWEEP, diff --git a/Stars45/MissionEvent.cpp b/Stars45/MissionEvent.cpp index 1ef3308..92b5d0f 100644 --- a/Stars45/MissionEvent.cpp +++ b/Stars45/MissionEvent.cpp @@ -170,7 +170,7 @@ MissionEvent::CheckTrigger() if (ship) { double damage = 100.0 * (ship->Design()->integrity - ship->Integrity()) / (ship->Design()->integrity); - + if (damage >= trigger_param[0]) Activate(); } @@ -180,7 +180,7 @@ MissionEvent::CheckTrigger() case TRIGGER_DETECT: { Ship* ship = sim->FindShip(trigger_ship); Ship* tgt = sim->FindShip(trigger_target); - + if (ship && tgt) { if (ship->FindContact(tgt)) Activate(); @@ -194,7 +194,7 @@ MissionEvent::CheckTrigger() case TRIGGER_RANGE: { Ship* ship = sim->FindShip(trigger_ship); Ship* tgt = sim->FindShip(trigger_target); - + if (ship && tgt) { double range = (ship->Location() - tgt->Location()).length(); double min_range = 0; @@ -369,7 +369,7 @@ MissionEvent::Execute(bool silent) } break; - case OBJECTIVE: + case OBJECTIVE: if (elem) { if (event_param[0]) { elem->ClearInstructions(); @@ -504,7 +504,7 @@ MissionEvent::Execute(bool silent) cam_dir->SetShip(player); switch (event_param[0]) { - case 1: + case 1: if (cam_dir->GetMode() != CameraDirector::MODE_COCKPIT) cam_dir->SetMode(CameraDirector::MODE_COCKPIT, event_rect.x); break; @@ -528,7 +528,7 @@ MissionEvent::Execute(bool silent) if (event_target.length()) { ::Print("Mission Event %d: setting camera target to %s\n", id, (const char*) event_target); Ship* s_tgt = 0; - + if (event_target.indexOf("body:") < 0) s_tgt = sim->FindShip(event_target); @@ -683,7 +683,7 @@ MissionEvent::Execute(bool silent) if (!silent && !sound && event_sound.length()) { DataLoader* loader = DataLoader::GetLoader(); bool use_fs = loader->IsFileSystemEnabled(); - DWORD flags = pan ? Sound::LOCKED|Sound::LOCALIZED : + DWORD flags = pan ? Sound::LOCKED|Sound::LOCALIZED : Sound::LOCKED|Sound::AMBIENT; loader->UseFileSystem(true); @@ -817,9 +817,9 @@ MissionEvent::NumTriggerParams() const // +--------------------------------------------------------------------+ static const char* event_names[] = { - "Message", + "Message", "Objective", - "Instruction", + "Instruction", "IFF", "Damage", "Jump", @@ -838,7 +838,7 @@ static const char* event_names[] = { static const char* trigger_names[] = { "Time", "Damage", - "Destroyed", + "Destroyed", "Jump", "Launch", "Dock", diff --git a/Stars45/MissionEvent.h b/Stars45/MissionEvent.h index 1accd5b..25786d8 100644 --- a/Stars45/MissionEvent.h +++ b/Stars45/MissionEvent.h @@ -74,7 +74,7 @@ public: static const char* TYPENAME() { return "MissionEvent"; } enum EVENT_TYPE { - MESSAGE, + MESSAGE, OBJECTIVE, INSTRUCTION, IFF, @@ -99,7 +99,7 @@ public: }; enum EVENT_TRIGGER { - TRIGGER_TIME, TRIGGER_DAMAGE, TRIGGER_DESTROYED, + TRIGGER_TIME, TRIGGER_DAMAGE, TRIGGER_DESTROYED, TRIGGER_JUMP, TRIGGER_LAUNCH, TRIGGER_DOCK, TRIGGER_NAVPT, TRIGGER_EVENT, TRIGGER_SKIPPED, TRIGGER_TARGET, TRIGGER_SHIPS_LEFT, TRIGGER_DETECT, diff --git a/Stars45/MissionTemplate.cpp b/Stars45/MissionTemplate.cpp index 0aac015..9f55fd1 100644 --- a/Stars45/MissionTemplate.cpp +++ b/Stars45/MissionTemplate.cpp @@ -357,7 +357,7 @@ MissionTemplate::Load(const char* fname, const char* pname) do { delete term; term = 0; term = parser.ParseTerm(); - + if (term) { TermDef* def = term->isDef(); if (def) { @@ -601,7 +601,7 @@ MissionTemplate::ParseAlias(TermStruct* val) else if (campaign && code == "player_squadron") { CombatGroup* player_group = player_squadron; - + if (!player_group) player_group = campaign->GetPlayerGroup(); diff --git a/Stars45/ModConfig.cpp b/Stars45/ModConfig.cpp index eea9f2c..6f36261 100644 --- a/Stars45/ModConfig.cpp +++ b/Stars45/ModConfig.cpp @@ -198,8 +198,8 @@ ModConfig::FindMods() Text* name = iter.value(); name->setSensitive(false); - if (*name == "shatter.dat" || - *name == "beta.dat" || + if (*name == "shatter.dat" || + *name == "beta.dat" || *name == "start.dat" || *name == "irunin.dat" || *name == "vox.dat" || @@ -265,7 +265,7 @@ ModConfig::Deploy() Print(" %d. %s\n", i++, name->data()); ModInfo* mod_info = new(__FILE__,__LINE__) ModInfo; - + if (mod_info->Load(name->data()) && mod_info->Enable()) { mods.append(mod_info); } @@ -329,7 +329,7 @@ ModConfig::EnableMod(const char* name) if (!IsDeployed(*mod_name)) { ModInfo* mod_info = new(__FILE__,__LINE__) ModInfo; - + if (mod_info->Load(*mod_name) && mod_info->Enable()) { mods.append(mod_info); } diff --git a/Stars45/Mouse.cpp b/Stars45/Mouse.cpp index ec86430..27cf964 100644 --- a/Stars45/Mouse.cpp +++ b/Stars45/Mouse.cpp @@ -128,7 +128,7 @@ Mouse::SetCursor(CURSOR c) // +--------------------------------------------------------------------+ -int +int Mouse::LoadCursor(CURSOR c, const char* name, HOTSPOT hs) { int result = 0; diff --git a/Stars45/MsnDlg.cpp b/Stars45/MsnDlg.cpp index 3f1d85c..8396fbc 100644 --- a/Stars45/MsnDlg.cpp +++ b/Stars45/MsnDlg.cpp @@ -249,7 +249,7 @@ MsnDlg::CalcTimeOnTarget() double dist = Point(loc - navpt->Location()).length(); int etr = 0; - + if (navpt->Speed() > 0) etr = (int) (dist / navpt->Speed()); else diff --git a/Stars45/MsnElemDlg.cpp b/Stars45/MsnElemDlg.cpp index 2ad13b6..28c37ba 100644 --- a/Stars45/MsnElemDlg.cpp +++ b/Stars45/MsnElemDlg.cpp @@ -492,7 +492,7 @@ MsnElemDlg::OnDesignSelect(AWEvent* event) if (design) { MissionLoad* mload = 0; - + if (elem && elem->Loadouts().size() > 0) mload = elem->Loadouts().at(0); diff --git a/Stars45/MsnEventDlg.cpp b/Stars45/MsnEventDlg.cpp index d53f3f7..d517c2a 100644 --- a/Stars45/MsnEventDlg.cpp +++ b/Stars45/MsnEventDlg.cpp @@ -156,7 +156,7 @@ MsnEventDlg::Show() sprintf_s(buf, "%d", event->EventParam()); if (edt_event_param) edt_event_param->SetText(buf); - if (edt_trigger_param) + if (edt_trigger_param) edt_trigger_param->SetText(event->TriggerParamStr()); if (edt_event_message) diff --git a/Stars45/MsnPkgDlg.cpp b/Stars45/MsnPkgDlg.cpp index 847bf32..50a7b1c 100644 --- a/Stars45/MsnPkgDlg.cpp +++ b/Stars45/MsnPkgDlg.cpp @@ -141,7 +141,7 @@ MsnPkgDlg::DrawPackages() ListIter elem = mission->GetElements(); while (++elem) { // display this element? - if (elem->GetIFF() == mission->Team() && + if (elem->GetIFF() == mission->Team() && !elem->IsSquadron() && elem->Region() == mission->GetRegion() && elem->GetDesign()->type < Ship::STATION) { @@ -229,9 +229,9 @@ MsnPkgDlg::DrawThreats() if (!mission) return; MissionElement* player = mission->GetPlayer(); - + if (!player) return; - + Text rgn0 = player->Region(); Text rgn1; int iff = player->GetIFF(); @@ -257,11 +257,11 @@ MsnPkgDlg::DrawThreats() continue; if (elem->IsGroundUnit()) { - if (!elem->GetDesign() || + if (!elem->GetDesign() || elem->GetDesign()->type != Ship::SAM) continue; - if (elem->Region() != rgn0 && + if (elem->Region() != rgn0 && elem->Region() != rgn1) continue; } @@ -288,8 +288,8 @@ MsnPkgDlg::DrawThreats() double dist = Point(base_loc - elem->Location()).length(); FormatNumber(rng, dist); - sprintf_s(txt, "%s - %d %s - %s", role, - elem->Count(), + sprintf_s(txt, "%s - %d %s - %s", role, + elem->Count(), elem->GetDesign()->abrv, rng); if (threat[i]) diff --git a/Stars45/MultiController.cpp b/Stars45/MultiController.cpp index 2c79374..c876522 100644 --- a/Stars45/MultiController.cpp +++ b/Stars45/MultiController.cpp @@ -114,7 +114,7 @@ MultiController::Acquire() w += ctrl[i]->Yaw(); c += ctrl[i]->Center(); t += ctrl[i]->Throttle(); - + for (int a = 0; a < MotionController::MaxActions; a++) action[a] += ctrl[i]->Action(a); } diff --git a/Stars45/MusicDirector.cpp b/Stars45/MusicDirector.cpp index 8b6cdd6..75d65f1 100644 --- a/Stars45/MusicDirector.cpp +++ b/Stars45/MusicDirector.cpp @@ -301,7 +301,7 @@ MusicDirector::SetMode(int mode) AutoThreadSync a(music_director->sync); // stay in intro mode until it is complete: - if (mode == MENU && (music_director->GetMode() == NONE || + if (mode == MENU && (music_director->GetMode() == NONE || music_director->GetMode() == INTRO)) mode = INTRO; @@ -309,7 +309,7 @@ MusicDirector::SetMode(int mode) if (mode != music_director->mode) { ::Print("MusicDirector::SetMode() old: %s new: %s\n", - GetModeName(music_director->mode), + GetModeName(music_director->mode), GetModeName(mode)); music_director->mode = mode; diff --git a/Stars45/MusicTrack.cpp b/Stars45/MusicTrack.cpp index 33af28c..d5617c5 100644 --- a/Stars45/MusicTrack.cpp +++ b/Stars45/MusicTrack.cpp @@ -55,7 +55,7 @@ const double SILENCE = -5000; // +-------------------------------------------------------------------+ MusicTrack::MusicTrack(const Text& txt, int m, int n) -: name(txt), sound(0), state(NONE), mode(m), index(n), +: name(txt), sound(0), state(NONE), mode(m), index(n), fade(0), fade_time(FADE_TIME) { long max_vol = 0; diff --git a/Stars45/NPClient.h b/Stars45/NPClient.h index 4903f41..bf7925b 100644 --- a/Stars45/NPClient.h +++ b/Stars45/NPClient.h @@ -54,7 +54,7 @@ // DATA FIELDS #define NPControl 8 // indicates a control data field -// the second parameter of a message bearing control data information contains a packed data format. +// the second parameter of a message bearing control data information contains a packed data format. // The High byte indicates what the data is, and the Low byte contains the actual data // roll, pitch, yaw #define NPRoll 1 // +/- 16383 (representing +/- 180) [data = input - 16383] @@ -71,7 +71,7 @@ #define NPRawY 256 // 0..25600 (actual value is multiplied x 100 to pass two decimal places of precision) [data = input / 100] #define NPRawZ 512 // 0..25600 (actual value is multiplied x 100 to pass two decimal places of precision) [data = input / 100] -// x, y, z deltas from raw imager position +// x, y, z deltas from raw imager position #define NPDeltaX 1024 // +/- 2560 (actual value is multiplied x 10 to pass two decimal places of precision) [data = (input / 10) - 256] #define NPDeltaY 2048 // +/- 2560 (actual value is multiplied x 10 to pass two decimal places of precision) [data = (input / 10) - 256] #define NPDeltaZ 4096 // +/- 2560 (actual value is multiplied x 10 to pass two decimal places of precision) [data = (input / 10) - 256] diff --git a/Stars45/NPClientWraps.cpp b/Stars45/NPClientWraps.cpp index e4ba0f4..ffdfe14 100644 --- a/Stars45/NPClientWraps.cpp +++ b/Stars45/NPClientWraps.cpp @@ -201,7 +201,7 @@ NPRESULT NPClient_Init( const char* csDLLPath ) csNPClientDLLFullPath += "NPClient.dll"; ghNPClientDLL = ::LoadLibrary( csNPClientDLLFullPath.data() ); - + if (NULL != ghNPClientDLL) { // verify the dll signature gpfNP_GetSignature = (PF_NP_GETSIGNATURE)::GetProcAddress( ghNPClientDLL, "NP_GetSignature" ); @@ -215,10 +215,10 @@ NPRESULT NPClient_Init( const char* csDLLPath ) NPRESULT vresult = NP_GetSignature( &pSignature ); if( vresult == NP_OK ) { - if ((strcmp(verifySignature.DllSignature,pSignature.DllSignature)==0) + if ((strcmp(verifySignature.DllSignature,pSignature.DllSignature)==0) && (strcmp(verifySignature.AppSignature,pSignature.AppSignature)==0)) - { - result = NP_OK; + { + result = NP_OK; // Get addresses of all exported functions gpfNP_RegisterWindowHandle = (PF_NP_REGISTERWINDOWHANDLE)::GetProcAddress( ghNPClientDLL, "NP_RegisterWindowHandle" ); @@ -234,13 +234,13 @@ NPRESULT NPClient_Init( const char* csDLLPath ) gpfNP_StopDataTransmission = (PF_NP_STOPDATATRANSMISSION)::GetProcAddress( ghNPClientDLL, "NP_StopDataTransmission" ); } else - { - result = NP_ERR_DLL_NOT_FOUND; + { + result = NP_ERR_DLL_NOT_FOUND; } } else { - result = NP_ERR_DLL_NOT_FOUND; + result = NP_ERR_DLL_NOT_FOUND; } } else diff --git a/Stars45/NavDlg.cpp b/Stars45/NavDlg.cpp index bbe50c2..50cd020 100644 --- a/Stars45/NavDlg.cpp +++ b/Stars45/NavDlg.cpp @@ -74,7 +74,7 @@ DEF_MAP_CLIENT(NavDlg, OnClose); // +--------------------------------------------------------------------+ static char* filter_name[] = { - "SYSTEM", "PLANET", + "SYSTEM", "PLANET", "SECTOR", "STATION", "STARSHIP", "FIGHTER" }; @@ -104,8 +104,8 @@ const int VIEW_REGION = 2; NavDlg::NavDlg(Screen* s, FormDef& def, BaseScreen* mgr) : FormWindow(s, 0, 0, s->Width(), s->Height()), manager(mgr), -loc_labels(0), dst_labels(0), loc_data(0), dst_data(0), -seln_list(0), info_list(0), seln_mode(SELECT_REGION), +loc_labels(0), dst_labels(0), loc_data(0), dst_data(0), +seln_list(0), info_list(0), seln_mode(SELECT_REGION), nav_edit_mode(NAV_EDIT_NONE), star_map(0), map_win(0), star_system(0), ship(0), mission(0), editor(false) { @@ -231,7 +231,7 @@ NavDlg::SetSystem(StarSystem* s) ListIter planet = star->Satellites(); while (++planet) { planets.append(planet.value()); - + ListIter moon = planet->Satellites(); while (++moon) { planets.append(moon.value()); @@ -378,11 +378,11 @@ NavDlg::ExecFrame() char y[16]; char z[16]; char d[16]; - + FormatNumber(x, -ship->Location().x); FormatNumber(y, ship->Location().z); FormatNumber(z, ship->Location().y); - + strcpy_s(loc_buf, Game::GetText("NavDlg.loc-labels").data()); loc_labels->SetText(loc_buf); @@ -399,7 +399,7 @@ NavDlg::ExecFrame() } loc_data->SetText(loc_buf); - + if (ship) { NavSystem* navsys = ship->GetNavSystem(); @@ -424,7 +424,7 @@ NavDlg::ExecFrame() if (dst_labels) { Instruction* navpt = ship->GetNextNavPoint(); - + if (navpt && navpt->Region()) { FormatNumber(x, navpt->Location().x); FormatNumber(y, navpt->Location().y); @@ -436,11 +436,11 @@ NavDlg::ExecFrame() npt -= sim->GetActiveRegion()->Location(); npt = npt.OtherHand(); - + // distance from self to navpt: distance = Point(npt - ship->Location()).length(); FormatNumber(d, distance); - + strcpy_s(loc_buf, Game::GetText("NavDlg.dst-labels").data()); dst_labels->SetText(loc_buf); @@ -464,7 +464,7 @@ NavDlg::ExecFrame() (zoom_in_btn && zoom_in_btn->GetButtonState() > 0)) { star_map->ZoomIn(); } - else if (Keyboard::KeyDown(VK_SUBTRACT) || + else if (Keyboard::KeyDown(VK_SUBTRACT) || (zoom_out_btn && zoom_out_btn->GetButtonState() > 0)) { star_map->ZoomOut(); } @@ -774,7 +774,7 @@ NavDlg::UpdateSelection() } } - else if (seln_mode == SELECT_STATION || + else if (seln_mode == SELECT_STATION || seln_mode == SELECT_STARSHIP || seln_mode == SELECT_FIGHTER) { @@ -866,7 +866,7 @@ NavDlg::UpdateLists() seln_list->ClearItems(); switch (seln_mode) { - case SELECT_SYSTEM: + case SELECT_SYSTEM: { seln_list->SetColumnTitle(0, Game::GetText(Text("NavDlg.filter.") + filter_name[seln_mode])); int i = 0; @@ -947,7 +947,7 @@ NavDlg::UpdateLists() if (filter_ok) { bool visible = s->GetIFF() == 0 || s->GetIFF() == ship->GetIFF() || - s->GetElement() && + s->GetElement() && s->GetElement()->IntelLevel() > Intel::KNOWN; if (visible) diff --git a/Stars45/NavLight.cpp b/Stars45/NavLight.cpp index 25ee24c..0f598cf 100644 --- a/Stars45/NavLight.cpp +++ b/Stars45/NavLight.cpp @@ -78,7 +78,7 @@ nlights(0), enable(true) loc[i] = c.loc[i]; pattern[i] = c.pattern[i]; beacon_type[i] = c.beacon_type[i]; - + DriveSprite* rep = new(__FILE__,__LINE__) DriveSprite(images[beacon_type[i]]); rep->Scale(c.scale); diff --git a/Stars45/NetAddrDlg.cpp b/Stars45/NetAddrDlg.cpp index 29b4227..fde0489 100644 --- a/Stars45/NetAddrDlg.cpp +++ b/Stars45/NetAddrDlg.cpp @@ -130,7 +130,7 @@ NetAddrDlg::OnSave(AWEvent* event) { NetClientConfig* config = NetClientConfig::GetInstance(); - if (config && + if (config && edt_addr && edt_addr->GetText().length() > 0 && edt_port && edt_port->GetText().length() > 0) { diff --git a/Stars45/NetAdminChat.cpp b/Stars45/NetAdminChat.cpp index 256c6fb..7ac4196 100644 --- a/Stars45/NetAdminChat.cpp +++ b/Stars45/NetAdminChat.cpp @@ -72,7 +72,7 @@ NetAdminChat::DoGet(HttpRequest& request, HttpResponse& response) if (user) NetUtil::SendChat(0xffff, user->Name(), msg); } - + else if (act.length()) { if (act == "clear") lobby->ClearChat(); diff --git a/Stars45/NetAdminServer.cpp b/Stars45/NetAdminServer.cpp index 5f21287..6435a8c 100644 --- a/Stars45/NetAdminServer.cpp +++ b/Stars45/NetAdminServer.cpp @@ -805,7 +805,7 @@ NetAdminServlet::GetStatLine() "; line += FormatTimeString(); - + line += "  \n\ \n\ \n\ diff --git a/Stars45/NetAuth.cpp b/Stars45/NetAuth.cpp index 5418f48..06a6bfe 100644 --- a/Stars45/NetAuth.cpp +++ b/Stars45/NetAuth.cpp @@ -218,7 +218,7 @@ NetAuth::AuthUser(NetUser* u, Text response) else if (u) { Text expected_response = CreateAuthResponse(auth_level, u->Salt()); if (expected_response == response) - authentic = true; + authentic = true; u->SetAuthState(authentic ? NET_AUTH_OK : NET_AUTH_FAILED); } diff --git a/Stars45/NetClientConfig.cpp b/Stars45/NetClientConfig.cpp index 8113577..9b00e1e 100644 --- a/Stars45/NetClientConfig.cpp +++ b/Stars45/NetClientConfig.cpp @@ -211,7 +211,7 @@ NetClientConfig::Load() delete term; term = parser.ParseTerm(); - + if (term) { TermDef* def = term->isDef(); if (def) { diff --git a/Stars45/NetData.cpp b/Stars45/NetData.cpp index c1af0a7..126febe 100644 --- a/Stars45/NetData.cpp +++ b/Stars45/NetData.cpp @@ -160,7 +160,7 @@ NetObjLoc::Unpack(const BYTE* p) if (p && p[0] == TYPE && p[1] == SIZE) { CopyMemory(data, p, SIZE); - objid = (data[ 2] << 8) | + objid = (data[ 2] << 8) | (data[ 3] ); int x = (data[ 4] << 16) | @@ -785,7 +785,7 @@ NetWepTrigger::Pack() data[6] = (BYTE) (sysix+1); data[7] = (BYTE) index; data[8] = (BYTE) count; - data[9] = ((BYTE) decoy << 1) | + data[9] = ((BYTE) decoy << 1) | ((BYTE) probe ); return data; @@ -830,7 +830,7 @@ NetWepRelease::Pack() data[7] = (BYTE) ((wepid & 0x00ff) ); data[8] = (BYTE) (sysix+1); data[9] = (BYTE) index; - data[10] = ((BYTE) decoy << 1) | + data[10] = ((BYTE) decoy << 1) | ((BYTE) probe ); return data; @@ -1332,10 +1332,10 @@ NetNavData::Unpack(const BYTE* p) const char* rgn_name = 0; const char* tgt_name = 0; - objid = (data[ 2] << 8) | + objid = (data[ 2] << 8) | (data[ 3] ); - tgtid = (data[32] << 8) | + tgtid = (data[32] << 8) | (data[33] ); create = data[ 4] ? true : false; @@ -1427,7 +1427,7 @@ NetNavDelete::Unpack(const BYTE* p) CopyMemory(data, p, SIZE); int index = 0; - objid = (data[ 2] << 8) | + objid = (data[ 2] << 8) | (data[ 3] ); index = data[4]; diff --git a/Stars45/NetData.h b/Stars45/NetData.h index 8a3e030..c072a4d 100644 --- a/Stars45/NetData.h +++ b/Stars45/NetData.h @@ -360,10 +360,10 @@ public: NetObjKill() : objid(0), kill_id(0), killtype(0), respawn(false), deck(0) { } enum { TYPE=NET_OBJ_KILL, SIZE=24, - KILL_MISC = 0, - KILL_PRIMARY, - KILL_SECONDARY, - KILL_COLLISION, + KILL_MISC = 0, + KILL_PRIMARY, + KILL_SECONDARY, + KILL_COLLISION, KILL_CRASH, KILL_DOCK }; diff --git a/Stars45/NetFileServlet.cpp b/Stars45/NetFileServlet.cpp index 0674705..126096e 100644 --- a/Stars45/NetFileServlet.cpp +++ b/Stars45/NetFileServlet.cpp @@ -98,7 +98,7 @@ NetWebServlet::DoGet(HttpRequest& request, HttpResponse& response) FILE* f; ::fopen_s(&f, filename, "rb"); - + if (f) { ::fseek(f, 0, SEEK_END); int len = ftell(f); diff --git a/Stars45/NetGameClient.cpp b/Stars45/NetGameClient.cpp index 3f0a146..fb5a498 100644 --- a/Stars45/NetGameClient.cpp +++ b/Stars45/NetGameClient.cpp @@ -377,7 +377,7 @@ NetGameClient::DoQuitAnnounce(NetMsg* msg) if (player) { NetPlayer* zombie = players.remove(player); - + // return remote ship to ship pool: Ship* s = zombie->GetShip(); if (s) { @@ -532,7 +532,7 @@ NetGameClient::DoObjKill(NetMsg* msg) if (kstats) { if (obj_kill.GetKillType() == NetObjKill::KILL_PRIMARY) kstats->AddEvent(SimEvent::GUNS_KILL, ship->Name()); - + else if (obj_kill.GetKillType() == NetObjKill::KILL_SECONDARY) kstats->AddEvent(SimEvent::MISSILE_KILL, ship->Name()); } @@ -547,7 +547,7 @@ NetGameClient::DoObjKill(NetMsg* msg) if (killee) { if (obj_kill.GetKillType() == NetObjKill::KILL_DOCK) killee->AddEvent(SimEvent::DOCK, killer_name); - else + else killee->AddEvent(SimEvent::DESTROYED, killer_name); } @@ -566,7 +566,7 @@ NetGameClient::DoObjKill(NetMsg* msg) } } - // this shouldn't happen in practice, + // this shouldn't happen in practice, // but if it does, this is what should be done: else { Shot* shot = FindShotByObjID(obj_kill.GetObjID()); diff --git a/Stars45/NetLobbyClient.cpp b/Stars45/NetLobbyClient.cpp index 18b8d94..9340409 100644 --- a/Stars45/NetLobbyClient.cpp +++ b/Stars45/NetLobbyClient.cpp @@ -175,7 +175,7 @@ NetLobbyClient::Login(bool host_req) char buffer[256]; - sprintf_s(buffer, "host %s rank %d time %d miss %d kill %d loss %d ", + sprintf_s(buffer, "host %s rank %d time %d miss %d kill %d loss %d ", host ? "true" : "false", player->Rank(), player->FlightTime(), @@ -360,8 +360,8 @@ NetLobbyClient::GetServerMods() List& NetLobbyClient::GetUnitMap() { - bool request = selected_mission && - unit_map.size() < 1 && + bool request = selected_mission && + unit_map.size() < 1 && (NetLayer::GetUTC() - unit_req_time > 2); if (selected_mission && GetStatus() == NetServerInfo::ACTIVE && (NetLayer::GetUTC() - unit_req_time > 5)) diff --git a/Stars45/NetLobbyServer.cpp b/Stars45/NetLobbyServer.cpp index c439560..90ee02b 100644 --- a/Stars45/NetLobbyServer.cpp +++ b/Stars45/NetLobbyServer.cpp @@ -206,7 +206,7 @@ NetLobbyServer::LoadMOTD() while (fgets(line, 256, f)) { int n = strlen(line) - 1; - + while (n >= 0 && isspace(line[n])) line[n--] = 0; @@ -301,7 +301,7 @@ NetLobbyServer::ExecFrame() server_mission.length() > 0) { NetCampaignInfo* c = campaigns.last(); - + if (!c || c->name != "Persistent Multiplayer") { c = new(__FILE__,__LINE__) NetCampaignInfo; c->id = Campaign::MULTIPLAYER_MISSIONS; @@ -430,7 +430,7 @@ NetLobbyServer::GameStart() { if (status < NetServerInfo::ACTIVE) { SetStatus(NetServerInfo::BRIEFING); - + if (Starshatter::GetInstance()) { Starshatter::GetInstance()->SetGameMode(Starshatter::PREP_MODE); } @@ -598,7 +598,7 @@ NetLobbyServer::SaveChat() NetChatEntry* c = chat_log[i]; fprintf(f, "%08x [%s] %s\n", c->GetTime(), - c->GetUser().data(), + c->GetUser().data(), c->GetMessage().data()); } @@ -998,7 +998,7 @@ NetLobbyServer::DoLogin(NetPeer* peer, Text msg) // is user already logged in? if (pre_existing) { - if (pre_existing->Pass() == pass && + if (pre_existing->Pass() == pass && pre_existing->GetAddress().IPAddr() == peer->Address().IPAddr()) { } } diff --git a/Stars45/NetPlayer.cpp b/Stars45/NetPlayer.cpp index 5bcfccc..a2ad6f1 100644 --- a/Stars45/NetPlayer.cpp +++ b/Stars45/NetPlayer.cpp @@ -74,7 +74,7 @@ NetPlayer::~NetPlayer() { if (ship) { ship->SetNetworkControl(); - + Sim* sim = Sim::GetSim(); sim->DestroyShip(ship); } @@ -196,7 +196,7 @@ NetPlayer::DoObjHyper(NetObjHyper* obj_hyper) if (fc2_id) fc2 = sim->FindShipByObjID(fc2_id); - sim->CreateExplosion(ship->Location(), Point(0,0,0), + sim->CreateExplosion(ship->Location(), Point(0,0,0), Explosion::QUANTUM_FLASH, 1.0f, 0, ship->GetRegion()); sim->RequestHyperJump(ship, rgn, obj_hyper->GetLocation(), trans, fc1, fc2); diff --git a/Stars45/NetServerConfig.cpp b/Stars45/NetServerConfig.cpp index 0239bab..90b7e0d 100644 --- a/Stars45/NetServerConfig.cpp +++ b/Stars45/NetServerConfig.cpp @@ -157,7 +157,7 @@ NetServerConfig::Load() delete term; term = parser.ParseTerm(); - + if (term) { TermDef* def = term->isDef(); if (def) { @@ -405,7 +405,7 @@ NetServerConfig::LoadBanList() delete term; term = parser.ParseTerm(); - + if (term) { TermDef* def = term->isDef(); if (def) { diff --git a/Stars45/NetServerDlg.cpp b/Stars45/NetServerDlg.cpp index 903b0aa..519f96c 100644 --- a/Stars45/NetServerDlg.cpp +++ b/Stars45/NetServerDlg.cpp @@ -179,7 +179,7 @@ NetServerDlg::OnApply(AWEvent* event) if (edt_admin_pass) config->SetAdminPass(edt_admin_pass->GetText()); - + config->Save(); } diff --git a/Stars45/NetUnitDlg.cpp b/Stars45/NetUnitDlg.cpp index 28b264a..b3f0115 100644 --- a/Stars45/NetUnitDlg.cpp +++ b/Stars45/NetUnitDlg.cpp @@ -196,7 +196,7 @@ NetUnitDlg::ExecFrame() if (lst_players && lst_units && btn_select->IsVisible()) { int sel_unit = lst_units->GetSelection(); - enable = sel_unit >= 0 && + enable = sel_unit >= 0 && lst_units->GetItemText(sel_unit).length() == 0; } @@ -210,7 +210,7 @@ NetUnitDlg::ExecFrame() int sel_play = lst_players->GetSelection(); int sel_unit = lst_units->GetSelection(); - enable = sel_unit >= 0 && sel_play >= 0 && + enable = sel_unit >= 0 && sel_play >= 0 && lst_units->GetItemText(sel_unit).length() == 0; if (enable && !host_mode) { diff --git a/Stars45/Parser.cpp b/Stars45/Parser.cpp index e65059e..cb96f3e 100644 --- a/Stars45/Parser.cpp +++ b/Stars45/Parser.cpp @@ -85,9 +85,9 @@ Parser::ParseTerm() { Term* t = ParseTermBase(); if (t == 0) return t; - + Term* t2 = ParseTermRest(t); - + return t2; } @@ -95,7 +95,7 @@ Term* Parser::ParseTermRest(Term* base) { Token t = lexer->Get(); - + switch (t.type()) { default: lexer->PutBack(); @@ -129,7 +129,7 @@ Parser::ParseTermRest(Term* base) } break; } - + return base; } @@ -160,7 +160,7 @@ Parser::ParseTermBase() Token t = lexer->Get(); int n = 0; double d = 0.0; - + switch (t.type()) { case Token::IntLiteral: { if (dump_tokens) @@ -171,7 +171,7 @@ Parser::ParseTermBase() if (t.symbol()[i] != '_') *p++ = t.symbol()[i]; *p++ = '\0'; - + // handle hex notation: if (nstr[1] == 'x') n = xtol(nstr+2); @@ -191,7 +191,7 @@ Parser::ParseTermBase() if (t.symbol()[i] != '_') *p++ = t.symbol()[i]; *p++ = '\0'; - + d = atof(nstr); return new(__FILE__, __LINE__) TermNumber(d); } @@ -215,7 +215,7 @@ Parser::ParseTermBase() switch (t.key()) { case KEY_FALSE: return new(__FILE__, __LINE__) TermBool(0); case KEY_TRUE: return new(__FILE__, __LINE__) TermBool(1); - + case KEY_MINUS: { Token next = lexer->Get(); if (next.type() == Token::IntLiteral) { @@ -227,7 +227,7 @@ Parser::ParseTermBase() if (next.symbol()[i] != '_') *p++ = next.symbol()[i]; *p++ = '\0'; - + n = -1 * atol(nstr); return new(__FILE__, __LINE__) TermNumber(n); } @@ -240,7 +240,7 @@ Parser::ParseTermBase() if (next.symbol()[i] != '_') *p++ = next.symbol()[i]; *p++ = '\0'; - + d = -1.0 * atof(nstr); return new(__FILE__, __LINE__) TermNumber(d); } @@ -250,7 +250,7 @@ Parser::ParseTermBase() } } break; - + default: lexer->PutBack(); return 0; @@ -297,7 +297,7 @@ TermList* Parser::ParseTermList(int for_struct) { TermList* tlist = new(__FILE__, __LINE__) TermList; - + Term* term = ParseTerm(); while (term) { if (for_struct && !term->isDef()) { @@ -326,7 +326,7 @@ Parser::ParseTermList(int for_struct) term = ParseTerm(); } - + return tlist; } diff --git a/Stars45/Particles.cpp b/Stars45/Particles.cpp index a8efbec..cf83d23 100644 --- a/Stars45/Particles.cpp +++ b/Stars45/Particles.cpp @@ -53,7 +53,7 @@ inline float randf() { return (rand()-16384.0f)/32768.0f; } Particles::Particles(Bitmap* bitmap, int np, const Vec3& base_loc, const Vec3& vel, float bspeed, float dr, float s, float bloom, float dec, float rate, bool cont, bool trail, bool rise, int a, int nframes) -: nparts(np), base_speed(bspeed), max_speed(bspeed*3.0f), +: nparts(np), base_speed(bspeed), max_speed(bspeed*3.0f), drag(dr), min_scale(s), max_scale(bloom), decay(dec), release_rate(rate), continuous(cont), trailing(trail), rising(rise), blend(a), extra(0.0f), point_sprite(0), emitting(true) @@ -200,7 +200,7 @@ void Particles::ExecFrame(double seconds) release[i] = ref_loc; } } - + if (nverts > nparts) nverts = nparts; @@ -249,7 +249,7 @@ Particles::CheckVisibility(Projector& projector) else { visible = false; } - + return visible; } diff --git a/Stars45/Particles.h b/Stars45/Particles.h index 428daa1..0cc0516 100644 --- a/Stars45/Particles.h +++ b/Stars45/Particles.h @@ -49,17 +49,17 @@ class Particles : public Graphic { public: - Particles(Bitmap* bitmap, - int np, - const Vec3& base_loc, + Particles(Bitmap* bitmap, + int np, + const Vec3& base_loc, const Vec3& vel, - float base_speed = 500.0f, + float base_speed = 500.0f, float drag = 1.0f, - float scale = 1.0f, - float bloom = 0.0f, - float decay = 100.0f, - float release = 1.0f, - bool cont = false, + float scale = 1.0f, + float bloom = 0.0f, + float decay = 100.0f, + float release = 1.0f, + bool cont = false, bool trail = true, bool rise = false, int blend = 3, diff --git a/Stars45/Physical.cpp b/Stars45/Physical.cpp index 2bdb967..7350a9e 100644 --- a/Stars45/Physical.cpp +++ b/Stars45/Physical.cpp @@ -368,7 +368,7 @@ Physical::ArcadeFrame(double s) LinearFrame(seconds); // move the position by the (time-frame scaled) velocity: - pos += arcade_velocity * seconds + + pos += arcade_velocity * seconds + velocity * seconds; cam.MoveTo(pos); @@ -398,7 +398,7 @@ Physical::AngularFrame(double seconds) dr += (float) (dr_acc * seconds); dy += (float) (dy_acc * seconds); dp += (float) (dp_acc * seconds); - + dr *= (float) exp(-dr_drg * seconds); dy *= (float) exp(-dy_drg * seconds); dp *= (float) exp(-dp_drg * seconds); diff --git a/Stars45/Player.cpp b/Stars45/Player.cpp index dcbe41b..9546991 100644 --- a/Stars45/Player.cpp +++ b/Stars45/Player.cpp @@ -63,8 +63,8 @@ class AwardInfo public: static const char* TYPENAME() { return "AwardInfo"; } - AwardInfo() : - type(RANK), + AwardInfo() : + type(RANK), id(0), large_insignia(0), small_insignia(0), diff --git a/Stars45/PngImage.cpp b/Stars45/PngImage.cpp index 2afa03e..3f78319 100644 --- a/Stars45/PngImage.cpp +++ b/Stars45/PngImage.cpp @@ -232,7 +232,7 @@ PngImage::CreateImage(png_structp png_ptr, png_infop info_ptr) // paletted: else if (bpp == 8) { DWORD pal[256]; - + png_bytep trans_alpha; int num_trans; png_color_16p trans_color; png_colorp palette; int num_palette; @@ -252,7 +252,7 @@ PngImage::CreateImage(png_structp png_ptr, png_infop info_ptr) if (i < num_trans) alpha = trans_alpha[i]; - + pal[i] = (alpha << 24) | (red << 16) | (green << 8) | blue; } diff --git a/Stars45/Polygon.cpp b/Stars45/Polygon.cpp index 3eefe87..58c6d64 100644 --- a/Stars45/Polygon.cpp +++ b/Stars45/Polygon.cpp @@ -495,7 +495,7 @@ int Poly::Contains(const Vec3& pt) const // +--------------------------------------------------------------------+ Material::Material() - : power(1.0f), brilliance(1.0f), bump(0.0f), blend(MTL_SOLID), + : power(1.0f), brilliance(1.0f), bump(0.0f), blend(MTL_SOLID), shadow(true), luminous(false), tex_diffuse(0), tex_specular(0), tex_bumpmap(0), tex_emissive(0), tex_alternate(0), tex_detail(0), thumbnail(0) @@ -603,7 +603,7 @@ Material::GetShader(int pass) const while (i < NAMELEN && shader[i] != 0 && shader[i] != '/') { *s++ = shader[i++]; } - + return shader_name; } } diff --git a/Stars45/Power.cpp b/Stars45/Power.cpp index 67e30db..b382012 100644 --- a/Stars45/Power.cpp +++ b/Stars45/Power.cpp @@ -170,7 +170,7 @@ PowerSource::ExecFrame(double seconds) ListIter iter = clients; while (++iter) { System* sink = iter.value(); - + if (sink->IsPowerOn()) { double joules = sink->GetRequest(seconds); @@ -199,7 +199,7 @@ PowerSource::ExecFrame(double seconds) // enough to go around: if (energy_requested <= energy_avail) { iter.reset(); - + while (++iter) { System* sink = iter.value(); @@ -216,14 +216,14 @@ PowerSource::ExecFrame(double seconds) iter.reset(); while (++iter) { System* sink = iter.value(); - + if (sink->IsPowerOn() && !sink->IsPowerCritical()) { double request = sink->GetRequest(seconds); double delivery = 0; if (request > 0) delivery = energy_avail * (request/energy_requested); - + if (delivery > 0) { total_distrib += delivery; sink->Distribute(delivery, seconds); @@ -245,7 +245,7 @@ PowerSource::ExecFrame(double seconds) // expend fuel: if (total_distrib > 0) { double effective_fuel_ratio = fuel_ratio; - + switch (Ship::GetFlightModel()) { default: case Ship::FM_STANDARD: diff --git a/Stars45/QuantumFlash.cpp b/Stars45/QuantumFlash.cpp index 6af2b68..7945956 100644 --- a/Stars45/QuantumFlash.cpp +++ b/Stars45/QuantumFlash.cpp @@ -155,7 +155,7 @@ QuantumFlash::UpdateVerts(const Point& cam_pos) for (int i = 0; i < npolys; i++) { Matrix& m = beams[i]; - + m.Yaw(0.05); Point vpn = Point(m(2,0), m(2,1), m(2,2)); diff --git a/Stars45/QuantumView.cpp b/Stars45/QuantumView.cpp index d72a18d..eedd0e7 100644 --- a/Stars45/QuantumView.cpp +++ b/Stars45/QuantumView.cpp @@ -313,7 +313,7 @@ QuantumView::GetQuantumMenu(Ship* s) SimRegion* rgn = iter.value(); StarSystem* rgn_system = rgn->System(); - if (rgn != ship->GetRegion() && rgn->Type() != SimRegion::AIR_SPACE && + if (rgn != ship->GetRegion() && rgn->Type() != SimRegion::AIR_SPACE && rgn_system != current_system && current_region->Links().contains(rgn)) { rgn_list.append(rgn); } diff --git a/Stars45/QuantumView.h b/Stars45/QuantumView.h index f342ba3..63f8f9a 100644 --- a/Stars45/QuantumView.h +++ b/Stars45/QuantumView.h @@ -55,7 +55,7 @@ class Font; // +--------------------------------------------------------------------+ -class QuantumView : public View, +class QuantumView : public View, public SimObserver { public: diff --git a/Stars45/QuitView.cpp b/Stars45/QuitView.cpp index a553727..a3362aa 100644 --- a/Stars45/QuitView.cpp +++ b/Stars45/QuitView.cpp @@ -136,13 +136,13 @@ QuitView::Refresh() clip_rect.w = w2 * 2; clip_rect.h = h2 * 2; - window->ClipBitmap(xcenter - w2, - ycenter - h2, - xcenter - w2 + menu_bmp->Width(), + window->ClipBitmap(xcenter - w2, + ycenter - h2, + xcenter - w2 + menu_bmp->Width(), ycenter - h2 + menu_bmp->Height(), - menu_bmp, - Color::White, - Video::BLEND_SOLID, + menu_bmp, + Color::White, + Video::BLEND_SOLID, clip_rect); } } diff --git a/Stars45/RadioHandler.cpp b/Stars45/RadioHandler.cpp index 7e3ede6..3b81023 100644 --- a/Stars45/RadioHandler.cpp +++ b/Stars45/RadioHandler.cpp @@ -212,7 +212,7 @@ RadioHandler::ProcessMessageOrders(RadioMessage* msg, Ship* ship) // farcast and quantum jump radio messages: if (action >= RadioMessage::QUANTUM_TO) { Sim* sim = Sim::GetSim(); - + if (sim) { SimRegion* rgn = sim->FindRegion(msg->Info()); @@ -532,8 +532,8 @@ RadioHandler::Support(RadioMessage* msg, Ship* ship) if (e && s->IsDropship() && e->Type() == Mission::PATROL && - e != baby && - cmdr->CanCommand(e) && + e != baby && + cmdr->CanCommand(e) && s->GetRadioOrders()->Action() == RadioMessage::NONE) { help = e; break; diff --git a/Stars45/RadioMessage.h b/Stars45/RadioMessage.h index 545cec4..b3285f0 100644 --- a/Stars45/RadioMessage.h +++ b/Stars45/RadioMessage.h @@ -57,7 +57,7 @@ class SimObject; class RadioMessage { public: - enum ACTION + enum ACTION { NONE = 0, diff --git a/Stars45/RadioTraffic.cpp b/Stars45/RadioTraffic.cpp index 9452d5d..ae38c0b 100644 --- a/Stars45/RadioTraffic.cpp +++ b/Stars45/RadioTraffic.cpp @@ -312,7 +312,7 @@ RadioTraffic::DisplayMessage(RadioMessage* msg) dst_buf[0] = 0; if (msg->Info().length()) { - sprintf_s(msg_buf, "%s. %s", + sprintf_s(msg_buf, "%s. %s", TranslateVox(act_buf).data(), (const char*) msg->Info()); } @@ -322,7 +322,7 @@ RadioTraffic::DisplayMessage(RadioMessage* msg) } else { if (msg->Info().length()) { - sprintf_s(msg_buf, "%s. %s", + sprintf_s(msg_buf, "%s. %s", TranslateVox(act_buf).data(), (const char*) msg->Info()); } @@ -344,20 +344,20 @@ RadioTraffic::DisplayMessage(RadioMessage* msg) } else { - sprintf_s(msg_buf, "%s %s.", + sprintf_s(msg_buf, "%s %s.", TranslateVox(act_buf).data(), target->Name()); } } else if (target) { - sprintf_s(msg_buf, "%s %s.", + sprintf_s(msg_buf, "%s %s.", TranslateVox(act_buf).data(), target->Name()); } else if (msg->Info().length()) { - sprintf_s(msg_buf, "%s %s", + sprintf_s(msg_buf, "%s %s", TranslateVox(act_buf).data(), (const char*) msg->Info()); } diff --git a/Stars45/RadioView.cpp b/Stars45/RadioView.cpp index a554456..f5905fe 100644 --- a/Stars45/RadioView.cpp +++ b/Stars45/RadioView.cpp @@ -282,7 +282,7 @@ RadioView::Refresh() ListIter item = menu->GetItems(); while (++item) { - if (ship->GetEMCON() < 2 || + if (ship->GetEMCON() < 2 || (TargetRequired(item.value()) && !ship->GetTarget()) || item->GetText().contains("KIA")) { item->SetEnabled(false); @@ -607,7 +607,7 @@ RadioView::GetRadioMenu(Ship* s) if (num_pages > 1) { char text[64]; sprintf_s(text, Game::GetText("RadioView.item.next-page").data(), starship_page + 1, num_pages); - starship_menu->AddItem(text); + starship_menu->AddItem(text); } return starship_menu; diff --git a/Stars45/RadioView.h b/Stars45/RadioView.h index 5e38fac..34dd25a 100644 --- a/Stars45/RadioView.h +++ b/Stars45/RadioView.h @@ -58,7 +58,7 @@ class MenuItem; // +--------------------------------------------------------------------+ -class RadioView : public View, +class RadioView : public View, public SimObserver { public: diff --git a/Stars45/Reader.cpp b/Stars45/Reader.cpp index 1dd58e5..bd652b3 100644 --- a/Stars45/Reader.cpp +++ b/Stars45/Reader.cpp @@ -93,7 +93,7 @@ FileReader::more() Text result; char buf[1000], newline; - + while (fin.get(buf, 1000)) { result.append(buf); fin.get(newline); @@ -101,7 +101,7 @@ FileReader::more() } done = 1; - return result; + return result; } // +-------------------------------------------------------------------+ @@ -122,12 +122,12 @@ BlockReader::more() if (length) { Text result(data, length); done = 1; - return result; + return result; } else if (data) { Text result(data); done = 1; - return result; + return result; } done = 1; diff --git a/Stars45/Reader.h b/Stars45/Reader.h index 1cb9414..4b2ed5b 100644 --- a/Stars45/Reader.h +++ b/Stars45/Reader.h @@ -56,10 +56,10 @@ class ConsoleReader : public Reader { public: virtual Text more(); - + void printPrimaryPrompt(); void fillInputBuffer(); - + private: char buffer[1000]; char* p; @@ -70,7 +70,7 @@ class FileReader : public Reader public: FileReader(const char* fname); virtual Text more(); - + private: Text filename; int done; diff --git a/Stars45/RichTextBox.cpp b/Stars45/RichTextBox.cpp index d45a74e..a4fd31b 100644 --- a/Stars45/RichTextBox.cpp +++ b/Stars45/RichTextBox.cpp @@ -124,9 +124,9 @@ RichTextBox::DrawTabbedText() int RichTextBox::find_next_word_start(const char* text, int index) { // step through intra-word space: - while (text[index] && isspace(text[index]) && - (text[index] != '\t') && - (text[index] != '\n') && + while (text[index] && isspace(text[index]) && + (text[index] != '\t') && + (text[index] != '\n') && (text[index] != '<')) index++; @@ -144,8 +144,8 @@ int RichTextBox::find_next_word_end(const char* text, int index) index++; // step through word: - while (text[index] && !isspace(text[index]) && - (text[index] != '-') && + while (text[index] && !isspace(text[index]) && + (text[index] != '-') && (text[index] != '<')) index++; diff --git a/Stars45/Scene.cpp b/Stars45/Scene.cpp index b9b3167..556f04e 100644 --- a/Stars45/Scene.cpp +++ b/Stars45/Scene.cpp @@ -49,7 +49,7 @@ Scene::Scene() { } Scene::~Scene() -{ +{ background.destroy(); foreground.destroy(); graphics.destroy(); @@ -62,10 +62,10 @@ Scene::~Scene() void Scene::AddBackground(Graphic* g) -{ +{ if (g) { if (!background.contains(g)) - background.append(g); + background.append(g); g->SetScene(this); } @@ -84,10 +84,10 @@ Scene::DelBackground(Graphic* g) void Scene::AddForeground(Graphic* g) -{ +{ if (g) { if (!foreground.contains(g)) - foreground.append(g); + foreground.append(g); g->SetScene(this); } @@ -106,10 +106,10 @@ Scene::DelForeground(Graphic* g) void Scene::AddGraphic(Graphic* g) -{ +{ if (g) { if (!graphics.contains(g)) - graphics.append(g); + graphics.append(g); g->SetScene(this); } @@ -132,10 +132,10 @@ Scene::DelGraphic(Graphic* g) void Scene::AddSprite(Graphic* g) -{ +{ if (g) { if (!sprites.contains(g)) - sprites.append(g); + sprites.append(g); g->SetScene(this); } @@ -183,7 +183,7 @@ Scene::Collect() if (g->Life() == 0) { delete iter.removeItem(); } - } + } iter.attach(sprites); @@ -192,7 +192,7 @@ Scene::Collect() if (g->Life() == 0) { delete iter.removeItem(); } - } + } ListIter iter1 = lights; @@ -201,7 +201,7 @@ Scene::Collect() if (l->Life() == 0) { delete iter1.removeItem(); } - } + } } diff --git a/Stars45/Screen.cpp b/Stars45/Screen.cpp index 8361216..04ebbc8 100644 --- a/Stars45/Screen.cpp +++ b/Stars45/Screen.cpp @@ -101,7 +101,7 @@ Screen::ClearAllFrames(bool clear_all) clear = -1; else clear = 0; -} +} void Screen::ClearNextFrames(int num_frames) @@ -167,7 +167,7 @@ Screen::Refresh() ListIter iter = window_list; while (++iter) { Window* win = iter.value(); - + if (win->IsShown()) { win->Paint(); } diff --git a/Stars45/SeekerAI.cpp b/Stars45/SeekerAI.cpp index 86f0691..9983bad 100644 --- a/Stars45/SeekerAI.cpp +++ b/Stars45/SeekerAI.cpp @@ -209,8 +209,8 @@ SeekerAI::CheckDecoys(double target_distance) return; } - if (target && - target == orig_target && + if (target && + target == orig_target && orig_target->GetActiveDecoys().size()) { ListIter decoy = orig_target->GetActiveDecoys(); diff --git a/Stars45/Sensor.cpp b/Stars45/Sensor.cpp index 165d80c..9c90818 100644 --- a/Stars45/Sensor.cpp +++ b/Stars45/Sensor.cpp @@ -74,7 +74,7 @@ nsettings(0), range_index(0) // +----------------------------------------------------------------------+ Sensor::Sensor(const Sensor& s) -: System(s), mode(STD), target(0), +: System(s), mode(STD), target(0), nsettings(s.nsettings), range_index(0) { Mount(s); @@ -162,7 +162,7 @@ Sensor::SetMode(Mode m) if (m <= GM) { if (ship) ship->DropTarget(); - + Ignore(target); target = 0; } @@ -427,7 +427,7 @@ Sensor::ProcessContact(Ship* c_ship, double az1, double az2) double max_range = probe->Design()->lethal_radius; d_act = c_ship->ACS() * (1 - min_range/max_range); } - + else if (mode != PAS && mode != PST) { double max_range = sensor_range; d_act = c_ship->ACS() * effectivity * (1 - min_range/max_range); diff --git a/Stars45/Sha1.cpp b/Stars45/Sha1.cpp index 7bbfd77..7e3de70 100644 --- a/Stars45/Sha1.cpp +++ b/Stars45/Sha1.cpp @@ -40,7 +40,7 @@ #include "Sha1.h" -/* +/* * SHA1 * * Description: @@ -60,7 +60,7 @@ SHA1::SHA1() Reset(); } -/* +/* * ~SHA1 * * Description: @@ -80,7 +80,7 @@ SHA1::~SHA1() // The destructor does nothing } -/* +/* * Reset * * Description: @@ -112,7 +112,7 @@ void SHA1::Reset() Corrupted = false; } -/* +/* * Result * * Description: @@ -153,7 +153,7 @@ bool SHA1::Result(unsigned *message_digest_array) return true; } -/* +/* * Input * * Description: @@ -210,7 +210,7 @@ unsigned length) } } -/* +/* * Input * * Description: @@ -236,7 +236,7 @@ unsigned length) Input((unsigned char *) message_array, length); } -/* +/* * Input * * Description: @@ -257,7 +257,7 @@ void SHA1::Input(unsigned char message_element) Input(&message_element, 1); } -/* +/* * Input * * Description: @@ -278,7 +278,7 @@ void SHA1::Input(char message_element) Input((unsigned char *) &message_element, 1); } -/* +/* * operator<< * * Description: @@ -309,7 +309,7 @@ SHA1& SHA1::operator<<(const char *message_array) return *this; } -/* +/* * operator<< * * Description: @@ -340,7 +340,7 @@ SHA1& SHA1::operator<<(const unsigned char *message_array) return *this; } -/* +/* * operator<< * * Description: @@ -364,7 +364,7 @@ SHA1& SHA1::operator<<(const char message_element) return *this; } -/* +/* * operator<< * * Description: @@ -388,7 +388,7 @@ SHA1& SHA1::operator<<(const unsigned char message_element) return *this; } -/* +/* * ProcessMessageBlock * * Description: @@ -496,7 +496,7 @@ void SHA1::ProcessMessageBlock() Message_Block_Index = 0; } -/* +/* * PadMessage * * Description: @@ -565,7 +565,7 @@ void SHA1::PadMessage() } -/* +/* * CircularShift * * Description: diff --git a/Stars45/Sha1.h b/Stars45/Sha1.h index 8b042cb..ec64462 100644 --- a/Stars45/Sha1.h +++ b/Stars45/Sha1.h @@ -83,7 +83,7 @@ private: bool Computed; // Is the digest computed? bool Corrupted; // Is the message digest corruped? - + }; #endif diff --git a/Stars45/Shadow.cpp b/Stars45/Shadow.cpp index 0954307..0005d22 100644 --- a/Stars45/Shadow.cpp +++ b/Stars45/Shadow.cpp @@ -118,7 +118,7 @@ Shadow::Update(Light* light) lpos.z = tmp * Vec3(xform(2,0), xform(2,1), xform(2,2)); // compute the silohuette for the mesh with respect to the light: - + for (int i = 0; i < s->NumPolys(); i++) { Poly* p = s->GetPolys() + i; diff --git a/Stars45/Ship.cpp b/Stars45/Ship.cpp index bd03c55..31157b3 100644 --- a/Stars45/Ship.cpp +++ b/Stars45/Ship.cpp @@ -262,7 +262,7 @@ Ship::Ship(const char* ship_name, const char* reg_num, ShipDesign* ship_dsn, int shieldRep = new(__FILE__,__LINE__) ShieldRep; shieldRep->UseModel(design->shield_model); } - + systems.append(shield); } @@ -1243,7 +1243,7 @@ Ship::NumContacts() const { // cast-away const: return ((Ship*)this)->ContactList().size(); -} +} List& Ship::ContactList() @@ -1552,8 +1552,8 @@ Ship::HitBy(Shot* shot, Point& impact) if (hit_type) { if (shot->Damage() > 0) { DWORD flash = Explosion::HULL_FLASH; - - if ((hit_type & HIT_SHIELD) != 0) + + if ((hit_type & HIT_SHIELD) != 0) flash = Explosion::SHIELD_FLASH; sim->CreateExplosion(impact, Velocity(), flash, 0.3f * scale, scale, region); @@ -1570,7 +1570,7 @@ Ship::HitBy(Shot* shot, Point& impact) if (dlen < (damage_radius + Radius())) { if (seeker && seeker->Overshot()) { dscale = 1.0 - (dlen / (damage_radius + Radius())); - + if (dscale > 1) dscale = 1; @@ -1917,7 +1917,7 @@ Ship::SetNetSystemStatus(System* system, int status, int power, int reactor, dou if (c->Status() < Component::NOMINAL && c->Availability() < 75) { if (c->SpareCount() && c->ReplaceTime() <= 300 && - (c->Availability() < 50 || + (c->Availability() < 50 || c->ReplaceTime() < c->RepairTime())) { c->Replace(); @@ -2144,7 +2144,7 @@ Ship::CommandMode() if (!dir || dir->Type() != ShipCtrl::DIR_TYPE) { const char* msg = "Captain on the bridge"; RadioVox* vox = new(__FILE__,__LINE__) RadioVox(0, "1", msg); - + if (vox) { vox->AddPhrase(msg); @@ -2160,7 +2160,7 @@ Ship::CommandMode() else { const char* msg = "Exec, you have the conn"; RadioVox* vox = new(__FILE__,__LINE__) RadioVox(0, "1", msg); - + if (vox) { vox->AddPhrase(msg); @@ -2226,7 +2226,7 @@ Ship::SetNavptStatus(Instruction* navpt, int status) } navpt->SetStatus(status); - + if (status == Instruction::COMPLETE) sim->ProcessEventTrigger(MissionEvent::TRIGGER_NAVPT, 0, Name(), GetNavIndex(navpt)); @@ -2400,7 +2400,7 @@ Ship::ExecFrame(double seconds) return; } - if (flight_phase == LAUNCH || + if (flight_phase == LAUNCH || (flight_phase == TAKEOFF && AltitudeAGL() > Radius())) { SetFlightPhase(ACTIVE); } @@ -2546,7 +2546,7 @@ Ship::ExecSensors(double seconds) if (sensor) sensor->ExecFrame(seconds); - // can we still see our target? + // can we still see our target? if (target) { int target_found = 0; ListIter c_iter = ContactList(); @@ -2565,7 +2565,7 @@ Ship::ExecSensors(double seconds) if (!target_found) DropTarget(); - } + } } // +--------------------------------------------------------------------+ @@ -2580,7 +2580,7 @@ Ship::ExecNavFrame(double seconds) if (navsys) { navsys->ExecFrame(seconds); - + if (navsys->AutoNavEngaged()) { if (dir && dir->Type() == NavAI::DIR_TYPE) { NavAI* navai = (NavAI*) dir; @@ -2603,21 +2603,21 @@ Ship::ExecNavFrame(double seconds) if (navpt && !auto_pilot) { if (navpt->Region() == GetRegion()) { double distance = 0; - + Point npt = navpt->Location(); if (navpt->Region()) npt += navpt->Region()->Location(); - + Sim* sim = Sim::GetSim(); if (sim->GetActiveRegion()) npt -= sim->GetActiveRegion()->Location(); npt = npt.OtherHand(); - + // distance from self to navpt: distance = Point(npt - Location()).length(); - + if (distance < 10 * Radius()) SetNavptStatus(navpt, Instruction::COMPLETE); } @@ -2788,7 +2788,7 @@ Ship::ExecSystems(double seconds) CycleSecondary(); - // do not winchester-cycle to an A2G missile type, + // do not winchester-cycle to an A2G missile type, // or a missile that is also out of ammo, // keep going! @@ -2831,9 +2831,9 @@ Ship::ExecSystems(double seconds) if (cockpit) { Solid* solid = (Solid*) rep; - Point cpos = cam.Pos() + + Point cpos = cam.Pos() + cam.vrt() * bridge_vec.x + - cam.vpn() * bridge_vec.y + + cam.vpn() * bridge_vec.y + cam.vup() * bridge_vec.z; cockpit->MoveTo(cpos); @@ -3033,9 +3033,9 @@ Ship::DockFrame(double seconds) if (cockpit && !cockpit->Hidden()) { Solid* solid = (Solid*) rep; - Point cpos = cam.Pos() + + Point cpos = cam.Pos() + cam.vrt() * bridge_vec.x + - cam.vpn() * bridge_vec.y + + cam.vpn() * bridge_vec.y + cam.vup() * bridge_vec.z; cockpit->MoveTo(cpos); @@ -3231,7 +3231,7 @@ Ship::SelectDetail(double seconds) scene->DelGraphic(g); } } - + // switch to new rep: detail_level = new_level; rep = detail.GetRep(detail_level); @@ -3410,7 +3410,7 @@ Ship::EnableShadows(bool enable) { for (int i = 0; i < detail.NumModels(detail_level); i++) { Graphic* g = detail.GetRep(detail_level, i); - + if (g->IsSolid()) { Solid* s = (Solid*) g; @@ -3614,7 +3614,7 @@ Ship::TimeSkip() transition_type = TRANSITION_TIME_SKIP; transition_loc = Location() + Heading() * (Velocity().length() * 4); // 2500; //(8*Radius()); - + if (rand() < 16000) transition_loc += BeamLine() * (2.5*Radius()); else @@ -4390,7 +4390,7 @@ Ship::GetPrimaryDesign() const { if (weapons.size() > primary) return (WeaponDesign*) weapons[primary]->GetSelected()->Design(); - return 0; + return 0; } WeaponDesign* @@ -4398,7 +4398,7 @@ Ship::GetSecondaryDesign() const { if (weapons.size() > secondary) return (WeaponDesign*) weapons[secondary]->GetSelected()->Design(); - return 0; + return 0; } Weapon* @@ -4407,13 +4407,13 @@ Ship::GetDecoy() const return decoy; } -List& +List& Ship::GetActiveDecoys() { return decoy_list; } -List& +List& Ship::GetThreatList() { return threat_list; @@ -4681,7 +4681,7 @@ Ship::InflictSystemDamage(double damage, Shot* shot, Point impact) } } } - } + } // if a system was in range of the blast, assess the damage: if (system) { @@ -4836,7 +4836,7 @@ Ship::ExecMaintFrame(double seconds) const DWORD REPAIR_FREQUENCY = 5000; // once every five seconds static DWORD last_repair_frame = 0; // one ship per game frame - if (auto_repair && + if (auto_repair && Game::GameTime() - last_repair_time > REPAIR_FREQUENCY && last_repair_frame != Game::Frame()) { @@ -4859,7 +4859,7 @@ Ship::ExecMaintFrame(double seconds) PowerSource* pwr = reactors[i]; if (pwr != src && pwr->Availability() > src->Availability()) { - if (!dst || + if (!dst || (pwr->Availability() > dst->Availability() && pwr->Charge() > dst->Charge())) dst = pwr; @@ -4882,7 +4882,7 @@ Ship::ExecMaintFrame(double seconds) if (c->Status() < Component::NOMINAL && c->Availability() < 75) { if (c->SpareCount() && c->ReplaceTime() <= 300 && - (c->Availability() < 50 || + (c->Availability() < 50 || c->ReplaceTime() < c->RepairTime())) { c->Replace(); @@ -4915,7 +4915,7 @@ Ship::ExecMaintFrame(double seconds) iter.removeItem(); // emergency power routing (restore): - if (sys->Type() == System::POWER_SOURCE && + if (sys->Type() == System::POWER_SOURCE && sys->Status() == System::NOMINAL) { PowerSource* src = (PowerSource*) sys; int isrc = reactors.index(src); @@ -5028,7 +5028,7 @@ Ship::SetControls(MotionController* m) dir = nav; return; } - + else if (!nav->Complete()) { return; } @@ -5098,7 +5098,7 @@ Ship::IFFColor(int iff) break; } - return c; + return c; } Color diff --git a/Stars45/Ship.h b/Stars45/Ship.h index 8aebf03..ef8d592 100644 --- a/Stars45/Ship.h +++ b/Stars45/Ship.h @@ -129,13 +129,13 @@ public: SPACE_UNITS = 0x000f0000, GROUND_UNITS = 0xfff00000 }; - + enum OP_MODE { DOCKED, ALERT, LOCKED, LAUNCH, TAKEOFF, ACTIVE, APPROACH, RECOVERY, DOCKING }; enum FLCS_MODE { FLCS_MANUAL, FLCS_AUTO, FLCS_HELM }; enum TRAN_TYPE { TRANSITION_NONE, TRANSITION_DROP_CAM, TRANSITION_DROP_ORBIT, - TRANSITION_MAKE_ORBIT, + TRANSITION_MAKE_ORBIT, TRANSITION_TIME_SKIP, TRANSITION_DEATH_SPIRAL, TRANSITION_DEAD }; @@ -322,7 +322,7 @@ public: Shot* shot = 0, int hit_type = 3, Point hull_impact = Point(0,0,0)); - + virtual double InflictSystemDamage(double damage, Shot* shot, Point impact); virtual void InflictNetDamage(double damage, Shot* shot=0); diff --git a/Stars45/ShipAI.cpp b/Stars45/ShipAI.cpp index 0a7173e..c6362d3 100644 --- a/Stars45/ShipAI.cpp +++ b/Stars45/ShipAI.cpp @@ -103,7 +103,7 @@ ShipAI::ShipAI(SimObject* s) // +--------------------------------------------------------------------+ ShipAI::~ShipAI() -{ +{ delete tactical; } @@ -322,7 +322,7 @@ ShipAI::ExecFrame(double secs) engaged_ship_id = 0; /*** - *** XXX + *** XXX *** Not the right place to make this decision. *** *** There is a brief wait between killing a target and @@ -517,7 +517,7 @@ ShipAI::FindObjectiveTarget(SimObject* tgt) if (time < 15) { Point run_vec = tgt->Velocity(); obj_w = tgt->Location() + (run_vec * time); - + if (time < 10) obj_w += (tgt->Acceleration() * 0.33 * time * time); @@ -597,8 +597,8 @@ ShipAI::FindObjectiveNavPoint() navpt->SetRegion(nav_rgn); } - bool use_farcaster = self_rgn != nav_rgn && - (navpt->Farcast() || + bool use_farcaster = self_rgn != nav_rgn && + (navpt->Farcast() || !qdrive || !qdrive->IsPowerOn() || qdrive->Status() < System::DEGRADED @@ -654,8 +654,8 @@ ShipAI::FindObjectiveQuantum() if (!self_rgn || !nav_rgn) return; - bool use_farcaster = self_rgn != nav_rgn && - (orders->Farcast() || + bool use_farcaster = self_rgn != nav_rgn && + (orders->Farcast() || !qdrive || !qdrive->IsPowerOn() || qdrive->Status() < System::DEGRADED @@ -822,8 +822,8 @@ ShipAI::FindObjectiveFormation() navpt->SetRegion(nav_rgn); } - bool use_farcaster = self_rgn != nav_rgn && - (navpt->Farcast() || + bool use_farcaster = self_rgn != nav_rgn && + (navpt->Farcast() || !qdrive || !qdrive->IsPowerOn() || qdrive->Status() < System::DEGRADED @@ -910,7 +910,7 @@ ShipAI::Navigator() magnitude = 0; hold = false; - if ((ship->GetElement() && ship->GetElement()->GetHoldTime() > 0) || + if ((ship->GetElement() && ship->GetElement()->GetHoldTime() > 0) || (navpt && navpt->Status() == Instruction::COMPLETE && navpt->HoldTime() > 0)) hold = true; @@ -921,7 +921,7 @@ ShipAI::Navigator() else if (rumor) ship->SetDirectorInfo(Game::GetText("ai.seek-rumor")); else - ship->SetDirectorInfo(Game::GetText("ai.none")); + ship->SetDirectorInfo(Game::GetText("ai.none")); Accumulate(AvoidCollision()); Accumulate(AvoidTerrain()); @@ -1319,7 +1319,7 @@ ShipAI::SeekTarget() if (distance < 2000) { result.brake = 1; } - + return result; } diff --git a/Stars45/ShipCtrl.cpp b/Stars45/ShipCtrl.cpp index 64a310b..edd061c 100644 --- a/Stars45/ShipCtrl.cpp +++ b/Stars45/ShipCtrl.cpp @@ -141,7 +141,7 @@ ShipCtrl::ExecFrame(double seconds) if (throttle_active) { ship->SetThrottle(controller->Throttle() * 100); - if (controller->Throttle() >= 0.99) + if (controller->Throttle() >= 0.99) augmenter = true; } else if (!launch_latch || controller->Throttle() > 0.5) { @@ -163,7 +163,7 @@ ShipCtrl::ExecFrame(double seconds) ship->SetThrottle(ship->Throttle() + DELTA_THROTTLE); time_til_change = 0.05; } - + else if (KeyDown(KEY_THROTTLE_DOWN)) { ship->SetThrottle(ship->Throttle() - DELTA_THROTTLE); time_til_change = 0.05; diff --git a/Stars45/ShipDesign.cpp b/Stars45/ShipDesign.cpp index 9602609..9f67772 100644 --- a/Stars45/ShipDesign.cpp +++ b/Stars45/ShipDesign.cpp @@ -314,7 +314,7 @@ bolt_hit_sound_resource(0), beam_hit_sound_resource(0), lod_levels(0) delete term; term = parser.ParseTerm(); - + if (term) { TermDef* def = term->isDef(); if (def) { @@ -517,7 +517,7 @@ void AddModCatalogEntry(const char* design_name, const char* design_path) if (design_path && *design_path) { Text full_path = "Mods/Ships/"; full_path += design_path; - + if (e->path != full_path) continue; } @@ -575,7 +575,7 @@ void AddModCatalogEntry(const char* design_name, const char* design_path) delete term; term = parser.ParseTerm(); - + if (term) { TermDef* def = term->isDef(); if (def) { @@ -716,7 +716,7 @@ ShipDesign::LoadCatalog(const char* path, const char* fname, bool mod) Text name, type, fname, path; bool hide = false; - + if (term) { TermDef* def = term->isDef(); if (def && def->term() && def->term()->isStruct()) { @@ -816,7 +816,7 @@ ShipDesign::LoadSkins(const char* path, const char* archive) delete term; term = parser.ParseTerm(); - + if (term) { TermDef* def = term->isDef(); if (def) { @@ -950,7 +950,7 @@ ShipDesign::Get(const char* design_name, const char* design_path) if (design_path && *design_path) { Text full_path = "Mods/Ships/"; full_path += design_path; - + if (e->path != full_path) continue; } @@ -996,8 +996,8 @@ ShipDesign::FindModDesign(const char* design_name, const char* design_path) Print("ShipDesign: found mod design '%s'\n", design->name); ShipCatalogEntry* entry = new(__FILE__,__LINE__) ShipCatalogEntry(design->name, - ClassName(design->type), - path, + ClassName(design->type), + path, file); mod_catalog.append(entry); entry->design = design; @@ -1075,7 +1075,7 @@ ShipDesign::ClassForName(const char* name) if (!name || !name[0]) return 0; - for (int i = 0; i < 32; i++) { + for (int i = 0; i < 32; i++) { if (!_stricmp(name, ship_design_class_name[i])) { return 1 << i; } @@ -1568,7 +1568,7 @@ ShipDesign::ParsePower(TermStruct* val) if (defname == "type") { TermText* tname = pdef->term()->isText(); - + if (tname) { if (tname->value()[0] == 'B') stype = PowerSource::BATTERY; else if (tname->value()[0] == 'A') stype = PowerSource::AUX; @@ -1764,13 +1764,13 @@ ShipDesign::ParseDrive(TermStruct* val) drive->AddPort(port, flare_scale); } - + else if (defname == "loc") { if (!GetDefVec(loc, pdef, filename)) Print("WARNING: invalid or missing loc for drive in '%s'\n", filename); loc *= (float) scale; } - + else if (defname == "size") { if (!GetDefNumber(size, pdef, filename)) Print("WARNING: invalid or missing size for drive in '%s'\n", filename); @@ -2546,7 +2546,7 @@ ShipDesign::ParseLandingGear(TermStruct* val) } } } - + if (ngear < LandingGear::MAX_GEAR) { Model* m = new(__FILE__,__LINE__) Model; if (!m->Load(mod_name, scale)) { diff --git a/Stars45/ShipKiller.cpp b/Stars45/ShipKiller.cpp index 1dd7588..9e3c2a6 100644 --- a/Stars45/ShipKiller.cpp +++ b/Stars45/ShipKiller.cpp @@ -139,11 +139,11 @@ ShipKiller::BeginDeathSpiral() if (design->explosion[exp_index].type > 0) { Point exp_loc = ship->Location() + (design->explosion[exp_index].loc * ship->Cam().Orientation()); sim->CreateExplosion(exp_loc, - ship->Velocity(), - design->explosion[exp_index].type, - (float) ship->Radius(), - exp_scale, - ship->GetRegion(), + ship->Velocity(), + design->explosion[exp_index].type, + (float) ship->Radius(), + exp_scale, + ship->GetRegion(), ship); } } @@ -177,11 +177,11 @@ ShipKiller::ExecFrame(double seconds) if (design->explosion[exp_index].type > 0) { Point exp_loc = ship->Location() + (design->explosion[exp_index].loc * ship->Cam().Orientation()); sim->CreateExplosion(exp_loc, - ship->Velocity(), - design->explosion[exp_index].type, - (float) ship->Radius(), - exp_scale, - ship->GetRegion(), + ship->Velocity(), + design->explosion[exp_index].type, + (float) ship->Radius(), + exp_scale, + ship->GetRegion(), ship); } } @@ -191,10 +191,10 @@ ShipKiller::ExecFrame(double seconds) if (design->explosion[i].final) { Point exp_loc = ship->Location() + (design->explosion[i].loc * ship->Cam().Orientation()); sim->CreateExplosion(exp_loc, - ship->Velocity(), - design->explosion[i].type, - (float) ship->Radius(), - exp_scale, + ship->Velocity(), + design->explosion[i].type, + (float) ship->Radius(), + exp_scale, ship->GetRegion()); } } @@ -212,7 +212,7 @@ ShipKiller::ExecFrame(double seconds) if (ship->IsGroundUnit()) { debris_vel *= 2; - + if (debris_vel.y < 0) debris_vel.y *= -1; } @@ -240,27 +240,27 @@ ShipKiller::ExecFrame(double seconds) if (design->debris[i].fire_type > 0) { sim->CreateExplosion(fire_loc, - ship->Velocity(), - design->debris[i].fire_type, + ship->Velocity(), + design->debris[i].fire_type, + exp_scale, exp_scale, - exp_scale, ship->GetRegion(), debris); } else { sim->CreateExplosion(fire_loc, - ship->Velocity(), - Explosion::SMALL_FIRE, + ship->Velocity(), + Explosion::SMALL_FIRE, + exp_scale, exp_scale, - exp_scale, ship->GetRegion(), debris); sim->CreateExplosion(fire_loc, - ship->Velocity(), - Explosion::SMOKE_TRAIL, + ship->Velocity(), + Explosion::SMOKE_TRAIL, + exp_scale * 0.25f, exp_scale * 0.25f, - exp_scale * 0.25f, ship->GetRegion(), debris); } diff --git a/Stars45/Shot.cpp b/Stars45/Shot.cpp index 09caf98..29d193b 100644 --- a/Stars45/Shot.cpp +++ b/Stars45/Shot.cpp @@ -98,7 +98,7 @@ charge(1.0f), design(dsn), offset(1.0e5f), altitude_agl(-1.0e6f), hit_target(fal case Graphic::SPRITE: { Sprite* s = 0; - + if (design->animation) s = new(__FILE__,__LINE__) DriveSprite(design->animation, design->anim_length); else @@ -415,7 +415,7 @@ Shot::ExecFrame(double seconds) thrust = design->thrust; } - first_frame = 0; + first_frame = 0; if (flare) flare->MoveTo(Location()); @@ -552,7 +552,7 @@ Shot::Length() const return design->length; return 500; -} +} // +--------------------------------------------------------------------+ diff --git a/Stars45/Sim.cpp b/Stars45/Sim.cpp index 01fbe16..aa7f4b6 100644 --- a/Stars45/Sim.cpp +++ b/Stars45/Sim.cpp @@ -232,7 +232,7 @@ Sim::CommitMission() Player* p = Player::GetCurrentPlayer(); p->ProcessStats(s, start_time); - if (mission && mission->Type() == Mission::TRAINING && + if (mission && mission->Type() == Mission::TRAINING && s->GetDeaths() == 0 && s->GetColls() == 0) p->SetTrained(mission->Identity()); @@ -455,7 +455,7 @@ Sim::CreateRegions() } } } - + ListIter rgn = planet->Regions(); while (++rgn) { SimRegion* sim_region = new(__FILE__,__LINE__) SimRegion(this, rgn.value()); @@ -465,7 +465,7 @@ Sim::CreateRegions() } } } - + ListIter rgn = star->Regions(); while (++rgn) { SimRegion* sim_region = new(__FILE__,__LINE__) SimRegion(this, rgn.value()); @@ -587,7 +587,7 @@ Sim::CreateElements() ActivateRegion(rgn); } - // if element belongs to a squadron, + // if element belongs to a squadron, // find the carrier, squadron, flight deck, etc.: if (msn_elem->Squadron().length() > 0) { MissionElement* squadron_elem = mission->FindElement(msn_elem->Squadron()); @@ -792,8 +792,8 @@ Sim::CreateElements() element->SetLoadout(loadout); - Ship* ship = CreateShip(sname, rnum, - (ShipDesign*) msn_elem->GetDesign(), + Ship* ship = CreateShip(sname, rnum, + (ShipDesign*) msn_elem->GetDesign(), rgn_name, l2, msn_elem->GetIFF(), msn_elem->CommandAI(), @@ -1434,7 +1434,7 @@ Sim::FindNearestRegion(SimObject* object, int type) } } } - + return result; } @@ -1459,7 +1459,7 @@ Sim::FindNearestSpaceRegion(Orbital* body) } } } - + return result; } @@ -1757,7 +1757,7 @@ Sim::ResolveHyperList() } jumplist.destroy(); - + if (pship && pship->GetRegion()) { if (active_region != pship->GetRegion()) { pship->GetRegion()->SetPlayerShip(pship); @@ -2288,7 +2288,7 @@ SimRegion::SimRegion(Sim* s, OrbitalRegion* r) Point init_loc((rand()-16384.0f) * 30, (rand()-16384.0f) * 3, (rand()-16384.0f) * 30); - sim->CreateAsteroid(init_loc, i, Random(1e7, 1e8), this); + sim->CreateAsteroid(init_loc, i, Random(1e7, 1e8), this); } } } @@ -2436,7 +2436,7 @@ SimRegion::ClearSelection() void SimRegion::AddSelection(Ship* newsel) { - if (!newsel || + if (!newsel || newsel->GetFlightPhase() < Ship::ACTIVE || newsel->GetFlightPhase() >= Ship::RECOVERY) return; @@ -2637,7 +2637,7 @@ SimRegion::UpdateShips(double seconds) while (++ship_iter) { ship = ship_iter.value(); - + if (ship_index == ai_index || ship == player_ship) ship->SetAIMode(2); else @@ -2668,7 +2668,7 @@ SimRegion::UpdateShots(double seconds) sim->CreateSplashDamage(shot); } } - + if (shot->Life() < 0.01) { // died of old age NetUtil::SendWepDestroy(shot); @@ -2757,12 +2757,12 @@ SimRegion::DamageShips() if (ship_destroyed) { NetUtil::SendObjKill(ship, owner, shot->IsMissile() ? NetObjKill::KILL_SECONDARY : NetObjKill::KILL_PRIMARY); Director* director; - + Print(" %s Killed %s (%s)\n", owner_name, ship->Name(), FormatGameTime()); if (owner) director = owner->GetDirector(); - + // alert the killer if (director && director->Type() > SteerAI::SEEKER && director->Type() < SteerAI::GROUND) { ShipAI* shipAI = (ShipAI*) director; @@ -2883,7 +2883,7 @@ SimRegion::DamageShips() if (shot->IsDrone()) drones.remove((Drone*) shot); - + shot_iter.removeItem(); delete shot; shot = 0; @@ -2916,7 +2916,7 @@ SimRegion::DamageShips() NetUtil::SendWepDestroy(shot); if (shot->IsDrone()) drones.remove((Drone*) shot); - + shot_iter.removeItem(); delete shot; shot = 0; @@ -2934,7 +2934,7 @@ SimRegion::DamageShips() if (!shot->IsBeam()) { if (shot->IsDrone()) drones.remove((Drone*) shot); - + shot_iter.removeItem(); delete shot; shot = 0; @@ -2959,8 +2959,8 @@ SimRegion::CollideShips() ListIter ship_iter = ships; while (++ship_iter) { Ship* ship = ship_iter.value(); - - if (ship->InTransition() || + + if (ship->InTransition() || ship->GetFlightPhase() < Ship::ACTIVE || ship->MissionClock() < 10000 || ship->IsNetObserver()) @@ -2975,7 +2975,7 @@ SimRegion::CollideShips() if (targ == ship) continue; - if (targ->InTransition() || + if (targ->InTransition() || targ->GetFlightPhase() < Ship::ACTIVE || targ->MissionClock() < 10000 || targ->IsNetObserver()) @@ -3143,8 +3143,8 @@ SimRegion::CrashShips() while (++ship_iter) { Ship* ship = ship_iter.value(); - if (!ship->IsGroundUnit() && - !ship->InTransition() && + if (!ship->IsGroundUnit() && + !ship->InTransition() && ship->Class() != Ship::LCA && ship->AltitudeAGL() < ship->Radius()/2) { if (ship->GetFlightPhase() == Ship::ACTIVE || ship->GetFlightPhase() == Ship::APPROACH) { @@ -3255,7 +3255,7 @@ SimRegion::DestroyShip(Ship* ship) if (sim->netgame && respawn) sim->netgame->Respawn(ship->GetObjID(), spawn); - int n = strlen(ship_name); + int n = strlen(ship_name); if (n > 2) { if (ship_name[n-2] == ' ' && isdigit(ship_name[n-1])) ship_name[n-2] = 0; @@ -3445,7 +3445,7 @@ SimRegion::InsertObject(Ship* ship) TranslateObject(ship); ship->SetRegion(this); - + if (active) ship->Activate(sim->scene); } @@ -3468,7 +3468,7 @@ SimRegion::InsertObject(Shot* shot) TranslateObject(shot); shot->SetRegion(this); - + if (active) shot->Activate(sim->scene); } @@ -3488,7 +3488,7 @@ SimRegion::InsertObject(Explosion* exp) explosions.append(exp); TranslateObject(exp); exp->SetRegion(this); - + if (active) exp->Activate(sim->scene); } @@ -3508,7 +3508,7 @@ SimRegion::InsertObject(Debris* d) debris.append(d); TranslateObject(d); d->SetRegion(this); - + if (active) d->Activate(sim->scene); } @@ -3528,7 +3528,7 @@ SimRegion::InsertObject(Asteroid* a) asteroids.append(a); TranslateObject(a); a->SetRegion(this); - + if (active) a->Activate(sim->scene); } diff --git a/Stars45/SimObject.h b/Stars45/SimObject.h index 0313a1e..6065e3a 100644 --- a/Stars45/SimObject.h +++ b/Stars45/SimObject.h @@ -60,7 +60,7 @@ class SimObject : public Physical public: static const char* TYPENAME() { return "SimObject"; } - enum TYPES { + enum TYPES { SIM_SHIP=100, SIM_SHOT, SIM_DRONE, diff --git a/Stars45/Sky.cpp b/Stars45/Sky.cpp index 8dc8b9f..e7c9f5e 100644 --- a/Stars45/Sky.cpp +++ b/Stars45/Sky.cpp @@ -527,7 +527,7 @@ double tscale) p0.verts[2] = i; p0.verts[1] = sect_verts + i; p0.verts[0] = sect_verts + ((i+1) % sect_verts); - + Poly& p1 = polys[ppolys - nsections + i]; p1.verts[2] = pverts - 1 - i; p1.verts[1] = pverts - 1 - sect_verts - i; diff --git a/Stars45/Sky.h b/Stars45/Sky.h index 591824c..520c4d9 100644 --- a/Stars45/Sky.h +++ b/Stars45/Sky.h @@ -90,7 +90,7 @@ protected: class PlanetRep : public Solid { public: - PlanetRep(const char* img_west, const char* img_glow, + PlanetRep(const char* img_west, const char* img_glow, double rad, const Vec3& pos, double tscale = 1, const char* rngname=0, double minrad = 0, double maxrad = 0, Color atmos = Color::Black, const char* img_gloss=0); diff --git a/Stars45/Slider.cpp b/Stars45/Slider.cpp index bc89883..5f09cea 100644 --- a/Stars45/Slider.cpp +++ b/Stars45/Slider.cpp @@ -425,7 +425,7 @@ void Slider::SetValue(int nNewValue, int index) { if (index >= 0 && index < MAX_VAL) { value[index] = nNewValue; - + if (index >= nvalues) nvalues = index+1; } diff --git a/Stars45/Solid.cpp b/Stars45/Solid.cpp index eef2d55..c91e7f1 100644 --- a/Stars45/Solid.cpp +++ b/Stars45/Solid.cpp @@ -807,7 +807,7 @@ Model::GetAllTextures(List& textures) Model::Model() : nverts(0), npolys(0), radius(0), luminous(false), dynamic(false) -{ +{ ZeroMemory(name, sizeof(name)); } @@ -1251,7 +1251,7 @@ Model::LoadMag5(BYTE* block, int len, double scale) vset->rw[v] = 1; poly.verts[vi] = v; } - + loader->fread(texture_index_buffer, sizeof(float), poly_nverts, fp); // tu's for (int vi = 0; vi < poly_nverts; vi++) { v = poly.verts[vi]; @@ -1866,7 +1866,7 @@ Surface::Copy(Surface& s, Model* m) for (int i = 0; i < npolys; i++) { polys[i].vertex_set = vertex_set; - + if (s.polys[i].material) polys[i].material = (Material*) model->FindMaterial(s.polys[i].material->name); } @@ -1956,7 +1956,7 @@ Poly* Surface::AddPolys(int np, int nv) { if ( polys && vertex_set && - np > 0 && np + npolys < MAX_POLYS && + np > 0 && np + npolys < MAX_POLYS && nv > 0 && nv + vertex_set->nverts < MAX_VERTS) { int newverts = nv + vertex_set->nverts; @@ -1973,7 +1973,7 @@ Surface::AddPolys(int np, int nv) if (segments.size() > 0) { Segment* seg = segments.last(); Material* mtl = seg->material; - + for (int i = 0; i < np; i++) { Poly* p = pnew + i; p->material = mtl; diff --git a/Stars45/SoundD3D.cpp b/Stars45/SoundD3D.cpp index a148e69..66e4733 100644 --- a/Stars45/SoundD3D.cpp +++ b/Stars45/SoundD3D.cpp @@ -77,7 +77,7 @@ SoundCardD3D::SoundCardD3D(HWND hwnd) #ifdef DIRECT_SOUND_3D CoInitialize(NULL); - err = CoCreateInstance(CLSID_A3d, NULL, CLSCTX_INPROC_SERVER, + err = CoCreateInstance(CLSID_A3d, NULL, CLSCTX_INPROC_SERVER, IID_IDirectSound, (VOID **)&soundcard); if (SUCCEEDED(err)) { @@ -87,7 +87,7 @@ SoundCardD3D::SoundCardD3D(HWND hwnd) else { SoundD3DError("Could not initialize Aureal3D Sound", err); SoundD3DError("Proceding with standard DirectSoundCreate", 0); -#endif +#endif err = DirectSoundCreate(0, &soundcard, 0); if (FAILED(err)) { @@ -534,7 +534,7 @@ SoundD3D::Update() // into the streaming buffer: if (flags & STREAMED) { buffer->GetCurrentPosition(&r, 0); - + DWORD data_left; if (w > r) data_left = w - r; @@ -706,7 +706,7 @@ SoundD3D::Localize() } // Compute pan and volume from scratch: - + if ((flags & LOC_3D) && creator) { Vec3 loc = location; @@ -714,7 +714,7 @@ SoundD3D::Localize() Camera& listener = ears->listener; Vec3 ear_loc = listener.Pos(); ear_loc.SwapYZ(); Vec3 direction = loc - ear_loc; - + loc.x = direction * listener.vrt(); loc.y = direction * listener.vup(); loc.z = direction * listener.vpn(); @@ -761,16 +761,16 @@ SoundD3D::Localize() sprintf_s(warn, "Warning: could not set volume on buffer to %f", vol); SoundD3DError(warn, hr); } - + // if not too far to hear... if ((flags & DOPPLER) && (d2 < maxd2)) { // COMPUTE DOPPLER SHIFT: const float c = 10000.0f; - + direction.Normalize(); float v_L = ears->velocity * direction; float v_S = velocity * direction; - + DWORD f_shift = wfex.nSamplesPerSec; if (v_L != v_S) { @@ -786,10 +786,10 @@ SoundD3D::Localize() DWORD roll_off = (DWORD) (80 * dist/max_dist); f_shift -= roll_off; - + if (f_shift < 100) f_shift = 100; if (f_shift > 100000) f_shift = 100000; - + hr = buffer->SetFrequency(f_shift); if (!SUCCEEDED(hr)) { char warn[512]; @@ -1022,7 +1022,7 @@ SoundD3D::AllocateBuffer(DWORD bytes) if (soundcard) { hr = soundcard->CreateSoundBuffer(&dsbd, &buffer, NULL); - + if (FAILED(hr)) { SoundD3DError("AllocateBuffer: could not create buffer", hr); diff --git a/Stars45/Sprite.cpp b/Stars45/Sprite.cpp index 4fd565c..65de662 100644 --- a/Stars45/Sprite.cpp +++ b/Stars45/Sprite.cpp @@ -128,7 +128,7 @@ Sprite::Scale(double scale) if (scale >= 0) { w = (int) (scale * w); h = (int) (scale * h); - + radius = (float) ((w>h) ? w : h) / 2.0f; } } @@ -141,7 +141,7 @@ Sprite::Rescale(double scale) if (scale >= 0 && Frame()) { w = (int) (scale * Frame()->Width()); h = (int) (scale * Frame()->Height()); - + radius = (float) ((w>h) ? w : h) / 2.0f; } } @@ -154,7 +154,7 @@ Sprite::Reshape(int w1, int h1) if (w1 >= 0 && h1 >= 0 && Frame()) { w = w1; h = h1; - + radius = (float) ((w>h) ? w : h) / 2.0f; } } @@ -184,7 +184,7 @@ Sprite::SetAnimation(Bitmap* animation, int length, int repeat, int share) nframes = length; frames = animation; frame_index = 0; - + if (repeat) { loop = 1; life = -1; @@ -193,7 +193,7 @@ Sprite::SetAnimation(Bitmap* animation, int length, int repeat, int share) loop = 0; life = nframes; } - + last_time = Game::RealTime() - frame_time; } } @@ -396,7 +396,7 @@ Sprite::Update() last_time += frame_time; } - + if (life < 0 && !loop) life = 0; } diff --git a/Stars45/StarServer.cpp b/Stars45/StarServer.cpp index b4842f1..e46b804 100644 --- a/Stars45/StarServer.cpp +++ b/Stars45/StarServer.cpp @@ -445,7 +445,7 @@ StarServer::OnPaint() switch (game_mode) { case LOAD_MODE: - case MENU_MODE: + case MENU_MODE: txt_mode = Game::GetText("server.mode.lobby"); if (lobby_server) { @@ -454,7 +454,7 @@ StarServer::OnPaint() } break; - case PLAY_MODE: + case PLAY_MODE: txt_mode = Game::GetText("server.mode.active"); if (lobby_server) { sprintf_s(buf, Game::GetText("server.users-and-players").data(), lobby_server->NumUsers(), NetGame::NumPlayers()); diff --git a/Stars45/StarSystem.cpp b/Stars45/StarSystem.cpp index 3c91f99..dc85f87 100644 --- a/Stars45/StarSystem.cpp +++ b/Stars45/StarSystem.cpp @@ -108,7 +108,7 @@ static const int NAMELEN = 64; StarSystem::StarSystem(const char* sys_name, Point l, int iff, int s) : name(sys_name), affiliation(iff), sky_stars(0), sky_dust(0), loc(l), seq(s), active_region(0), instantiated(false), ambient(0,0,0), -sun_color(255,255,255), sun_scale(1), point_stars(0), poly_stars(0), +sun_color(255,255,255), sun_scale(1), point_stars(0), poly_stars(0), nebula(0), haze(0) { center = new(__FILE__,__LINE__) Orbital(this, "CG", Orbital::NOTHING, 1.0e35f, 0.0f, 0.0f, 0); @@ -183,7 +183,7 @@ StarSystem::Load() do { delete term; term = parser.ParseTerm(); - + if (term) { TermDef* def = term->isDef(); if (def) { @@ -210,7 +210,7 @@ StarSystem::Load() imgname[0] = 0; magname[0] = 0; hazname[0] = 0; - + for (int i = 0; i < val->elements()->size(); i++) { TermDef* pdef = val->elements()->at(i)->isDef(); if (pdef) { @@ -300,7 +300,7 @@ StarSystem::Load() ParseTerrain(val); } } - + } } } @@ -1035,7 +1035,7 @@ StarSystem::Create() } loader->SetDataPath(0); - + ListIter star = bodies; while (++star) { CreateBody(*star); @@ -1043,7 +1043,7 @@ StarSystem::Create() ListIter planet = star->Satellites(); while (++planet) { CreateBody(*planet); - + ListIter moon = planet->Satellites(); while (++moon) { CreateBody(*moon); @@ -1070,8 +1070,8 @@ StarSystem::CreateBody(OrbitalBody& body) PlanetRep* rep = new(__FILE__,__LINE__) PlanetRep(body.tex_name, 0, - body.radius, - starloc, + body.radius, + starloc, body.tscale); rep->SetLuminous(true); @@ -1100,7 +1100,7 @@ StarSystem::CreateBody(OrbitalBody& body) back_lights.append(back_light); body.back_light = back_light; } - } + } // planets and moons: else { @@ -1109,7 +1109,7 @@ StarSystem::CreateBody(OrbitalBody& body) double rmax = 0; double rmin = 0; - + if (body.ring_max > 0) { rmax = body.ring_max*body.radius; rmin = body.ring_min*body.radius; @@ -1148,7 +1148,7 @@ StarSystem::CreateBody(OrbitalBody& body) if (body.tilt != 0) { Matrix m; m.Pitch(body.tilt); - + rep->SetOrientation(m); } @@ -1173,7 +1173,7 @@ StarSystem::Destroy() ListIter planet = star->Satellites(); while (++planet) { GRAPHIC_DESTROY(planet->rep); - + ListIter moon = planet->Satellites(); while (++moon) { GRAPHIC_DESTROY(moon->rep); @@ -1347,7 +1347,7 @@ StarSystem::SetActiveRegion(OrbitalRegion* rgn) if (scene) scene->SetAmbient(ambient); } - + ListIter star = bodies; while (++star) { if (star->rep) @@ -1394,7 +1394,7 @@ static BYTE max3(BYTE a, BYTE b, BYTE c) else if (b > c) return b; else return c; -} +} static BYTE min3(BYTE a, BYTE b, BYTE c) { @@ -1404,7 +1404,7 @@ static BYTE min3(BYTE a, BYTE b, BYTE c) else if (b < c) return b; else return c; -} +} void StarSystem::ExecFrame() @@ -1544,7 +1544,7 @@ StarSystem::ExecFrame() star->back_light->SetActive(true); } } - + ListIter planet_iter = star->Satellites(); while (++planet_iter) { OrbitalBody* planet = planet_iter.value(); @@ -1571,7 +1571,7 @@ StarSystem::ExecFrame() pr->SetDaytime(false); } } - + ListIter moon_iter = planet->Satellites(); while (++moon_iter) { OrbitalBody* moon = moon_iter.value(); @@ -1586,7 +1586,7 @@ StarSystem::ExecFrame() if (moon == active_region->Primary()) { pr->Hide(); } - + else { pr->Show(); pr->SetDaytime(true); @@ -1867,7 +1867,7 @@ Orbital::Update() // orbits are counter clockwise: phase = -2 * PI * grade * StarSystem::Stardate() / period; - + loc = primary->Location() + Point((double) (orbit * cos(phase)), (double) (orbit * sin(phase)), 0); @@ -1895,7 +1895,7 @@ Orbital::PredictLocation(double delta_t) // orbits are(?) counter clockwise: double predicted_phase = (double) (-2 * PI * grade * (StarSystem::Stardate()+delta_t) / period); - + predicted_loc += Point((double) (orbit * cos(predicted_phase)), (double) (orbit * sin(predicted_phase)), 0); diff --git a/Stars45/StarSystem.h b/Stars45/StarSystem.h index 06fc100..18bc305 100644 --- a/Stars45/StarSystem.h +++ b/Stars45/StarSystem.h @@ -176,7 +176,7 @@ public: Star(const char* n, const Point& l, int s) : name(n), loc(l), seq(s) { } virtual ~Star() { } - enum SPECTRAL_CLASS { BLACK_HOLE, WHITE_DWARF, RED_GIANT, + enum SPECTRAL_CLASS { BLACK_HOLE, WHITE_DWARF, RED_GIANT, O, B, A, F, G, K, M }; int operator == (const Star& s) const { return name == s.name; } diff --git a/Stars45/Starshatter.cpp b/Stars45/Starshatter.cpp index 4e33b26..348538d 100644 --- a/Stars45/Starshatter.cpp +++ b/Stars45/Starshatter.cpp @@ -169,9 +169,9 @@ enum CHAT_MODES { Starshatter::Starshatter() : gamewin(0), menuscreen(0), loadscreen(0), planscreen(0), -cmpnscreen(0), gamescreen(0), splash(0), splash_index(0), +cmpnscreen(0), gamescreen(0), splash(0), splash_index(0), input(0), loader(0), cam_dir(0), music_dir(0), -field_of_view(2), time_mark(0), minutes(0), +field_of_view(2), time_mark(0), minutes(0), player_ship(0), net_lobby(0), spinning(false), tactical(false), mouse_x(0), mouse_y(0), game_mode(MENU_MODE), mouse_input(0), head_tracker(0), @@ -375,7 +375,7 @@ Starshatter::MapKeys(KeyMap* mapping, int nkeys) { for (int i = 0; i < nkeys; i++) { KeyMapEntry* k = mapping->GetKeyMap(i); - + if (k->act >= KEY_MAP_FIRST && k->act <= KEY_MAP_LAST) MapKey(k->act, k->key, k->alt); } @@ -1422,7 +1422,7 @@ Starshatter::DoLoadScreenFrame() RadioTraffic::Initialize(); RadioView::Initialize(); TacticalView::Initialize(); - + if (!gamescreen && game_mode != PREP_MODE) SetupGameScreen(); @@ -1579,7 +1579,7 @@ Starshatter::DoGameScreenFrame() } player_ship = sim->GetPlayerShip(); - + if (player_ship) { // warp effect: if (player_ship->WarpFactor() > 1) { @@ -1594,8 +1594,8 @@ Starshatter::DoGameScreenFrame() gamescreen->SetFieldOfView(field_of_view); } - gamescreen->ShowExternal(); - + gamescreen->ShowExternal(); + if (CameraDirector::GetCameraMode() >= CameraDirector::MODE_ORBIT && !player_ship->InTransition()) tactical = true; else @@ -1657,7 +1657,7 @@ Starshatter::DoGameKeys() PlayerCam(CameraDirector::MODE_ORBIT); time_til_change = 0.5; } - + else if (KeyDown(KEY_TARGET_PADLOCK)) { PlayerCam(CameraDirector::MODE_TARGET); time_til_change = 0.5; @@ -1679,7 +1679,7 @@ Starshatter::DoGameKeys() if (player_ship && player_ship->WarpFactor() <= 1) gamescreen->SetFieldOfView(field_of_view); } - + else if (!exit_latch && KeyDown(KEY_EXIT)) { exit_latch = true; time_til_change = 0.5; @@ -1822,7 +1822,7 @@ Starshatter::DoGameKeys() else if (KeyDown(KEY_SELF_DESTRUCT)) { time_til_change = 0.5; - + if (player_ship && !player_ship->InTransition()) { double damage = player_ship->Design()->scuttle; @@ -2092,7 +2092,7 @@ Starshatter::DoChatMode() NetUtil::SendChat(player_ship->GetIFF()+1, name, chat_text); } break; - + case CHAT_WING: if (player_ship) { Element* elem = player_ship->GetElement(); @@ -2454,7 +2454,7 @@ Starshatter::LoadVideoConfig(const char* filename) delete term; term = parser.ParseTerm(); - + if (term) { TermDef* def = term->isDef(); if (def) { diff --git a/Stars45/StarshipAI.cpp b/Stars45/StarshipAI.cpp index 14af058..9cf24ca 100644 --- a/Stars45/StarshipAI.cpp +++ b/Stars45/StarshipAI.cpp @@ -120,8 +120,8 @@ StarshipAI::FindObjective() bool hold = order == RadioMessage::WEP_HOLD || order == RadioMessage::FORM_UP; - bool form = hold || - (!order && !target) || + bool form = hold || + (!order && !target) || (farcaster); // if not the element leader, stay in formation: @@ -243,7 +243,7 @@ StarshipAI::Navigator() magnitude = 0; hold = false; - if ((ship->GetElement() && ship->GetElement()->GetHoldTime() > 0) || + if ((ship->GetElement() && ship->GetElement()->GetHoldTime() > 0) || (navpt && navpt->Status() == Instruction::COMPLETE && navpt->HoldTime() > 0)) hold = true; @@ -502,8 +502,8 @@ StarshipAI::SeekTarget() navpt->SetRegion(nav_rgn); } - bool use_farcaster = self_rgn != nav_rgn && - (navpt->Farcast() || + bool use_farcaster = self_rgn != nav_rgn && + (navpt->Farcast() || !qdrive || !qdrive->IsPowerOn() || qdrive->Status() < System::DEGRADED @@ -641,7 +641,7 @@ StarshipAI::FireControl() Point delta = target->Location() - ship->Location(); double range = delta.length(); - if (range < weapon->GetDesign()->max_range * 0.9 && + if (range < weapon->GetDesign()->max_range * 0.9 && !AssessTargetPointDefense()) weapon->SetFiringOrders(Weapon::AUTO); diff --git a/Stars45/StarshipTacticalAI.cpp b/Stars45/StarshipTacticalAI.cpp index e00e8d2..c51b730 100644 --- a/Stars45/StarshipTacticalAI.cpp +++ b/Stars45/StarshipTacticalAI.cpp @@ -79,7 +79,7 @@ StarshipTacticalAI::StarshipTacticalAI(ShipAI* ai) default: case 2: THREAT_REACTION_TIME = 500; break; case 1: THREAT_REACTION_TIME = 1000; break; - case 0: THREAT_REACTION_TIME = 2500; + case 0: THREAT_REACTION_TIME = 2500; drop_time = STARSHIP_TACTICAL_DROP_TIME + Random(0, STARSHIP_TACTICAL_DROP_TIME); break; @@ -148,7 +148,7 @@ StarshipTacticalAI::FindThreat() } } - if (contact->Threat(ship) && + if (contact->Threat(ship) && (Game::GameTime() - contact->AcquisitionTime()) > THREAT_REACTION_TIME) { if (c_shot) { @@ -158,7 +158,7 @@ StarshipTacticalAI::FindThreat() else { double rng = contact->Range(ship); - if (c_ship && + if (c_ship && c_ship->Class() != Ship::FREIGHTER && c_ship->Class() != Ship::FARCASTER) { diff --git a/Stars45/SteerAI.cpp b/Stars45/SteerAI.cpp index 8c17908..9cc726d 100644 --- a/Stars45/SteerAI.cpp +++ b/Stars45/SteerAI.cpp @@ -81,8 +81,8 @@ Steer& Steer::operator+=(const Steer& s) if (s.stop) stop = 1; - - return *this; + + return *this; } Steer& Steer::operator-=(const Steer& s) @@ -96,8 +96,8 @@ Steer& Steer::operator-=(const Steer& s) if (s.stop) stop = 1; - - return *this; + + return *this; } @@ -155,7 +155,7 @@ SteerAI::SetTarget(SimObject* targ, System* sub) { if (target != targ) { target = targ; - + if (target) Observe(target); } @@ -341,10 +341,10 @@ SteerAI::Accumulate(const Steer& steer) if (magnitude + mag > 1) { overflow = 1; double scale = (1 - magnitude) / mag; - + accumulator += steer * scale; magnitude = 1; - + if (seeking) { az[0] *= scale; el[0] *= scale; diff --git a/Stars45/System.cpp b/Stars45/System.cpp index 86b4a5a..3189a3b 100644 --- a/Stars45/System.cpp +++ b/Stars45/System.cpp @@ -33,7 +33,7 @@ OVERVIEW ======== - Generic Ship Subsystem class + Generic Ship Subsystem class */ #include "MemDebug.h" @@ -46,7 +46,7 @@ // +----------------------------------------------------------------------+ -System::System(System::CATEGORY t, int s, const char* n, int maxv, +System::System(System::CATEGORY t, int s, const char* n, int maxv, double e, double c, double r) : type(t), id(0), ship(0), subtype(s), status(NOMINAL), availability(1.0f), safety(1.0f), stability(1.0f), crit_level(0.5f), net_avail(-1.0f), @@ -69,7 +69,7 @@ explosion_type(0), name(n), abrv(name), design(0), emcon(3) System::System(const System& s) : type(s.type), id(s.id), ship(0), subtype(s.subtype), status(s.status), -availability(s.availability), safety(s.safety), stability(s.stability), +availability(s.availability), safety(s.safety), stability(s.stability), crit_level(s.crit_level), net_avail(-1.0f), mount_rel(s.mount_rel), radius(s.radius), safety_overload(0.0f), hull_factor(s.hull_factor), energy(s.energy), capacity(s.capacity), diff --git a/Stars45/SystemDesign.cpp b/Stars45/SystemDesign.cpp index 94d9cd8..6cc4e30 100644 --- a/Stars45/SystemDesign.cpp +++ b/Stars45/SystemDesign.cpp @@ -95,7 +95,7 @@ SystemDesign::Initialize(const char* filename) delete term; term = parser.ParseTerm(); - + if (term) { TermDef* def = term->isDef(); if (def) { @@ -107,7 +107,7 @@ SystemDesign::Initialize(const char* filename) else { TermStruct* val = def->term()->isStruct(); SystemDesign* design = new(__FILE__,__LINE__) SystemDesign; - + for (int i = 0; i < val->elements()->size(); i++) { TermDef* pdef = val->elements()->at(i)->isDef(); if (pdef) { @@ -120,7 +120,7 @@ SystemDesign::Initialize(const char* filename) else { TermStruct* val2 = pdef->term()->isStruct(); ComponentDesign* comp_design = new(__FILE__,__LINE__) ComponentDesign; - + for (int i = 0; i < val2->elements()->size(); i++) { TermDef* pdef2 = val2->elements()->at(i)->isDef(); if (pdef2) { @@ -156,7 +156,7 @@ SystemDesign::Initialize(const char* filename) catalog.append(design); } } - + else Print("WARNING: unknown definition '%s' in '%s'\n", def->name()->value().data(), filename); diff --git a/Stars45/TacRefDlg.cpp b/Stars45/TacRefDlg.cpp index 88c6eba..28b0343 100644 --- a/Stars45/TacRefDlg.cpp +++ b/Stars45/TacRefDlg.cpp @@ -71,7 +71,7 @@ DEF_MAP_CLIENT(TacRefDlg, OnCamZoom); TacRefDlg::TacRefDlg(Screen* s, FormDef& def, MenuScreen* mgr) : FormWindow(s, 0, 0, s->Width(), s->Height()), manager(mgr), -beauty(0), camview(0), imgview(0), +beauty(0), camview(0), imgview(0), txt_caption(0), txt_stats(0), txt_description(0), lst_designs(0), btn_close(0), btn_ships(0), btn_weaps(0), mode(MODE_NONE), radius(100), mouse_x(0), mouse_y(0), @@ -420,7 +420,7 @@ TacRefDlg::SelectWeapon(const WeaponDesign* design) } desc += "\n"; - + if (!design->primary && design->damage > 0) { desc += Game::GetText("tacref.kill-radius"); desc += "\t"; diff --git a/Stars45/TacticalAI.cpp b/Stars45/TacticalAI.cpp index 0e61015..5d0c353 100644 --- a/Stars45/TacticalAI.cpp +++ b/Stars45/TacticalAI.cpp @@ -128,7 +128,7 @@ TacticalAI::ExecFrame(double secs) ship_ai->SetNavPoint(navpt); if (carrier_ai) - carrier_ai->ExecFrame(secs); + carrier_ai->ExecFrame(secs); exec_time += exec_period; } @@ -298,7 +298,7 @@ TacticalAI::ProcessOrders() roe = NONE; ship_ai->DropTarget(10); - + if (!ship->GetInbound()) { RadioMessage* msg = 0; Ship* controller = ship->GetController(); @@ -349,7 +349,7 @@ TacticalAI::ProcessOrders() return true; } - // if we had an action before, this must be a "cancel orders" + // if we had an action before, this must be a "cancel orders" else if (action) { ClearRadioOrders(); } @@ -653,7 +653,7 @@ TacticalAI::SelectTargetOpportunity() if (rogue || tgt_ok) { if (c_ship && c_ship != ship && !c_ship->InTransition()) { - if (c_ship->Class() < Ship::DESTROYER || + if (c_ship->Class() < Ship::DESTROYER || (c_ship->Class() >= Ship::MINE && c_ship->Class() <= Ship::DEFSAT)) { // found an enemy, check distance: double dist = (ship->Location() - c_ship->Location()).length(); @@ -684,7 +684,7 @@ TacticalAI::SelectTargetOpportunity() Ship* ward = ship_ai->GetWard(); if ((c_shot->IsTracking(ward) || c_shot->IsTracking(ship)) && - (!current_shot_target->IsTracking(ward) || + (!current_shot_target->IsTracking(ward) || !current_shot_target->IsTracking(ship))) { current_shot_target = c_shot; target_dist = dist; @@ -719,9 +719,9 @@ TacticalAI::SelectTargetOpportunity() int c_iff = contact->GetIFF(ship); bool rogue = c_ship->IsRogue(); - bool tgt_ok = c_ship != ship && - c_iff > 0 && - c_iff != ship->GetIFF() && + bool tgt_ok = c_ship != ship && + c_iff > 0 && + c_iff != ship->GetIFF() && !c_ship->InTransition(); if (rogue || tgt_ok) { @@ -745,7 +745,7 @@ TacticalAI::SelectTargetOpportunity() // prefer targets that are threatening that ward: if (potential_target && ward_threats.size() && !ward_threats.contains((Ship*)potential_target)) { target_dist *= 2; - + ListIter iter = ward_threats; while (++iter) { Ship* threat = iter.value(); @@ -857,7 +857,7 @@ TacticalAI::FindThreat() while (++iter) { Contact* contact = iter.value(); - if (contact->Threat(ship) && + if (contact->Threat(ship) && (Game::GameTime() - contact->AcquisitionTime()) > THREAT_REACTION_TIME) { if (contact->GetShot()) { diff --git a/Stars45/TacticalView.cpp b/Stars45/TacticalView.cpp index 6905f7d..189a819 100644 --- a/Stars45/TacticalView.cpp +++ b/Stars45/TacticalView.cpp @@ -287,10 +287,10 @@ TacticalView::DrawSelection(Ship* seln) { if (!seln) return; - + Graphic* g = seln->Rep(); Rect r = g->ScreenRect(); - + Point mark_pt = seln->Location(); projector->Transform(mark_pt); @@ -581,7 +581,7 @@ TacticalView::DoMouseFrame() if (sim && right_down && (Game::RealTime() - rbutton_latch < 250)) { Ship* seln = WillSelectAt(Mouse::X(), Mouse::Y()); - if (seln && sim->IsSelected(seln) && + if (seln && sim->IsSelected(seln) && seln->GetIFF() == ship->GetIFF() && ship->GetElement()->CanCommand(seln->GetElement())) { @@ -589,8 +589,8 @@ TacticalView::DoMouseFrame() Observe(msg_ship); } - else if (ship && seln == ship && - (!ship->GetDirector() || + else if (ship && seln == ship && + (!ship->GetDirector() || ship->GetDirector()->Type() != ShipCtrl::DIR_TYPE)) { msg_ship = seln; @@ -1086,7 +1086,7 @@ TacticalView::ProcessMenuItem(int action) if (!s) s = ship; - + if (s && s->GetQuantumDrive()) { QuantumDrive* quantum = s->GetQuantumDrive(); if (quantum) { @@ -1448,7 +1448,7 @@ TacticalView::DrawAction() } break; - default: + default: if (tgt) { if (tgt_iff == ship->GetIFF()) r = 0; diff --git a/Stars45/TacticalView.h b/Stars45/TacticalView.h index 8210fef..c761088 100644 --- a/Stars45/TacticalView.h +++ b/Stars45/TacticalView.h @@ -60,7 +60,7 @@ class GameScreen; // +--------------------------------------------------------------------+ -class TacticalView : public View, +class TacticalView : public View, public SimObserver { public: diff --git a/Stars45/Term.h b/Stars45/Term.h index a0317dd..e24310f 100644 --- a/Stars45/Term.h +++ b/Stars45/Term.h @@ -92,7 +92,7 @@ public: static const char* TYPENAME() { return "TermBool"; } TermBool(bool v) : val(v) { } - + virtual void print(int level=10); virtual TermBool* isBool() { return this; } bool value() const { return val; } @@ -109,7 +109,7 @@ public: static const char* TYPENAME() { return "TermNumber"; } TermNumber(double v) : val(v) { } - + virtual void print(int level=10); virtual TermNumber* isNumber() { return this; } double value() const { return val; } @@ -126,7 +126,7 @@ public: static const char* TYPENAME() { return "TermText"; } TermText(const Text& v) : val(v) { } - + virtual void print(int level=10); virtual TermText* isText() { return this; } Text value() const { return val; } @@ -144,7 +144,7 @@ public: TermArray(TermList* elist); virtual ~TermArray(); - + virtual void print(int level=10); virtual TermArray* isArray() { return this; } TermList* elements() { return elems; } @@ -184,7 +184,7 @@ public: virtual void print(int level=10); virtual TermDef* isDef() { return this; } - + virtual TermText* name() { return mname; } virtual Term* term() { return mval; } diff --git a/Stars45/Terrain.cpp b/Stars45/Terrain.cpp index 24c836a..44c4033 100644 --- a/Stars45/Terrain.cpp +++ b/Stars45/Terrain.cpp @@ -61,7 +61,7 @@ const int PATCH_SIZE = 16; // +--------------------------------------------------------------------+ Terrain::Terrain(TerrainRegion* trgn) -: region(trgn), patches(0), water_patches(0), water(0), +: region(trgn), patches(0), water_patches(0), water(0), aprons(0), clouds(0), terrain_normals(0) { detail_frame = 0; @@ -224,7 +224,7 @@ Terrain::BuildTerrain() if (water_texture && patches[index]->MinHeight() < 3) water_patches[index] = new(__FILE__,__LINE__) TerrainPatch(this, rect, p1, p2, 30); - + else if (water_patches != 0) water_patches[index] = 0; } diff --git a/Stars45/TerrainClouds.cpp b/Stars45/TerrainClouds.cpp index 7534ada..7ebd48e 100644 --- a/Stars45/TerrainClouds.cpp +++ b/Stars45/TerrainClouds.cpp @@ -169,7 +169,7 @@ TerrainClouds::BuildClouds() az += (0.66 + rand()/32768.0) * 0.25 * PI; - if (r < BANK_SIZE) + if (r < BANK_SIZE) r += BANK_SIZE; else if (r < 1.75*BANK_SIZE) r += BANK_SIZE/4; diff --git a/Stars45/TerrainPatch.cpp b/Stars45/TerrainPatch.cpp index 309d376..1713088 100644 --- a/Stars45/TerrainPatch.cpp +++ b/Stars45/TerrainPatch.cpp @@ -175,7 +175,7 @@ const Point& p1, const Point& p2) // +--------------------------------------------------------------------+ TerrainPatch::TerrainPatch(Terrain* terr, -const Rect& r, +const Rect& r, const Point& p1, const Point& p2, double sea_level) diff --git a/Stars45/TexDX9.cpp b/Stars45/TexDX9.cpp index 5c03c07..dbbf14e 100644 --- a/Stars45/TexDX9.cpp +++ b/Stars45/TexDX9.cpp @@ -71,7 +71,7 @@ TexCacheDX9Entry::Unload() bitmap_id = 0; used_last = 0; last_modified = 0; -} +} // +--------------------------------------------------------------------+ @@ -383,7 +383,7 @@ TexCacheDX9::FreeLRU(int tries) for (int i = 0; i < DX9_TEXTURE_CACHE_SIZE; i++) { DWORD ul = cache[i].used_last; - + if (ul && ul < old && ul != frame_number) { old = ul; oldest = i; diff --git a/Stars45/TexDX9.h b/Stars45/TexDX9.h index a2bd056..ff396b4 100644 --- a/Stars45/TexDX9.h +++ b/Stars45/TexDX9.h @@ -52,7 +52,7 @@ struct VD3D_texture_format; struct TexCacheDX9Entry { - TexCacheDX9Entry() : bitmap_id(0), texture(0), used_last(0), + TexCacheDX9Entry() : bitmap_id(0), texture(0), used_last(0), last_modified(0), normal(false) { } void Release(); diff --git a/Stars45/Thruster.cpp b/Stars45/Thruster.cpp index db0c210..c3fbce6 100644 --- a/Stars45/Thruster.cpp +++ b/Stars45/Thruster.cpp @@ -198,7 +198,7 @@ Thruster::Orient(const Physical* rep) ThrusterPort* p = ports[i]; Point projector = (p->loc * orientation) + ship_loc; - + if (p->flare) p->flare->MoveTo(projector); @@ -324,11 +324,11 @@ Thruster::SetShip(Ship* s) roll_drag = design->roll_drag; pitch_drag = design->pitch_drag; yaw_drag = design->yaw_drag; - + roll_rate = (float) (design->roll_rate * PI / 180); pitch_rate = (float) (design->pitch_rate * PI / 180); yaw_rate = (float) (design->yaw_rate * PI / 180); - + double agility = design->agility; if (roll_rate == 0) roll_rate = (float) (agility * ROLL_SPEED); @@ -381,7 +381,7 @@ Thruster::ExecTrans(double x, double y, double z) if (ship->Rep() && ship->Rep()->Hidden()) show_flare = false; - if (ship->Class() == Ship::LCA && + if (ship->Class() == Ship::LCA && ship->IsAirborne() && ship->Velocity().length() < 250 && ship->AltitudeAGL() > ship->Radius()/2) { diff --git a/Stars45/Token.cpp b/Stars45/Token.cpp index 857791b..2111616 100644 --- a/Stars45/Token.cpp +++ b/Stars45/Token.cpp @@ -137,12 +137,12 @@ Token::operator = (const Token& rhs) mFullSymbol = new(__FILE__, __LINE__) char[mLength + 1]; strcpy(mFullSymbol, rhs.mFullSymbol); } - + mType = rhs.mType; mKey = rhs.mKey; mLine = rhs.mLine; mColumn = rhs.mColumn; - + return *this; } @@ -151,7 +151,7 @@ Token::operator = (const Token& rhs) bool Token::match(const Token& ref) const { - if (mType == ref.mType) { // if types match + if (mType == ref.mType) { // if types match if (ref.mLength == 0) // if no symbol to match return true; // match! @@ -166,7 +166,7 @@ Token::match(const Token& ref) const } } } - + return false; } @@ -219,12 +219,12 @@ Token::comments(const Text& begin, const Text& end) { combeg[0] = begin(0); if (begin.length() > 1) combeg[1] = begin(1); - else combeg[1] = '\0'; - + else combeg[1] = '\0'; + comend[0] = end(0); if (end.length() > 1) comend[1] = end(1); - else comend[1] = '\0'; -} + else comend[1] = '\0'; +} // +-------------------------------------------------------------------+ @@ -233,12 +233,12 @@ Token::altComments(const Text& begin, const Text& end) { altbeg[0] = begin(0); if (begin.length() > 1) altbeg[1] = begin(1); - else altbeg[1] = '\0'; - + else altbeg[1] = '\0'; + altend[0] = end(0); if (end.length() > 1) altend[1] = end(1); - else altend[1] = '\0'; -} + else altend[1] = '\0'; +} // +-------------------------------------------------------------------+ @@ -269,7 +269,7 @@ Token::typestr() const case EOT: t = "EOT"; break; case LastTokenType: t = "LastTokenType"; break; } - + return t; } @@ -292,7 +292,7 @@ Token::describe(const Text& tok) case '}' : d = "Token::RBrace"; break; default : break; } - + if (d.length() == 0) { if (isalpha(tok(0))) d = "\"" + tok + "\", Token::AlphaIdent"; @@ -305,7 +305,7 @@ Token::describe(const Text& tok) else d = "\"" + tok + "\", Token::SymbolicIdent"; } - + return d; } @@ -346,14 +346,14 @@ Scanner::operator = (const Scanner& rhs) delete [] str; str = new(__FILE__, __LINE__) char [strlen(rhs.str) + 1]; strcpy(str, rhs.str); - + index = rhs.index; old_index = rhs.old_index; length = rhs.length; line = rhs.line; old_line = rhs.old_line; lineStart = rhs.lineStart; - + return *this; } @@ -365,7 +365,7 @@ Scanner::Load(const Text& s) delete [] str; str = new(__FILE__, __LINE__) char [s.length() + 1]; strcpy(str, s.data()); - + index = 0; old_index = 0; best = Token(); @@ -403,7 +403,7 @@ Scanner::Get(Need need) } p++; } - + if (p >= eos) { if (need == Demand && reader) { Load(reader->more()); @@ -431,7 +431,7 @@ Scanner::Get(Need need) } } } - + // generic delimited comments else if (*p == Token::comBeg(0) && (!Token::comBeg(1) || *(p+1) == Token::comBeg(1))) { @@ -471,12 +471,12 @@ Scanner::Get(Need need) // use lexical sub-parser for ints and floats else if (isdigit(*p)) type = GetNumeric(); - + else if (IsSymbolic(*p)) { type = Token::SymbolicIdent; while (IsSymbolic(*p)) p++; } - + else { type = Token::AlphaIdent; while (IsAlpha(*p)) p++; @@ -489,7 +489,7 @@ Scanner::Get(Need need) index = start + extent; // advance the cursor int col = start - lineStart; if (line == 0) col++; - + char* buf = new(__FILE__, __LINE__) char [extent + 1]; strncpy(buf, str + start, extent); buf[extent] = '\0'; @@ -512,7 +512,7 @@ Scanner::Get(Need need) if (result.mType != Token::Keyword) result = Token(buf, type, 0, line+1, col); - + if (line+1 > (size_t) best.mLine || (line+1 == (size_t) best.mLine && col > best.mColumn)) best = result; @@ -535,7 +535,7 @@ Scanner::GetNumeric() } while (isdigit(*p) || *p == '_') p++; // whole number part - + if (*p == '.') { p++; // optional fract part type = Token::FloatLiteral; // implies float diff --git a/Stars45/Token.h b/Stars45/Token.h index d519d5b..489b184 100644 --- a/Stars45/Token.h +++ b/Stars45/Token.h @@ -43,7 +43,7 @@ #include "Dictionary.h" #pragma warning( disable : 4237) - + // +-------------------------------------------------------------------+ class Reader; @@ -76,9 +76,9 @@ public: Token(const char* s, int t, int k=0, int l=0, int c=0); Token(const Text& s, int t, int k=0, int l=0, int c=0); ~Token(); - + Token& operator = (const Token& rhs); - + bool match(const Token& ref) const; Text symbol() const; @@ -86,7 +86,7 @@ public: int key() const { return mKey; } int line() const { return mLine; } int column() const { return mColumn; } - + Text typestr() const; static Text describe(const Text& tok); @@ -101,7 +101,7 @@ public: static char comEnd(unsigned int i) { return comend[i]; } static char altBeg(unsigned int i) { return altbeg[i]; } static char altEnd(unsigned int i) { return altend[i]; } - + static void close(); protected: @@ -114,7 +114,7 @@ protected: int mKey; int mLine; int mColumn; - + static bool hidecom; static char combeg[3]; static char comend[3]; @@ -133,7 +133,7 @@ public: Scanner(const Text& s); Scanner(const Scanner& rhs); virtual ~Scanner(); - + Scanner& operator = (const Scanner& rhs); void Load(const Text& s); diff --git a/Stars45/TrackIR.cpp b/Stars45/TrackIR.cpp index 5cc7e2d..11c4619 100644 --- a/Stars45/TrackIR.cpp +++ b/Stars45/TrackIR.cpp @@ -106,7 +106,7 @@ static const char* NPErrString(NPRESULT r) // +--------------------------------------------------------------------+ -TrackIR::TrackIR() : +TrackIR::TrackIR() : running(false), frame_signature(0), az(0), el(0), x(0), y(0), z(0) { @@ -149,17 +149,17 @@ az(0), el(0), x(0), y(0), z(0) } - // It is *required* that your application registers the Developer ID + // It is *required* that your application registers the Developer ID // assigned by NaturalPoint! - // Your assigned developer ID needs to be inserted below! + // Your assigned developer ID needs to be inserted below! #define NP_DEVELOPER_ID 6401 - // NOTE : The title of your project must show up + // NOTE : The title of your project must show up // in the list of supported titles shown in the Profiles // tab of the TrackIR software, if it does not then the // TrackIR software will *not* transmit data to your - // application. If your title is not present in the list, + // application. If your title is not present in the list, // you may need to have the TrackIR software perform a // game list update (to download support for new Developer IDs) // using the menu item under the "Help" or "Update" menu. diff --git a/Stars45/Trail.cpp b/Stars45/Trail.cpp index e826c55..8d581db 100644 --- a/Stars45/Trail.cpp +++ b/Stars45/Trail.cpp @@ -124,7 +124,7 @@ Trail::UpdateVerts(const Point& cam_pos) Point vcam = cam_pos - head; Point vtmp = vcam.cross(head-tail); vtmp.Normalize(); - + float trail_width = (float) (width + (ntrail-i) * width * 0.1); if (i == ntrail-2) trail_width = (float) (width * 0.7); Point vlat = vtmp * trail_width; diff --git a/Stars45/Types.h b/Stars45/Types.h index cec7fae..edd2f16 100644 --- a/Stars45/Types.h +++ b/Stars45/Types.h @@ -49,9 +49,9 @@ #undef WINVER #undef _WIN32_WINDOWS #undef _WIN32_WINNT -#define WINVER 0x0500 -#define _WIN32_WINDOWS 0x0410 -#define _WIN32_WINNT 0x0500 +#define WINVER 0x0500 +#define _WIN32_WINDOWS 0x0410 +#define _WIN32_WINNT 0x0500 //#if !defined(HMONITOR_DECLARED) // #define HMONITOR_DECLARED @@ -61,15 +61,15 @@ #include #include #include -#include -#include +#include +#include #include #include #include -// Enable extra D3D debugging in debug builds if using the debug DirectX runtime. -// This makes D3D objects work well in the debugger watch window, but slows down +// Enable extra D3D debugging in debug builds if using the debug DirectX runtime. +// This makes D3D objects work well in the debugger watch window, but slows down // performance slightly. #if defined(DEBUG) | defined(_DEBUG) #define D3D_DEBUG_INFO diff --git a/Stars45/VidDlg.cpp b/Stars45/VidDlg.cpp index 3a530b6..918d1df 100644 --- a/Stars45/VidDlg.cpp +++ b/Stars45/VidDlg.cpp @@ -75,7 +75,7 @@ VidDlg::VidDlg(Screen* s, FormDef& def, BaseScreen* mgr) : FormWindow(s, 0, 0, s->Width(), s->Height()), manager(mgr), selected_mode(0), selected_detail(0), orig_gamma(128), selected_card(0), selected_tex_size(0), selected_render(0), selected_texture(0), -mode(0), tex_size(0), detail(0), texture(0), gamma(0), shadows(0), spec_maps(0), +mode(0), tex_size(0), detail(0), texture(0), gamma(0), shadows(0), spec_maps(0), bump_maps(0), lens_flare(0), corona(0), nebula(0), dust(0), apply(0), cancel(0), vid_btn(0), aud_btn(0), ctl_btn(0), opt_btn(0), mod_btn(0), closed(true) @@ -381,7 +381,7 @@ VidDlg::Apply() if (video->Height() != h) video_change = true; - + if (video->Depth() != d) video_change = true; } @@ -395,7 +395,7 @@ VidDlg::Apply() else d = 32; } - + if (Game::MaxTexSize() != t) video_change = true; } diff --git a/Stars45/Video.h b/Stars45/Video.h index e600a3f..d9b96f0 100644 --- a/Stars45/Video.h +++ b/Stars45/Video.h @@ -75,7 +75,7 @@ struct RenderStats int total_polys; int total_lines; - void Clear() { nverts = npolys = nlines = ncalls = + void Clear() { nverts = npolys = nlines = ncalls = total_verts = total_polys = total_lines = 0; } }; @@ -146,7 +146,7 @@ public: virtual ~Video(); STATUS Status() const { return status; } - virtual const VideoSettings* + virtual const VideoSettings* GetVideoSettings() const { return 0; } virtual bool SetVideoSettings(const VideoSettings* vs) { return false; } virtual bool Reset(const VideoSettings* vs) { return false; } @@ -194,9 +194,9 @@ public: virtual bool SetViewport(int x, int y, int w, int h) { return false; } virtual bool SetCamera(const Camera* cam) { camera = cam; return false; } - virtual bool SetProjection(float fov, + virtual bool SetProjection(float fov, float znear=1.0f, - float zfar=1.0e6f, + float zfar=1.0e6f, DWORD type=PROJECTION_PERSPECTIVE) { return false; } virtual bool SetEnvironment(Bitmap** faces) { return false; } virtual bool SetAmbient(Color c) { return false; } @@ -212,7 +212,7 @@ public: virtual bool DrawShadow(Solid* s, int nverts, Vec3* verts, bool vis=false) { return false; } virtual bool DrawLines(int nlines, Vec3* v, Color c, int blend=0) { return false; } - virtual bool DrawScreenLines(int nlines, float* v, Color c, int blend=0) + virtual bool DrawScreenLines(int nlines, float* v, Color c, int blend=0) { return false; } virtual bool DrawPoints(VertexSet* v) { return false; } virtual bool DrawPolyOutline(Poly* p) { return false; } diff --git a/Stars45/VideoDX9.cpp b/Stars45/VideoDX9.cpp index 397e628..0862a69 100644 --- a/Stars45/VideoDX9.cpp +++ b/Stars45/VideoDX9.cpp @@ -101,7 +101,7 @@ public: model_clients.append(model); } - virtual ~VideoDX9SurfaceData() { + virtual ~VideoDX9SurfaceData() { model_clients.remove(model); delete vertex_buffer; @@ -165,8 +165,8 @@ struct VideoDX9ScreenVertex static DWORD FVF; }; -DWORD VideoDX9ScreenVertex::FVF = D3DFVF_XYZRHW | -D3DFVF_DIFFUSE | +DWORD VideoDX9ScreenVertex::FVF = D3DFVF_XYZRHW | +D3DFVF_DIFFUSE | D3DFVF_TEX1; struct VideoDX9NormalVertex @@ -184,7 +184,7 @@ struct VideoDX9NormalVertex DWORD VideoDX9NormalVertex::FVF = 0; // Global Vertex Declaration shared by shaders -D3DVERTEXELEMENT9 videoDX9NormalVertexElements[] = +D3DVERTEXELEMENT9 videoDX9NormalVertexElements[] = { { 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 }, { 0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0 }, @@ -204,8 +204,8 @@ struct VideoDX9SolidVertex static DWORD FVF; }; -DWORD VideoDX9SolidVertex::FVF = D3DFVF_XYZ | -D3DFVF_NORMAL | +DWORD VideoDX9SolidVertex::FVF = D3DFVF_XYZ | +D3DFVF_NORMAL | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE2(0); @@ -218,8 +218,8 @@ struct VideoDX9LuminousVertex static DWORD FVF; }; -DWORD VideoDX9LuminousVertex::FVF = D3DFVF_XYZ | -D3DFVF_DIFFUSE | +DWORD VideoDX9LuminousVertex::FVF = D3DFVF_XYZ | +D3DFVF_DIFFUSE | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE2(0); @@ -234,7 +234,7 @@ struct VideoDX9DetailVertex static DWORD FVF; }; -DWORD VideoDX9DetailVertex::FVF = D3DFVF_XYZ | +DWORD VideoDX9DetailVertex::FVF = D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX2; @@ -247,7 +247,7 @@ struct VideoDX9LineVertex static DWORD FVF; }; -DWORD VideoDX9LineVertex::FVF = D3DFVF_XYZ | +DWORD VideoDX9LineVertex::FVF = D3DFVF_XYZ | D3DFVF_DIFFUSE; enum { @@ -470,7 +470,7 @@ VideoDX9::~VideoDX9() video_dx9_instance = 0; } -IDirect3DDevice9* +IDirect3DDevice9* VideoDX9::GetD3DDevice9() { if (video_dx9_instance) @@ -617,7 +617,7 @@ VideoDX9::Reset(const VideoSettings* vs) d3ddevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_NONE); D3DVIEWPORT9 view; - + hr = d3ddevice->GetViewport(&view); if (SUCCEEDED(hr)) { rect.x = view.X; @@ -890,7 +890,7 @@ VideoDX9::SetGammaLevel(int g) // compute 1/gamma float recip_gray = ReciprocalGamma(g); - + // compute i**(1/gamma) for all i and scale to range for (UINT i = 0; i < 256; i++) { int val = RampValue(i, recip_gray, f); @@ -1135,11 +1135,11 @@ VideoDX9::Capture(Bitmap& bmp) desc.Format = D3DFMT_A8R8G8B8; hr = d3ddevice->CreateOffscreenPlainSurface( - desc.Width, - desc.Height, - desc.Format, - D3DPOOL_SYSTEMMEM, - &pTempSurf, + desc.Width, + desc.Height, + desc.Format, + D3DPOOL_SYSTEMMEM, + &pTempSurf, NULL); if (FAILED(hr)) { @@ -1174,10 +1174,10 @@ VideoDX9::Capture(Bitmap& bmp) // and to do so hits performance, so copy to another surface // Must be the same format as the source surface hr = d3ddevice->CreateOffscreenPlainSurface( - desc.Width, - desc.Height, - desc.Format, - D3DPOOL_DEFAULT, + desc.Width, + desc.Height, + desc.Format, + D3DPOOL_DEFAULT, &pSurf, NULL); @@ -1203,14 +1203,14 @@ VideoDX9::Capture(Bitmap& bmp) } D3DLOCKED_RECT lockedRect; - hr = pTempSurf->LockRect(&lockedRect, NULL, + hr = pTempSurf->LockRect(&lockedRect, NULL, D3DLOCK_READONLY | D3DLOCK_NOSYSLOCK); if (FAILED(hr)) { VideoDX9Error("VideoDX9::Capture - can't lock rect", hr); RELEASE(pTempSurf); return false; - } + } // Allocate color buffer DWORD* buffer = new DWORD[desc.Width * desc.Height]; @@ -1248,7 +1248,7 @@ VideoDX9::Capture(Bitmap& bmp) *dst++ = pRow[2]; // B *dst++ = 255; - pRow += 3; + pRow += 3; break; } @@ -1315,8 +1315,8 @@ VideoDX9::SetViewport(int x, int y, int w, int h) view.Y = y; view.Width = w; view.Height = h; - view.MinZ = 0.0f; - view.MaxZ = 1.0f; + view.MinZ = 0.0f; + view.MaxZ = 1.0f; hr = d3ddevice->SetViewport(&view); if (FAILED(hr)) { @@ -1461,7 +1461,7 @@ VideoDX9::SetProjection(float fov, float znear, float zfar, DWORD type) /*** *** PERSPECTIVE PROJECTION: - ***/ + ***/ if (type == PROJECTION_PERSPECTIVE) { double xscale = width / fov; @@ -3375,7 +3375,7 @@ VideoDX9::SetupPass(int pass) d3ddevice->SetTextureStageState(1, D3DTSS_COLORARG2, D3DTA_TEXTURE); d3ddevice->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1); d3ddevice->SetTextureStageState(1, D3DTSS_ALPHAARG1, D3DTA_CURRENT); - d3ddevice->SetTextureStageState(1, D3DTSS_TEXCOORDINDEX, 0); + d3ddevice->SetTextureStageState(1, D3DTSS_TEXCOORDINDEX, 0); d3ddevice->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_MODULATE); d3ddevice->SetTextureStageState(2, D3DTSS_COLORARG1, D3DTA_CURRENT); @@ -3398,21 +3398,21 @@ VideoDX9::SetupPass(int pass) d3ddevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE); d3ddevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1); d3ddevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE); - d3ddevice->SetTextureStageState(0, D3DTSS_TEXCOORDINDEX, 0); + d3ddevice->SetTextureStageState(0, D3DTSS_TEXCOORDINDEX, 0); d3ddevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_BLENDCURRENTALPHA); d3ddevice->SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_CURRENT); d3ddevice->SetTextureStageState(1, D3DTSS_COLORARG2, D3DTA_TEXTURE); d3ddevice->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1); d3ddevice->SetTextureStageState(1, D3DTSS_ALPHAARG1, D3DTA_CURRENT); - d3ddevice->SetTextureStageState(1, D3DTSS_TEXCOORDINDEX, 0); + d3ddevice->SetTextureStageState(1, D3DTSS_TEXCOORDINDEX, 0); d3ddevice->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_BLENDTEXTUREALPHA); d3ddevice->SetTextureStageState(2, D3DTSS_COLORARG1, D3DTA_TEXTURE); d3ddevice->SetTextureStageState(2, D3DTSS_COLORARG2, D3DTA_CURRENT); d3ddevice->SetTextureStageState(2, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1); d3ddevice->SetTextureStageState(2, D3DTSS_ALPHAARG1, D3DTA_CURRENT); - d3ddevice->SetTextureStageState(2, D3DTSS_TEXCOORDINDEX, 1); + d3ddevice->SetTextureStageState(2, D3DTSS_TEXCOORDINDEX, 1); d3ddevice->SetTextureStageState(3, D3DTSS_COLOROP, D3DTOP_MODULATE); d3ddevice->SetTextureStageState(3, D3DTSS_COLORARG1, D3DTA_CURRENT); diff --git a/Stars45/VideoDX9.h b/Stars45/VideoDX9.h index 0cabf13..2e995f8 100644 --- a/Stars45/VideoDX9.h +++ b/Stars45/VideoDX9.h @@ -33,7 +33,7 @@ OVERVIEW ======== - Direct3D and Direct3D Video classes for DirectX 7 + Direct3D and Direct3D Video classes for DirectX 7 */ #ifndef VideoDX9_h @@ -67,7 +67,7 @@ public: VideoDX9(const HWND& window, VideoSettings* vs); virtual ~VideoDX9(); - virtual const VideoSettings* + virtual const VideoSettings* GetVideoSettings() const { return &video_settings; } virtual bool SetVideoSettings(const VideoSettings* vs); @@ -114,9 +114,9 @@ public: virtual bool SetEnvironment(Bitmap** faces); virtual bool SetAmbient(Color c); virtual bool SetLights(const List& lights); - virtual bool SetProjection(float fov, - float znear=1.0f, - float zfar=1.0e6f, + virtual bool SetProjection(float fov, + float znear=1.0f, + float zfar=1.0e6f, DWORD type=PROJECTION_PERSPECTIVE); virtual bool SetRenderState(RENDER_STATE state, DWORD value); virtual bool SetBlendType(int blend_type); diff --git a/Stars45/VideoDX9Enum.cpp b/Stars45/VideoDX9Enum.cpp index c2445fb..d123175 100644 --- a/Stars45/VideoDX9Enum.cpp +++ b/Stars45/VideoDX9Enum.cpp @@ -269,7 +269,7 @@ VideoDX9Enum::IsModeSupported(int w, int h, int b) const // +--------------------------------------------------------------------+ -HRESULT +HRESULT VideoDX9Enum::Enumerate() { HRESULT hr = E_FAIL; @@ -299,18 +299,18 @@ VideoDX9Enum::Enumerate() adapter_info->adapter_ordinal = ordinal; d3d->GetAdapterIdentifier(ordinal, 0, &adapter_info->adapter_identifier); - // Get list of all display modes on this adapter. + // Get list of all display modes on this adapter. // Also build a temporary list of all display adapter formats. adapter_format_list.clear(); for (size_t iaaf = 0; iaaf < allowed_adapter_format_list.size(); iaaf++) { D3DFORMAT allowed_adapter_format = allowed_adapter_format_list[iaaf]; UINT num_adapter_modes = d3d->GetAdapterModeCount(ordinal, allowed_adapter_format); - + for (UINT mode = 0; mode < num_adapter_modes; mode++) { D3DDISPLAYMODE display_mode; d3d->EnumAdapterModes(ordinal, allowed_adapter_format, mode, &display_mode); - + if (display_mode.Width < min_width || display_mode.Height < min_height || GetColorChannelBits(display_mode.Format) < min_color_bits) { @@ -335,7 +335,7 @@ VideoDX9Enum::Enumerate() } if (!contains_display_mode) adapter_format_list.push_back(display_mode.Format); - + } } @@ -381,7 +381,7 @@ VideoDX9Enum::Enumerate() // +--------------------------------------------------------------------+ -HRESULT +HRESULT VideoDX9Enum::EnumerateDevices(VideoDX9AdapterInfo* adapter_info, std::vector& adapter_format_list) { HRESULT hr = E_FAIL; @@ -396,9 +396,9 @@ VideoDX9Enum::EnumerateDevices(VideoDX9AdapterInfo* adapter_info, std::vectoradapter_ordinal = adapter_info->adapter_ordinal; device_info->device_type = dtypes[i]; - - if (FAILED(d3d->GetDeviceCaps(adapter_info->adapter_ordinal, - device_info->device_type, + + if (FAILED(d3d->GetDeviceCaps(adapter_info->adapter_ordinal, + device_info->device_type, &device_info->caps))) { delete device_info; continue; @@ -430,7 +430,7 @@ VideoDX9Enum::EnumerateDevices(VideoDX9AdapterInfo* adapter_info, std::vector& adapter_format_list) { const D3DFORMAT back_buffer_formats[] = { @@ -448,7 +448,7 @@ VideoDX9Enum::EnumerateDeviceCombos(VideoDX9DeviceInfo* device_info, std::vector D3DFORMAT a_fmt; for (size_t i = 0; i < adapter_format_list.size(); i++) { a_fmt = adapter_format_list[i]; - + D3DFORMAT b_fmt; for (int n = 0; n < 6; n++) { b_fmt = back_buffer_formats[n]; @@ -467,7 +467,7 @@ VideoDX9Enum::EnumerateDeviceCombos(VideoDX9DeviceInfo* device_info, std::vector continue; if (FAILED(d3d->CheckDeviceType(device_info->adapter_ordinal, - device_info->device_type, + device_info->device_type, a_fmt, b_fmt, win))) { @@ -475,7 +475,7 @@ VideoDX9Enum::EnumerateDeviceCombos(VideoDX9DeviceInfo* device_info, std::vector } // At this point, we have an adapter/device/adapterformat/backbufferformat/iswindowed - // DeviceCombo that is supported by the system. We still need to confirm that it's + // DeviceCombo that is supported by the system. We still need to confirm that it's // compatible with the app, and find one or more suitable depth/stencil buffer format, // multisample type, vertex processing type, and present interval. @@ -503,7 +503,7 @@ VideoDX9Enum::EnumerateDeviceCombos(VideoDX9DeviceInfo* device_info, std::vector delete device_combo; continue; } - + BuildDSMSConflictList(device_combo); BuildVertexProcessingTypeList(device_info, device_combo); @@ -522,7 +522,7 @@ VideoDX9Enum::EnumerateDeviceCombos(VideoDX9DeviceInfo* device_info, std::vector return S_OK; } -void +void VideoDX9Enum::BuildDepthStencilFormatList(VideoDX9DeviceCombo* device_combo) { const D3DFORMAT depth_stencil_formats[] = { @@ -543,14 +543,14 @@ VideoDX9Enum::BuildDepthStencilFormatList(VideoDX9DeviceCombo* device_combo) if (GetStencilBits(fmt) < min_stencil_bits) continue; - if (SUCCEEDED(d3d->CheckDeviceFormat(device_combo->adapter_ordinal, + if (SUCCEEDED(d3d->CheckDeviceFormat(device_combo->adapter_ordinal, device_combo->device_type, - device_combo->adapter_format, + device_combo->adapter_format, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, fmt))) { - if (SUCCEEDED(d3d->CheckDepthStencilMatch(device_combo->adapter_ordinal, + if (SUCCEEDED(d3d->CheckDepthStencilMatch(device_combo->adapter_ordinal, device_combo->device_type, device_combo->adapter_format, device_combo->back_buffer_format, @@ -562,10 +562,10 @@ VideoDX9Enum::BuildDepthStencilFormatList(VideoDX9DeviceCombo* device_combo) } } -void +void VideoDX9Enum::BuildMultiSampleTypeList(VideoDX9DeviceCombo* device_combo) { - const D3DMULTISAMPLE_TYPE multisample_type_array[] = { + const D3DMULTISAMPLE_TYPE multisample_type_array[] = { D3DMULTISAMPLE_NONE, D3DMULTISAMPLE_NONMASKABLE, D3DMULTISAMPLE_2_SAMPLES, @@ -590,7 +590,7 @@ VideoDX9Enum::BuildMultiSampleTypeList(VideoDX9DeviceCombo* device_combo) DWORD multisample_qual = 0; if (SUCCEEDED(d3d->CheckDeviceMultiSampleType(device_combo->adapter_ordinal, - device_combo->device_type, + device_combo->device_type, device_combo->back_buffer_format, device_combo->is_windowed, multisample_type, @@ -602,7 +602,7 @@ VideoDX9Enum::BuildMultiSampleTypeList(VideoDX9DeviceCombo* device_combo) } } -void +void VideoDX9Enum::BuildDSMSConflictList(VideoDX9DeviceCombo* device_combo) { for (size_t i = 0; i < device_combo->depth_stencil_fmt_list.size(); i++) { @@ -629,7 +629,7 @@ VideoDX9Enum::BuildDSMSConflictList(VideoDX9DeviceCombo* device_combo) } } -void +void VideoDX9Enum::BuildVertexProcessingTypeList(VideoDX9DeviceInfo* device_info, VideoDX9DeviceCombo* device_combo) { if ((device_info->caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) != 0) { @@ -647,10 +647,10 @@ VideoDX9Enum::BuildVertexProcessingTypeList(VideoDX9DeviceInfo* device_info, Vid device_combo->vertex_processing_list.push_back(SOFTWARE_VP); } -void +void VideoDX9Enum::BuildPresentIntervalList(VideoDX9DeviceInfo* device_info, VideoDX9DeviceCombo* device_combo) { - const DWORD present_interval_array[] = { + const DWORD present_interval_array[] = { D3DPRESENT_INTERVAL_IMMEDIATE, D3DPRESENT_INTERVAL_DEFAULT, D3DPRESENT_INTERVAL_ONE, @@ -661,7 +661,7 @@ VideoDX9Enum::BuildPresentIntervalList(VideoDX9DeviceInfo* device_info, VideoDX9 for (int i = 0; i < 6; i++) { DWORD interval = present_interval_array[i]; - + if (device_combo->is_windowed && i > 2) { // none of the remaining intervals are supported in windowed mode. break; @@ -678,13 +678,13 @@ VideoDX9Enum::BuildPresentIntervalList(VideoDX9DeviceInfo* device_info, VideoDX9 } } -bool +bool VideoDX9Enum::SuggestWindowSettings(VideoSettings* vs) { if (!vs) return false; - // Get display mode of primary adapter (which is assumed to be where the window + // Get display mode of primary adapter (which is assumed to be where the window // will appear) D3DDISPLAYMODE desktop_display_mode; d3d->GetAdapterDisplayMode(0, &desktop_display_mode); @@ -708,17 +708,17 @@ VideoDX9Enum::SuggestWindowSettings(VideoSettings* vs) VideoDX9DeviceCombo* device_combo = c_iter.value(); bool formats_match = (device_combo->back_buffer_format == device_combo->adapter_format); - + if (!device_combo->is_windowed) continue; - + if (device_combo->adapter_format != desktop_display_mode.Format) continue; // If we haven't found a compatible DeviceCombo yet, or if this set // is better (because it's a HAL, and/or because formats match better), // save it - if (best_device_combo == NULL || + if (best_device_combo == NULL || best_device_combo->device_type != D3DDEVTYPE_HAL && device_combo->device_type == D3DDEVTYPE_HAL || device_combo->device_type == D3DDEVTYPE_HAL && formats_match) { @@ -773,8 +773,8 @@ VideoDX9Enum::SuggestFullscreenSettings(VideoSettings* vs) WORD desired_width = vs->fullscreen_mode.width; WORD desired_height = vs->fullscreen_mode.height; - // For fullscreen, default to first HAL DeviceCombo that supports the current desktop - // display mode, or any display mode if HAL is not compatible with the desktop mode, or + // For fullscreen, default to first HAL DeviceCombo that supports the current desktop + // display mode, or any display mode if HAL is not compatible with the desktop mode, or // non-HAL if no HAL is available D3DDISPLAYMODE desktop_display_mode; D3DDISPLAYMODE best_desktop_display_mode; @@ -849,7 +849,7 @@ EndFullscreenDeviceComboSearch: continue; if (display_mode->width == desired_width && //best_desktop_display_mode.Width && - display_mode->height == desired_height && //best_desktop_display_mode.Height && + display_mode->height == desired_height && //best_desktop_display_mode.Height && display_mode->refresh == best_desktop_display_mode.RefreshRate) { // found a perfect match, so stop @@ -857,7 +857,7 @@ EndFullscreenDeviceComboSearch: break; } else if (display_mode->width == desired_width && //best_desktop_display_mode.Width && - display_mode->height == desired_height && //best_desktop_display_mode.Height && + display_mode->height == desired_height && //best_desktop_display_mode.Height && display_mode->refresh > best_desktop_display_mode.RefreshRate) { // refresh rate doesn't match, but width/height match, so keep this // and keep looking diff --git a/Stars45/VideoDX9Enum.h b/Stars45/VideoDX9Enum.h index 99e5c11..5b6d48b 100644 --- a/Stars45/VideoDX9Enum.h +++ b/Stars45/VideoDX9Enum.h @@ -33,7 +33,7 @@ OVERVIEW ======== - Direct3D and Direct3D Video classes for DirectX 7 + Direct3D and Direct3D Video classes for DirectX 7 */ #ifndef VideoDX9Enum_h diff --git a/Stars45/VideoDX9VertexBuffer.cpp b/Stars45/VideoDX9VertexBuffer.cpp index aedc41e..378265b 100644 --- a/Stars45/VideoDX9VertexBuffer.cpp +++ b/Stars45/VideoDX9VertexBuffer.cpp @@ -66,7 +66,7 @@ is_dynamic(false) is_dynamic = (usage & D3DUSAGE_DYNAMIC) ? true : false; D3DPOOL pool = is_dynamic ? D3DPOOL_DEFAULT : D3DPOOL_MANAGED; - HRESULT hr = video->D3DDevice()->CreateVertexBuffer(len, + HRESULT hr = video->D3DDevice()->CreateVertexBuffer(len, usage, format, pool, @@ -102,7 +102,7 @@ VideoDX9VertexBuffer::Lock(UINT count) if (count == 0) count = num_verts; - + if (is_dynamic) { flags = D3DLOCK_NOOVERWRITE; @@ -190,7 +190,7 @@ VideoDX9VertexBuffer::GetNextVert() const VideoDX9IndexBuffer::VideoDX9IndexBuffer(VideoDX9* dx9, UINT nind, DWORD usage) -: video(dx9), index_buffer(0), +: video(dx9), index_buffer(0), num_indices(nind), num_locked(0), next_index(0), is_dynamic(false) { @@ -200,7 +200,7 @@ is_dynamic(false) is_dynamic = (usage & D3DUSAGE_DYNAMIC) ? true : false; D3DPOOL pool = is_dynamic ? D3DPOOL_DEFAULT : D3DPOOL_MANAGED; - HRESULT hr = video->D3DDevice()->CreateIndexBuffer(len, + HRESULT hr = video->D3DDevice()->CreateIndexBuffer(len, usage, D3DFMT_INDEX16, pool, @@ -235,7 +235,7 @@ VideoDX9IndexBuffer::Lock(UINT count) if (count == 0) count = num_indices; - + if (is_dynamic) { flags = D3DLOCK_NOOVERWRITE; diff --git a/Stars45/VideoDX9VertexBuffer.h b/Stars45/VideoDX9VertexBuffer.h index d13943d..397a026 100644 --- a/Stars45/VideoDX9VertexBuffer.h +++ b/Stars45/VideoDX9VertexBuffer.h @@ -33,7 +33,7 @@ OVERVIEW ======== - Vertex and Index Buffer classes for DirectX 9 + Vertex and Index Buffer classes for DirectX 9 */ #ifndef VideoDX9VertexBuffer_h diff --git a/Stars45/VideoFactory.cpp b/Stars45/VideoFactory.cpp index 01a6216..44bb1e5 100644 --- a/Stars45/VideoFactory.cpp +++ b/Stars45/VideoFactory.cpp @@ -58,7 +58,7 @@ VideoFactory::CreateVideo(VideoSettings* vs) { if (!video) { video = (Video*) new(__FILE__,__LINE__) VideoDX9(hwnd, vs); - + if (!video) { delete video; video = 0; diff --git a/Stars45/Water.cpp b/Stars45/Water.cpp index 83457c0..d1d0a0f 100644 --- a/Stars45/Water.cpp +++ b/Stars45/Water.cpp @@ -46,7 +46,7 @@ struct WATER_REFRACT { // Vrefract = (V + refract * N) * norm float refract; - float refractNorm; + float refractNorm; DWORD diffuse; }; @@ -59,11 +59,11 @@ struct WATER_SURFACE // +--------------------------------------------------------------------+ #if defined(_X86) && !defined(_WIN64) -inline int f2i(float flt) +inline int f2i(float flt) { - volatile int n; + volatile int n; - __asm + __asm { fld flt fistp n @@ -72,7 +72,7 @@ inline int f2i(float flt) return n; } #else -inline int f2i(float flt) +inline int f2i(float flt) { return (int) flt; } @@ -117,7 +117,7 @@ Water::Init(int n, float s, float d) if (!refractInit) { WATER_REFRACT* refract = &RefractionTable[256]; - for (UINT u = 0; u < 256; u++) { + for (UINT u = 0; u < 256; u++) { float fCos0 = (float) u / (float) 256.0f; float f0 = acosf(fCos0); float fSin0 = sinf(f0); @@ -222,7 +222,7 @@ Water::CalcWaves(double seconds) Vec3 vecN; float f; - f = surface[uXN + uYN].height - surface[uXP + uYP].height; vecN.x = vecN.z = f; + f = surface[uXN + uYN].height - surface[uXP + uYP].height; vecN.x = vecN.z = f; f = surface[uX0 + uYN].height - surface[uX0 + uYP].height; vecN.z += f; f = surface[uXP + uYN].height - surface[uXN + uYP].height; vecN.x -= f; vecN.z += f; f = surface[uXN + uY0].height - surface[uXP + uY0].height; vecN.x += f; diff --git a/Stars45/Wave.h b/Stars45/Wave.h index ae31e05..a4f9fb4 100644 --- a/Stars45/Wave.h +++ b/Stars45/Wave.h @@ -50,11 +50,11 @@ struct WAVE_FMT { DWORD FMT; DWORD chunk_size; - WORD wFormatTag; - WORD nChannels; - DWORD nSamplesPerSec; - DWORD nAvgBytesPerSec; - WORD nBlockAlign; + WORD wFormatTag; + WORD nChannels; + DWORD nSamplesPerSec; + DWORD nAvgBytesPerSec; + WORD nBlockAlign; WORD wBitsPerSample; }; diff --git a/Stars45/Weapon.cpp b/Stars45/Weapon.cpp index 68b249b..e78f225 100644 --- a/Stars45/Weapon.cpp +++ b/Stars45/Weapon.cpp @@ -71,7 +71,7 @@ Weapon::Weapon(WeaponDesign* d, int nmuz, Vec3* muzzles, double az, double el) if (design->primary) abrv = Game::GetText("sys.weapon.primary.abrv"); - else + else abrv = Game::GetText("sys.weapon.secondary.abrv"); nbarrels = nmuz; @@ -251,7 +251,7 @@ Weapon::SetOwner(Ship* s) turret_base = t; } - if (!design->primary && + if (!design->primary && design->visible_stores && ammo == nbarrels && design->shot_model != 0) @@ -372,14 +372,14 @@ Weapon::ExecFrame(double seconds) if (orders == AUTO && centered) { if (energy >= design->charge && - (ammo < 0 || target && target->Integrity() >= 1) && + (ammo < 0 || target && target->Integrity() >= 1) && objective.length() < design->max_range) Fire(); } else if (orders == POINT_DEFENSE) { if (energy >= design->min_charge && - (ammo < 0 || target && target->Integrity() >= 1) && + (ammo < 0 || target && target->Integrity() >= 1) && objective.length() < design->max_range) Fire(); } @@ -427,7 +427,7 @@ Weapon::Update(SimObject* obj) beams[i] = 0; } - return SimObserver::Update(obj); + return SimObserver::Update(obj); } const char* @@ -498,7 +498,7 @@ Weapon::SetTarget(SimObject* targ, System* sub) } break; - default: + default: return; } } @@ -506,7 +506,7 @@ Weapon::SetTarget(SimObject* targ, System* sub) // if ok, target this object: if (target != targ) { target = targ; - + if (target) Observe(target); } @@ -540,8 +540,8 @@ Weapon::SelectTarget() // distance from self to target: double distance = Point(c_shot->Location() - muzzle_pts[0]).length(); - if (distance > design->min_range && - distance < design->max_range && + if (distance > design->min_range && + distance < design->max_range && distance < dist) { // check aim basket: select_locked = CanLockPoint(c_shot->Location(), az, el); @@ -673,7 +673,7 @@ Weapon::Fire() active_barrel = 0; refire += design->salvo_delay; } - } + } if (design->ripple_count > 0 && ripple_count <= 0) ripple_count = design->ripple_count-1; @@ -814,7 +814,7 @@ Weapon::FireBarrel(int n) if (energy > design->charge) shot_load = design->charge; else - shot_load = energy; + shot_load = energy; energy -= shot_load; shot->SetCharge(shot_load * availability); diff --git a/Stars45/WeaponDesign.h b/Stars45/WeaponDesign.h index d4a34f6..8220190 100644 --- a/Stars45/WeaponDesign.h +++ b/Stars45/WeaponDesign.h @@ -58,7 +58,7 @@ class WeaponDesign public: static const char* TYPENAME() { return "WeaponDesign"; } - enum CONSTANTS { + enum CONSTANTS { DMG_NORMAL=0, DMG_EMP =1, DMG_POWER =2, diff --git a/Stars45/WeaponGroup.cpp b/Stars45/WeaponGroup.cpp index 64882ff..221607a 100644 --- a/Stars45/WeaponGroup.cpp +++ b/Stars45/WeaponGroup.cpp @@ -58,7 +58,7 @@ WeaponGroup::~WeaponGroup() // +--------------------------------------------------------------------+ void -WeaponGroup::SetName(const char* n) +WeaponGroup::SetName(const char* n) { name = n; } diff --git a/Stars45/Weather.h b/Stars45/Weather.h index 36a253c..59110e9 100644 --- a/Stars45/Weather.h +++ b/Stars45/Weather.h @@ -50,8 +50,8 @@ public: Weather(); virtual ~Weather(); - enum STATE { CLEAR, - HIGH_CLOUDS, + enum STATE { CLEAR, + HIGH_CLOUDS, MODERATE_CLOUDS, OVERCAST, FOG, diff --git a/Stars45/WebBrowser.cpp b/Stars45/WebBrowser.cpp index 26da83f..3ce15c9 100644 --- a/Stars45/WebBrowser.cpp +++ b/Stars45/WebBrowser.cpp @@ -86,7 +86,7 @@ WebBrowser::OpenURL(const char* url) // +--------------------------------------------------------------------+ -void +void WebBrowser::FindDefaultBrowser() { HKEY hkey; diff --git a/Stars45/WepView.cpp b/Stars45/WepView.cpp index 7b6667c..ca71b1d 100644 --- a/Stars45/WepView.cpp +++ b/Stars45/WepView.cpp @@ -422,7 +422,7 @@ WepView::DrawOverlay() subtxt = sys->Abbreviation(); switch (sys->Status()) { case System::DEGRADED: stat = Color(255,255, 0); break; - case System::CRITICAL: + case System::CRITICAL: case System::DESTROYED: stat = Color(255, 0, 0); break; case System::MAINT: if (blink_delta < 250) diff --git a/Stars45/Window.cpp b/Stars45/Window.cpp index a8f1450..d17e32f 100644 --- a/Stars45/Window.cpp +++ b/Stars45/Window.cpp @@ -197,7 +197,7 @@ Window::ClipLine(int& x1, int& y1, int& x2, int& y2) goto clip_vertical; if (y1 == y2) - goto clip_horizontal; + goto clip_horizontal; return true; } @@ -256,7 +256,7 @@ Window::ClipLine(double& x1, double& y1, double& x2, double& y2) goto clip_vertical; if (y1 == y2) - goto clip_horizontal; + goto clip_horizontal; return true; } @@ -876,7 +876,7 @@ Window::FillEllipse(int x1, int y1, int x2, int y2, Color color, int blend) if (pts[0].y > rect.h) return; - + if (pts[2].y < 0) continue; diff --git a/Stars45/resource.h b/Stars45/resource.h index 9d38376..59a737b 100644 --- a/Stars45/resource.h +++ b/Stars45/resource.h @@ -7,7 +7,7 @@ #define IDI_ICON2 102 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 104 -- cgit v1.1