From 4f208b3b8e25eada4d8c4b8d117d31edd42c1acb Mon Sep 17 00:00:00 2001 From: Gabriel Ravier Date: Tue, 7 May 2019 12:41:39 +0200 Subject: [PATCH 1/2] Make comment style consistent Just added a space if there was no space after "//" Also I changed my regex to "((//|\;)[^ ]|(for|while|if|while|do|void|int|bool)\(|(for|while|if|while|do)\ \(.*\)\;)" Signed-off-by: Gabriel Ravier --- src/Back.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Back.cpp b/src/Back.cpp index 51b715fa..19ade92f 100644 --- a/src/Back.cpp +++ b/src/Back.cpp @@ -21,7 +21,7 @@ BOOL InitBack(const char *fName, int type) // Unused, hilariously color_black = GetCortBoxColor(RGB(0, 0, 0x10)); - //Get width and height + // Get width and height char path[PATH_LENGTH]; sprintf(path, "%s/%s.pbm", gDataPath, fName); @@ -72,7 +72,7 @@ BOOL InitBack(const char *fName, int type) fclose(fp); #endif - //Set background stuff and load texture + // Set background stuff and load texture gBack.flag = 1; if (!ReloadBitmap_File(fName, SURFACE_ID_LEVEL_BACKGROUND)) return FALSE; @@ -138,7 +138,7 @@ void PutBack(int fx, int fy) case 6: case 7: - //Sky + // Sky static unsigned int fillNext; fillNext = 0; for (int y = 0; y < WINDOW_HEIGHT - 240 + 88; y += 88) @@ -156,7 +156,7 @@ void PutBack(int fx, int fy) rect.right = 320; PutBitmap4(&grcGame, (WINDOW_WIDTH - 320) / 2, WINDOW_HEIGHT - 240, &rect, SURFACE_ID_LEVEL_BACKGROUND); - //Cloud layer 1 + // Cloud layer 1 rect.top = 88; rect.bottom = 123; rect.left = gBack.fx / 2; @@ -167,7 +167,7 @@ void PutBack(int fx, int fy) for (int i = 0; i < ((WINDOW_WIDTH - 1) / 320) + 1; i++) PutBitmap4(&grcGame, (320 * (i + 1)) - gBack.fx / 2 % 320, 88 + (WINDOW_HEIGHT - 240), &rect, SURFACE_ID_LEVEL_BACKGROUND); - //Cloud layer 2 + // Cloud layer 2 rect.top = 123; rect.bottom = 146; rect.left = gBack.fx % 320; @@ -178,7 +178,7 @@ void PutBack(int fx, int fy) for (int i = 0; i < ((WINDOW_WIDTH - 1) / 320) + 1; i++) PutBitmap4(&grcGame, (320 * (i + 1)) - gBack.fx % 320, 123 + (WINDOW_HEIGHT - 240), &rect, SURFACE_ID_LEVEL_BACKGROUND); - //Cloud layer 3 + // Cloud layer 3 rect.top = 146; rect.bottom = 176; rect.left = 2 * gBack.fx % 320; @@ -189,7 +189,7 @@ void PutBack(int fx, int fy) for (int i = 0; i < ((WINDOW_WIDTH - 1) / 320) + 1; i++) PutBitmap4(&grcGame, (320 * (i + 1)) - 2 * gBack.fx % 320, 146 + (WINDOW_HEIGHT - 240), &rect, SURFACE_ID_LEVEL_BACKGROUND); - //Cloud layer 4 + // Cloud layer 4 rect.top = 176; rect.bottom = 240; rect.left = 4 * gBack.fx % 320; @@ -248,49 +248,49 @@ void PutFront(int fx, int fy) } - //Draw black bars - if (!(g_GameFlags & 8)) //Detect if credits are running + // Draw black bars + if (!(g_GameFlags & 8)) // Detect if credits are running { - const bool fromFocus = (gStageNo == 31); //Get if we should only draw around a 320x240 area of the focus point + const bool fromFocus = (gStageNo == 31); // Get if we should only draw around a 320x240 area of the focus point - //Get focus rect + // Get focus rect int focusX = gFrame.x + (WINDOW_WIDTH << 8) - (320 << 8); int focusY = gFrame.y + (WINDOW_HEIGHT << 8) - (240 << 8); int focusR = focusX + (320 << 9); int focusB = focusY + (240 << 9); - //Get borders + // Get borders const int barLeft = fromFocus ? focusX : -0x1000; const int barTop = fromFocus ? focusY : -0x1000; const int barRight = fromFocus ? focusR : (gMap.width << 13) - 0x1000; const int barBottom = fromFocus ? focusB : (gMap.length << 13) - 0x1000; - //Draw bars + // Draw bars RECT barRect; - //Left + // Left barRect.left = 0; barRect.top = 0; barRect.right = (barLeft - gFrame.x) >> 9; barRect.bottom = WINDOW_HEIGHT; CortBox(&barRect, 0x000000); - //Top + // Top barRect.left = 0; barRect.top = 0; barRect.right = WINDOW_WIDTH; barRect.bottom = (barTop - gFrame.y) >> 9; CortBox(&barRect, 0x000000); - //Right + // Right barRect.left = (barRight - gFrame.x) >> 9; barRect.top = 0; barRect.right = WINDOW_WIDTH; barRect.bottom = WINDOW_HEIGHT; CortBox(&barRect, 0x000000); - //Bottom + // Bottom barRect.left = 0; barRect.top = (barBottom - gFrame.y) >> 9; barRect.right = WINDOW_WIDTH; From 1790f7485778d59cc43eb5d214432afd3f806368 Mon Sep 17 00:00:00 2001 From: Gabriel Ravier Date: Tue, 7 May 2019 14:07:07 +0200 Subject: [PATCH 2/2] Removed bad parentheses spacing Basically for all "( expr )" I removed the spaces to be consistent with the rest Also I used this enormous regex here : "((//|\;)[^ \t]|(for|while|if|while|do|void|int|bool)\(|(for|while|if|while|do)\ \(.*\)\;|\(\ |\ \))" Signed-off-by: Gabriel Ravier --- src/ArmsItem.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ArmsItem.cpp b/src/ArmsItem.cpp index bd616612..aba1bbea 100644 --- a/src/ArmsItem.cpp +++ b/src/ArmsItem.cpp @@ -158,9 +158,9 @@ void MoveCampCursor() { int arms_num = 0; int item_num = 0; - while ( gArmsData[arms_num].code != 0 ) + while (gArmsData[arms_num].code != 0) ++arms_num; - while ( gItemData[item_num].code != 0 ) + while (gItemData[item_num].code != 0) ++item_num; if (arms_num == 0 && item_num == 0) @@ -228,9 +228,9 @@ void MoveCampCursor() bChange = TRUE; } - if ( gKeyTrg & gKeyDown ) + if (gKeyTrg & gKeyDown) { - if ( gSelectedItem / 6 == (item_num - 1) / 6 ) + if (gSelectedItem / 6 == (item_num - 1) / 6) gCampActive = FALSE; else gSelectedItem += 6; @@ -325,7 +325,7 @@ void PutCampObject() PutNumber4(40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 160) / 2, gArmsData[i].level, 0); // Draw ammo - if ( gArmsData[i].max_num ) + if (gArmsData[i].max_num) { PutNumber4(40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 144) / 2, gArmsData[i].num, 0); PutNumber4(40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 128) / 2, gArmsData[i].max_num, 0);