From 5b55d8070dbe90c66054193f6d612a4332a0ff8c Mon Sep 17 00:00:00 2001 From: dbrackett16 Date: Tue, 6 Jan 2015 11:52:58 -0500 Subject: Fixed Missing File in project --- codeblocks/doom.cbp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/codeblocks/doom.cbp b/codeblocks/doom.cbp index 41cb7d2d..53cbdf86 100644 --- a/codeblocks/doom.cbp +++ b/codeblocks/doom.cbp @@ -114,6 +114,9 @@ + + -- cgit v1.2.3 From 6d6375349747e1870f9c74bc950bfd25b6bb2b51 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 19 Jan 2015 21:50:28 -0500 Subject: Add extra checks to weapon cycling loops. Ensure that the loops to find the next weapon always terminate - even if there are somehow no weapons equipped. Also, only ever do weapon cycling when in the GS_LEVEL gamestate. This fixes #503 - thanks to Fabian and raithe on Doomworld. --- src/doom/g_game.c | 13 +++++++------ src/heretic/g_game.c | 11 ++++++----- src/hexen/g_game.c | 12 ++++++++---- src/strife/g_game.c | 11 ++++++----- 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/src/doom/g_game.c b/src/doom/g_game.c index 0b9dda08..64f5b274 100644 --- a/src/doom/g_game.c +++ b/src/doom/g_game.c @@ -281,7 +281,7 @@ static boolean WeaponSelectable(weapontype_t weapon) static int G_NextWeapon(int direction) { weapontype_t weapon; - int i; + int start_i, i; // Find index in the table. @@ -302,13 +302,13 @@ static int G_NextWeapon(int direction) } } - // Switch weapon. - + // Switch weapon. Don't loop forever. + start_i = i; do { i += direction; i = (i + arrlen(weapon_order_table)) % arrlen(weapon_order_table); - } while (!WeaponSelectable(weapon_order_table[i].weapon)); + } while (i != start_i && !WeaponSelectable(weapon_order_table[i].weapon)); return weapon_order_table[i].weapon_num; } @@ -445,12 +445,11 @@ void G_BuildTiccmd (ticcmd_t* cmd, int maketic) // next_weapon variable is set to change weapons when // we generate a ticcmd. Choose a new weapon. - if (next_weapon != 0) + if (gamestate == GS_LEVEL && next_weapon != 0) { i = G_NextWeapon(next_weapon); cmd->buttons |= BT_CHANGE; cmd->buttons |= i << BT_WEAPONSHIFT; - next_weapon = 0; } else { @@ -469,6 +468,8 @@ void G_BuildTiccmd (ticcmd_t* cmd, int maketic) } } + next_weapon = 0; + // mouse if (mousebuttons[mousebforward]) { diff --git a/src/heretic/g_game.c b/src/heretic/g_game.c index 389c0e1d..1154925a 100644 --- a/src/heretic/g_game.c +++ b/src/heretic/g_game.c @@ -228,7 +228,7 @@ static boolean WeaponSelectable(weapontype_t weapon) static int G_NextWeapon(int direction) { weapontype_t weapon; - int i; + int start_i, i; // Find index in the table. @@ -249,13 +249,13 @@ static int G_NextWeapon(int direction) } } - // Switch weapon. - + // Switch weapon. Don't loop forever. + start_i = i; do { i += direction; i = (i + arrlen(weapon_order_table)) % arrlen(weapon_order_table); - } while (!WeaponSelectable(weapon_order_table[i].weapon)); + } while (i != start_i && !WeaponSelectable(weapon_order_table[i].weapon)); return weapon_order_table[i].weapon_num; } @@ -466,7 +466,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, int maketic) // we generate a ticcmd. Choose a new weapon. // (Can't weapon cycle when the player is a chicken) - if (players[consoleplayer].chickenTics == 0 && next_weapon != 0) + if (gamestate == GS_LEVEL + && players[consoleplayer].chickenTics == 0 && next_weapon != 0) { i = G_NextWeapon(next_weapon); cmd->buttons |= BT_CHANGE; diff --git a/src/hexen/g_game.c b/src/hexen/g_game.c index 6d10dcfd..3593ffe2 100644 --- a/src/hexen/g_game.c +++ b/src/hexen/g_game.c @@ -451,9 +451,11 @@ void G_BuildTiccmd(ticcmd_t *cmd, int maketic) // Weapon cycling. Switch to previous or next weapon. // (Disabled when player is a pig). - - if (players[consoleplayer].morphTics == 0 && next_weapon != 0) + if (gamestate == GS_LEVEL + && players[consoleplayer].morphTics == 0 && next_weapon != 0) { + int start_i; + if (players[consoleplayer].pendingweapon == WP_NOCHANGE) { i = players[consoleplayer].readyweapon; @@ -463,9 +465,11 @@ void G_BuildTiccmd(ticcmd_t *cmd, int maketic) i = players[consoleplayer].pendingweapon; } + // Don't loop forever. + start_i = i; do { - i = (i + next_weapon) % NUMWEAPONS; - } while (!players[consoleplayer].weaponowned[i]); + i = (i + next_weapon + NUMWEAPONS) % NUMWEAPONS; + } while (i != start_i && !players[consoleplayer].weaponowned[i]); cmd->buttons |= BT_CHANGE; cmd->buttons |= i << BT_WEAPONSHIFT; diff --git a/src/strife/g_game.c b/src/strife/g_game.c index 8d074a1f..e0c0ae27 100644 --- a/src/strife/g_game.c +++ b/src/strife/g_game.c @@ -289,7 +289,7 @@ static boolean WeaponSelectable(weapontype_t weapon) static int G_NextWeapon(int direction) { weapontype_t weapon; - int i; + int start_i, i; // Find index in the table. @@ -311,12 +311,12 @@ static int G_NextWeapon(int direction) } // Switch weapon. - + start_i = i; do { i += direction; i = (i + arrlen(weapon_order_table)) % arrlen(weapon_order_table); - } while (!WeaponSelectable(weapon_order_table[i].weapon)); + } while (i != start_i && !WeaponSelectable(weapon_order_table[i].weapon)); return weapon_order_table[i].weapon_num; } @@ -511,12 +511,11 @@ void G_BuildTiccmd (ticcmd_t* cmd, int maketic) // next_weapon variable is set to change weapons when // we generate a ticcmd. Choose a new weapon. - if (next_weapon != 0) + if (gamestate == GS_LEVEL && next_weapon != 0) { i = G_NextWeapon(next_weapon); cmd->buttons |= BT_CHANGE; cmd->buttons |= i << BT_WEAPONSHIFT; - next_weapon = 0; } else { @@ -535,6 +534,8 @@ void G_BuildTiccmd (ticcmd_t* cmd, int maketic) } } + next_weapon = 0; + // mouse if (mousebuttons[mousebforward]) { -- cgit v1.2.3 From e1f905cd3c481d561f2faf8c80e800cffe4d2035 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 19 Jan 2015 23:29:53 -0500 Subject: PHILOSOPHY: Expand discussion on minimalism. More self-indulgent ramblings about philosophy of software design. --- PHILOSOPHY | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/PHILOSOPHY b/PHILOSOPHY index 10d5ce7e..e84e5584 100644 --- a/PHILOSOPHY +++ b/PHILOSOPHY @@ -155,14 +155,7 @@ something that is useful for people making Vanilla format maps. On the other hand, painstakingly emulating Vanilla Doom by starting with no sound or music by default is not helpful to anyone. -== Other philosophical aspects == - -Chocolate Doom aims for maximal portability. That includes running on -many different CPUs, different operating systems and different devices -(ie. not just a desktop machine with a keyboard and mouse). - -Chocolate Doom is and will always remain Free Software. It will never -include code that is not compatible with the GNU GPL. +== Minimalism == Chocolate Doom aims to be minimalist and straightforward to configure; in particular, the setup tool should have a sane interface. Part of @@ -180,5 +173,28 @@ the setup tool. The assumption is that if you care enough about those obscure features, editing a configuration file by hand should not be a huge problem for you. +Also inspirational was the README file from Havoc's Metacity window +manager, where the list of features begins: + + Boring window manager for the adult in you. Many window managers + are like Marshmallow Froot Loops; Metacity is like Cheerios. + +I'd like to think that Chocolate Doom's philosophy towards features is +similar. The idea is for a source port that is boring. I find the best +software - both proprietary and open source - is software that is +"egoless": it does a job well without pretentions about its importance +or delusions of grandeur. A couple of other notable examples of +software that I feel embody this spirit of design in a beautiful way +are Marco Pesenti Gritti's Epiphany web browser and Evince PDF viewer. + +== Other philosophical aspects == + +Chocolate Doom aims for maximal portability. That includes running on +many different CPUs, different operating systems and different devices +(ie. not just a desktop machine with a keyboard and mouse). + +Chocolate Doom is and will always remain Free Software. It will never +include code that is not compatible with the GNU GPL. + # vim: tw=70 -- cgit v1.2.3