cato-a / CoDaM_MiscMod

Official MiscMod for CoDaM in Call of Duty 1.1
BSD 3-Clause "New" or "Revised" License
15 stars 5 forks source link

"replay this map" doesn't indicate gametype #5

Closed ghost closed 1 year ago

ghost commented 1 year ago

Hello

A map is included twice in the mapRotation of my server, with different gametype

On this map, mapvote displays twice "replay this map" without indicating gametype, as you could see on the following screenshot :

missing gametype replay

On other maps, mapvote displays twice the map, indicating gametype.

Could you do something for that please ?

cato-a commented 1 year ago

Hi, you probably have too few maps left in the rotation. Add one more map to the rotation and you should have 4 maps displayed. You need to have at least 4 unique maps left in the rotation.

ghost commented 1 year ago

@cato-a There are 4 unique maps in the rotation

Here it is : gametype dm map zh_king map mp_harbor gametype tdm map suldal_harbor gametype sd map german_town map zh_king

cato-a commented 1 year ago

Yes you have 4 unique maps, but one map is used for "replay this map", so you only have 3 unique maps left in the rotation.

ghost commented 1 year ago

I just realized that the two replay choices are the same gametype.

I'm trying to change that and will make a pull request if I succeed.

cato-a commented 1 year ago

There is no issue here. You need to add 1 more map so that you have enough unique maps in the rotation (4 unique maps in rotation + "replay this map" = 5 unique maps in total). For the rotation to work you need to have a minimum of 5 unique maps.

ghost commented 1 year ago

For my servers, I want all the possibilities to be displayed in mapvote, so I have 5 in maprotation.

Here is how it looks on the maps that are not the one included twice :

ok Exactly what I want.

And here is how it looks on the map included twice :

not ok


For me it's a problem that's why I try to modify the behavior.

cato-a commented 1 year ago

Yes, I understand, but MiscMod support unique maps, not duplicate maps. The bug is rather duplicate maps show up in the vote if the gametype is different. So "replay this map" and "mystery map" will remove any non-unique maps.

So to do what you want you must edit _mm_mapvote.gsc

Find this code and comment it out/delete (line 465/466):

    if(codam\_mm_mmm::in_array(mapRotation, level.mmmapname))
        mapRotation = codam\_mm_mmm::array_remove(mapRotation, level.mmmapname, true);

Replace (from line 502) with something like this:

            case "map":
                if((i + 1) < mapRotation.size
                    && (lastgt != level.mmgametype || mapRotation[i + 1] != level.mmmapname)) {
                    _tmp[_tmp.size]["gametype"] = lastgt;
                    _tmp[_tmp.size - 1]["map"]  = mapRotation[i + 1];
                }

                i += 2;
            break;

Try it out and see if it works.

ghost commented 1 year ago

I thank you very much for your help, I tried after modifying _mm_mapvote.gsc doing exactly what you wrote.

On the duplicated map (zh_king) DM, here is how it looks now :

current dm

When voted for the SD version, the game goes back to main menu without trying to load the map and displays this error :

dm to sd bomb error

It seems there is no problem after entering /reconnect.


On the duplicated map SD, here is how it looks now :

current sd

When voted for the DM version, the team menu appears (like just arrived on the server), without loading the map. It seems there is no gameplay problem.


I will try to fix that, if I succeed I will explain here how I done it. Any info / ideas would be appreciated.

ghost commented 1 year ago

It looks that StartGameType is not called

cato-a commented 1 year ago

Different objects are precached in DM and SD gametype, so when it doesn't do a full map reload you get kicked out if those precaches are missing. It seems it doesn't do a full map reload when the rotation goes to same map.

It works from SD to DM because all the objects DM needs are precached in SD. I guess you could try to precache it always and see if it works. And repeat for every other errors.

precacheModel("xmodel/mp_bomb1_defuse");

At least the code I made for you worked.

ghost commented 1 year ago

Thank you very much, it works now.

Here is how I done it : mapvote_replay_othergametype.zip

I will probably create a repository if I make something powerful, such as reading maprotation instead of having to manually detect maps etc