Zandronum Chat on our Discord Server Get the latest version: 3.1
Source Code

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001844Zandronum[All Projects] Bugpublic2014-06-17 18:412024-04-08 17:24
ReporterZom-B 
Assigned To 
PrioritylowSeveritycrashReproducibilityalways
StatusresolvedResolutionfixed 
PlatformMicrosoftOSWindowsOS VersionXP/Vista/7
Product Version1.2 
Target Version3.2Fixed in Version3.2 
Summary0001844: DMflags2 shotgun crashes when shotgun actor is replaced
DescriptionI have a mod where in DECORATE the Shotgun actor is replaced with ShellBox and the DoomPlayer actor is overridden with only custom weapons in Player.StartItem and Player.StartItem. The KeyConf file uses the new class which is evident in the game.

When dmflags2 has bit 2048 (Start with Shotgun), it bugs out at startup.
Steps To ReproduceMake a resource file (pk3)

Put in DECORATE:

ACTOR MarineClass : DoomPlayer
{
    Player.WeaponSlot 2, Pistol
    Player.StartItem "Pistol"
}

ACTOR MShotgunButAmmo : ShellBox Replaces Shotgun
{
}

Put in KEYCONF:

clearplayerclasses
addplayerclass MarineClass


Start Zandromun with the DOOM2.wad and this pk3, and with dmflags2=2048
Attached Fileszip file icon CrashReport.zip [^] (19,718 bytes) 2014-06-17 18:41
? file icon MOD.pk3 [^] (384 bytes) 2014-06-17 18:47

- Relationships
child of 0001845closedDusk make sv_shotgunstart work in all games and gamemodes 

-  Notes
User avatar (0009572)
Dusk (developer)
2014-06-18 13:18

'https://bitbucket.org/Torr_Samaho/zandronum-stable/pull-request/51 [^]'
User avatar (0009618)
Torr Samaho (administrator)
2014-06-21 14:46

The part of your patch which prevents the crash reported here (aka the ( pInventory->IsKindOf( RUNTIME_CLASS( AWeapon ) ) check) looks fine. If you separate it from the rest, I'll pull it.
User avatar (0009622)
Zom-B (reporter)
2014-06-21 15:49
edited on: 2014-06-21 15:49

i merely reported it for completeness (and because bugs I encounter are rarely reproducible). Don't sweat it. There are FAR more pressing bugs, like 0001469

User avatar (0009628)
Dusk (developer)
2014-06-21 19:04
edited on: 2014-06-21 19:04

How is this then?

User avatar (0009639)
Torr Samaho (administrator)
2014-06-22 06:51
edited on: 2014-06-22 06:53

Are you sure that

if (( ammo = shotgun->Ammo1 ) != NULL )
    ammo->Amount = shotgun->AmmoGive1 * 2;

is guaranteed to work? In similar code, like the LMS stuff, we always use

if ( pWeapon->Ammo1 )
{
    pInventory = player->mo->FindInventory( pWeapon->Ammo1->GetClass( ));
    if ( pInventory != NULL )
        pInventory->Amount = ...


The way you define and initialize shotgunclass is not totally straight forward to read. IMO the code would be much more readable if definition and initialization are combined to
const PClass* shotgunclass = PClass::FindClass( "Shotgun" )->ActorInfo->GetReplacement()->Class

, moved inside the scope that checks DF2_COOP_SHOTGUNSTART and a new scope for the "is weapon" check is created.

Also, if you insist on changing the behavior of the flag to make it work in non-coop game modes, fine. But then the "COOP" in the internal flag name doesn't make any sense anymore and needs to be removed.

User avatar (0009646)
Dusk (developer)
2014-06-22 10:31

Quote

Are you sure that

 if (( ammo = shotgun->Ammo1 ) != NULL )
     ammo->Amount = shotgun->AmmoGive1 * 2;

 is guaranteed to work? In similar code, like the LMS stuff, we always use

ZDoom seems to do this.. see for instance g_hexen/a_fighteraxe.cpp:


g_hexen/a_fighteraxe.cpp:79: if (player->ReadyWeapon->Ammo1->Amount)
g_hexen/a_fighteraxe.cpp:103: if (player->ReadyWeapon->Ammo1->Amount <= 0)
g_hexen/a_fighteraxe.cpp:127: if (player->ReadyWeapon->Ammo1->Amount)
g_hexen/a_fighteraxe.cpp:151: if (player->ReadyWeapon->Ammo1->Amount <= 0)
g_hexen/a_fighteraxe.cpp:175: if (player->ReadyWeapon->Ammo1->Amount)
g_hexen/a_fighteraxe.cpp:210: if (player->ReadyWeapon->Ammo1->Amount > 0)
g_hexen/a_fighteraxe.cpp:311: if ((weapon->Ammo1 == NULL || weapon->Ammo1->Amount == 0) &&


It worked just fine for me when I tested it offline and online.

Quote
Also, if you insist on changing the behavior of the flag to make it work in non-coop game modes, fine.

It doesn't make any sense to me to keep it coop-only. I think there was a ticket somewhere in here that proposed to make it available to all game modes but I cannot find it right now..

I'll work on the readability.
User avatar (0023430)
Ru5tK1ng (updater)
2024-03-19 17:05

This should fix the crash:'https://foss.heptapod.net/zandronum/zandronum-stable/-/merge_requests/72 [^]'
User avatar (0023527)
Ru5tK1ng (updater)
2024-04-07 20:30

Change was merged in:'https://foss.heptapod.net/zandronum/zandronum-stable/-/commit/00afb8d1543a5faa796719fd478e05af7d8aeca6 [^]'
User avatar (0023547)
Ru5tK1ng (updater)
2024-04-08 17:24

Tested with the latest beta and the crash no longer occurs with the example wad.

Issue Community Support
This issue is already marked as resolved.
If you feel that is not the case, please reopen it and explain why.
Supporters: No one explicitly supports this issue yet.
Opponents: No one explicitly opposes this issue yet.

- Issue History
Date Modified Username Field Change
2014-06-17 18:41 Zom-B New Issue
2014-06-17 18:41 Zom-B File Added: CrashReport.zip
2014-06-17 18:47 Zom-B File Added: MOD.pk3
2014-06-18 00:37 Dusk Assigned To => Dusk
2014-06-18 00:37 Dusk Status new => assigned
2014-06-18 13:18 Dusk Note Added: 0009572
2014-06-18 13:18 Dusk Status assigned => needs review
2014-06-18 13:19 Dusk Relationship added child of 0001845
2014-06-21 14:46 Torr Samaho Note Added: 0009618
2014-06-21 14:46 Torr Samaho Status needs review => feedback
2014-06-21 15:49 Zom-B Note Added: 0009622
2014-06-21 15:49 Zom-B Status feedback => assigned
2014-06-21 15:49 Zom-B Note Edited: 0009622 View Revisions
2014-06-21 19:04 Dusk Note Added: 0009628
2014-06-21 19:04 Dusk Status assigned => needs review
2014-06-21 19:04 Dusk Note Edited: 0009628 View Revisions
2014-06-22 06:51 Torr Samaho Note Added: 0009639
2014-06-22 06:53 Torr Samaho Note Edited: 0009639
2014-06-22 06:53 Torr Samaho Note Edited: 0009639 View Revisions
2014-06-22 06:53 Torr Samaho Note Revision Dropped: 9639: 0005116
2014-06-22 06:53 Torr Samaho Note Revision Dropped: 9639: 0005115
2014-06-22 06:53 Torr Samaho Status needs review => feedback
2014-06-22 10:31 Dusk Note Added: 0009646
2014-07-05 20:06 Torr Samaho Product Version 2.0-beta => 1.2
2024-03-19 17:05 Ru5tK1ng Note Added: 0023430
2024-03-19 17:05 Ru5tK1ng Assigned To Dusk =>
2024-03-19 17:05 Ru5tK1ng Status feedback => needs review
2024-04-07 20:30 Ru5tK1ng Note Added: 0023527
2024-04-07 20:30 Ru5tK1ng Status needs review => resolved
2024-04-07 20:30 Ru5tK1ng Target Version => 3.2
2024-04-07 20:30 Ru5tK1ng Status resolved => feedback
2024-04-07 20:30 Ru5tK1ng Resolution open => reopened
2024-04-07 20:30 Ru5tK1ng Status feedback => needs testing
2024-04-08 17:24 Ru5tK1ng Note Added: 0023547
2024-04-08 17:24 Ru5tK1ng Status needs testing => resolved
2024-04-08 17:24 Ru5tK1ng Resolution reopened => fixed
2024-04-08 17:24 Ru5tK1ng Fixed in Version => 3.2






Questions or other issues? Contact Us.

Links


Copyright © 2000 - 2024 MantisBT Team
Powered by Mantis Bugtracker