image map vote

Newbie Spellweaver
Joined
Apr 5, 2024
Messages
55
Reaction score
1
The map images are not appearing in the vote. Could it be that there is some code being used?
I put it in the source and in the xml and the images in interface/mapgb.mrs
It works normally but does not show the images

C++:
case MC_MATCH_RANDOM_MAPS:
    {
        int nRandomIndex[3];
        pCommand->GetParameter(&nRandomIndex[0], 0, MPT_INT);
        pCommand->GetParameter(&nRandomIndex[1], 1, MPT_INT);
        pCommand->GetParameter(&nRandomIndex[2], 2, MPT_INT);
        ZIDLResource* pResource = ZGetGameInterface()->GetIDLResource();
        ZIDLResource* m_IDLResource = ZGetGameInterface()->GetIDLResource();
        char Name[128];
        for (int i = 0; i < 3; i++)
        {
            sprintf(Name, "PlayerVoteMapName%d", i);
            MLabel* pLabel = (MLabel*)pResource->FindWidget(Name);
            if (pLabel)
            {
                pLabel->SetText(MGetMapDescMgr()->GetMapName(nRandomIndex[i]));

                m_pSelectorImg0 = new MBitmapR2;
                char szFileName0[256];
                sprintf(szFileName0, "interface/mapgb/%s", MGetMapDescMgr()->GetMapImageName(MGetMapDescMgr()->GetMapName(nRandomIndex[0])));
                ((MBitmapR2*)m_pSelectorImg0)->Create("SelectorImg.png", RGetDevice(), szFileName0);
                if (m_pSelectorImg0)
                {
                    MPicture* pPicture = (MPicture*)m_IDLResource->FindWidget("MapSelectorImg0");
                    if (pPicture)
                        pPicture->SetBitmap(m_pSelectorImg0->GetSourceBitmap());
                }

                m_pSelectorImg1 = new MBitmapR2;
                char szFileName1[256];
                sprintf(szFileName1, "interface/mapgb/%s", MGetMapDescMgr()->GetMapImageName(MGetMapDescMgr()->GetMapName(nRandomIndex[1])));
                ((MBitmapR2*)m_pSelectorImg1)->Create("SelectorImg.png", RGetDevice(), szFileName1);
                if (m_pSelectorImg1)
                {
                    MPicture* pPicture = (MPicture*)m_IDLResource->FindWidget("MapSelectorImg1");
                    if (pPicture)
                        pPicture->SetBitmap(m_pSelectorImg1->GetSourceBitmap());
                }

                m_pSelectorImg2 = new MBitmapR2;
                char szFileName2[256];
                sprintf(szFileName2, "interface/mapgb/%s", MGetMapDescMgr()->GetMapImageName(MGetMapDescMgr()->GetMapName(nRandomIndex[2])));
                ((MBitmapR2*)m_pSelectorImg2)->Create("SelectorImg.png", RGetDevice(), szFileName2);
                if (m_pSelectorImg2)
                {
                    MPicture* pPicture = (MPicture*)m_IDLResource->FindWidget("MapSelectorImg2");
                    if (pPicture)
                        pPicture->SetBitmap(m_pSelectorImg2->GetSourceBitmap());
                }
            }
        }
        ZGetGameInterface()->OnArrangedTeamGameUI(true, true);
        ZGetGameClient()->bMatching = true;
    }
    break;

XML:
    <!-- Map Selector -->
    <FRAME item="MapSelector">
    <FRAMELOOK>DefaultFrameLook</FRAMELOOK>
        <BOUNDS>
            <X>150</X>
            <Y>110</Y>
            <W>600</W>
            <H>250</H>
        </BOUNDS>
        <ALIGN>
            <HALIGN>center</HALIGN>
            <VALIGN>center</VALIGN>
        </ALIGN>
        <VISIBLE>false</VISIBLE>
        <MOVABLE>false</MOVABLE>
        <RESIZABLE>false</RESIZABLE>
        <TEXT></TEXT>
    </FRAME>
    
    <PICTURE item="MapSelectorImg0" parent="MapSelector">
        <BOUNDS>
            <X>27</X>
            <Y>37</Y>
            <W>162</W>
            <H>162</H>
        </BOUNDS>
        <STRETCH/>
        <BITMAP></BITMAP>
    </PICTURE>
    
    <LABEL item="PlayerVoteMapName0" parent="MapSelector">
        <FONT>FONTa10b</FONT>
        <TEXTCOLOR>
            <R>0</R>
            <G>150</G>
            <B>255</B>
        </TEXTCOLOR>
        <BOUNDS>
            <X>90</X>
            <Y>210</Y>
            <W>110</W>
            <H>28</H>
        </BOUNDS>
        <TEXT></TEXT>
        <SELECTED>true</SELECTED>
    </LABEL>
    
    <LABEL item="PlayerVoteMap0" parent="MapSelector">
        <FONT>FONTa5b</FONT>
        <TEXTCOLOR>
            <R>200</R>
            <G>200</G>
            <B>200</B>
        </TEXTCOLOR>
        <BOUNDS>
            <X>90</X>
            <Y>225</Y>
            <W>110</W>
            <H>28</H>
        </BOUNDS>
        <TEXT>Votes: 0</TEXT>
        <SELECTED>true</SELECTED>
    </LABEL>

    <BMBUTTON item="PlayerVoteMapButton0" parent="MapSelector">
        <BUTTONLOOK>NormalBmButtonLook</BUTTONLOOK>
        <BOUNDS>
            <X>27</X>
            <Y>37</Y>
            <W>162</W>
            <H>162</H>
        </BOUNDS>
        <STRETCH/>
        <BITMAP type="up">select_cw_map_off.png</BITMAP>
        <BITMAP type="over">select_cw_map_on.png</BITMAP>
        <BITMAP type="down">select_cw_map_on.png</BITMAP>
    </BMBUTTON>
    
    <PICTURE item="MapSelectorImg1" parent="MapSelector">
        <BOUNDS>
            <X>220</X>
            <Y>37</Y>
            <W>162</W>
            <H>162</H>
        </BOUNDS>
        <STRETCH/>
        <BITMAP></BITMAP>
    </PICTURE>
    
    <LABEL item="PlayerVoteMapName1" parent="MapSelector">
        <FONT>FONTa10b</FONT>
        <TEXTCOLOR>
            <R>0</R>
            <G>150</G>
            <B>255</B>
        </TEXTCOLOR>
        <BOUNDS>
            <X>280</X>
            <Y>210</Y>
            <W>110</W>
            <H>28</H>
        </BOUNDS>
        <TEXT></TEXT>
        <SELECTED>true</SELECTED>
    </LABEL>
    
    <LABEL item="PlayerVoteMap1" parent="MapSelector">
        <FONT>FONTa5b</FONT>
        <TEXTCOLOR>
            <R>200</R>
            <G>200</G>
            <B>200</B>
        </TEXTCOLOR>
        <BOUNDS>
            <X>280</X>
            <Y>225</Y>
            <W>110</W>
            <H>28</H>
        </BOUNDS>
        <TEXT>Votes: 0</TEXT>
        <SELECTED>true</SELECTED>
    </LABEL>

    <BMBUTTON item="PlayerVoteMapButton1" parent="MapSelector">
        <BUTTONLOOK>NormalBmButtonLook</BUTTONLOOK>
        <BOUNDS>
            <X>220</X>
            <Y>37</Y>
            <W>162</W>
            <H>160</H>
        </BOUNDS>
        <STRETCH/>
        <BITMAP type="up">select_cw_map_off.png</BITMAP>
        <BITMAP type="over">select_cw_map_on.png</BITMAP>
        <BITMAP type="down">select_cw_map_on.png</BITMAP>
    </BMBUTTON>
    
    <PICTURE item="MapSelectorImg2" parent="MapSelector">
        <BOUNDS>
            <X>410</X>
            <Y>37</Y>
            <W>162</W>
            <H>162</H>
        </BOUNDS>
        <STRETCH/>
        <BITMAP></BITMAP>
    </PICTURE>
    
    <LABEL item="PlayerVoteMapName2" parent="MapSelector">
        <FONT>FONTa10b</FONT>
        <TEXTCOLOR>
            <R>0</R>
            <G>150</G>
            <B>255</B>
        </TEXTCOLOR>
        <BOUNDS>
            <X>470</X>
            <Y>210</Y>
            <W>110</W>
            <H>28</H>
        </BOUNDS>
        <TEXT></TEXT>
        <SELECTED>true</SELECTED>
    </LABEL>
    
    <LABEL item="PlayerVoteMap2" parent="MapSelector">
        <FONT>FONTa5b</FONT>
        <TEXTCOLOR>
            <R>200</R>
            <G>200</G>
            <B>200</B>
        </TEXTCOLOR>
        <BOUNDS>
            <X>470</X>
            <Y>225</Y>
            <W>110</W>
            <H>28</H>
        </BOUNDS>
        <TEXT>Votes: 0</TEXT>
        <SELECTED>true</SELECTED>
    </LABEL>

    <BMBUTTON item="PlayerVoteMapButton2" parent="MapSelector">
        <BUTTONLOOK>NormalBmButtonLook</BUTTONLOOK>
        <BOUNDS>
            <X>410</X>
            <Y>37</Y>
            <W>162</W>
            <H>162</H>
        </BOUNDS>
        <STRETCH/>
        <BITMAP type="up">select_cw_map_off.png</BITMAP>
        <BITMAP type="over">select_cw_map_on.png</BITMAP>
        <BITMAP type="down">select_cw_map_on.png</BITMAP>
    </BMBUTTON>
 
Server Information
gunz 1.5
Back