Xonotic
dialog_multiplayer_create_mapinfo.qc File Reference
#include "dialog_multiplayer_create_mapinfo.qh"
#include "button.qh"
#include "image.qh"
#include "maplist.qh"
#include "textlabel.qh"
#include <common/mapinfo.qh>
+ Include dependency graph for dialog_multiplayer_create_mapinfo.qc:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void XonoticMapInfoDialog_fill (entity me)
 
void XonoticMapInfoDialog_loadMapInfo (entity me, int i, entity mlb)
 

Function Documentation

◆ XonoticMapInfoDialog_fill()

void XonoticMapInfoDialog_fill ( entity  me)

Definition at line 39 of file dialog_multiplayer_create_mapinfo.qc.

References entity(), makeXonoticImage(), makeXonoticTextLabel(), and string_null.

40 {
41  entity e;
42  int i;
43  float w, wgt, n;
44  me.TR(me);
45  me.TDempty(me, 0.2);
46  me.TD(me, me.rows - 2, 3, e = makeXonoticImage(string_null, 4.0/3.0));
47  me.previewImage = e;
48  me.gotoRC(me, 0, 3.5); me.setFirstColumn(me, me.currentColumn);
49  w = me.columns - me.currentColumn;
50  me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Title:")));
51  me.TD(me, 1, w-1, e = makeXonoticTextLabel(0, ""));
52  e.colorL = SKINCOLOR_MAPLIST_TITLE;
53  e.allowCut = 1;
54  me.titleLabel = e;
55  me.TR(me);
56  me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Author:")));
57  me.TD(me, 1, w-1, e = makeXonoticTextLabel(0, ""));
58  e.colorL = SKINCOLOR_MAPLIST_AUTHOR;
59  e.allowCut = 1;
60  me.authorLabel = e;
61  me.TR(me);
62  me.TD(me, 1, w, e = makeXonoticTextLabel(0, _("Game types:")));
63 
64  n = ceil(GameType_GetTotalCount() / (me.rows - 6));
65  wgt = (w - 0.2) / n;
66  for(i = 0; i < GameType_GetTotalCount(); ++i)
67  {
68  if(mod(i, n) == 0)
69  {
70  me.TR(me);
71  me.TDempty(me, 0.2);
72  }
73  me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, MapInfo_Type_ToText(GameType_GetID(i))));
74  me.(typeLabels[i]) = e;
75  }
76 
77  me.gotoRC(me, me.rows - 2, 0);
78  me.TD(me, 1, me.columns, e = makeXonoticTextLabel(0.5, ""));
79  e.allowCut = 1;
80  me.descriptionLabel = e;
81 
82  me.gotoRC(me, me.rows - 1, 0);
83  me.TDempty(me, 0.5);
84 
85  me.TD(me, 1, me.columns - 5.5, e = makeXonoticButton(_("Close"), '0 0 0'));
86  e.onClick = Dialog_Close;
87  e.onClickEntity = me;
88  me.TD(me, 1, me.columns - 5.5, me.startButton = e = makeXonoticButton(ZCTX(_("MAP^Play")), '0 0 0'));
89  me.startButton.onClick = MapList_LoadMap;
90  me.startButton.onClickEntity = NULL; // filled later
91 }
string string_null
Definition: nil.qh:9
entity() spawn
entity makeXonoticTextLabel(float theAlign, string theText)
Definition: textlabel.qc:3
string MapInfo_Type_ToText(Gametype t)
Definition: mapinfo.qc:621
void MapList_LoadMap(entity btn, entity me)
Definition: maplist.qc:269
#define ZCTX(s)
Definition: i18n.qh:68
#define NULL
Definition: post.qh:17
entity makeXonoticImage(string theImage, float theAspect)
Definition: image.qc:3
+ Here is the call graph for this function:

◆ XonoticMapInfoDialog_loadMapInfo()

void XonoticMapInfoDialog_loadMapInfo ( entity  me,
int  i,
entity  mlb 
)

Definition at line 9 of file dialog_multiplayer_create_mapinfo.qc.

References draw_PictureSize(), entity(), GameType_GetID(), GameType_GetTotalCount(), MapInfo_ClearTemps(), MapInfo_Get_ByID(), MapInfo_Map_author, MapInfo_Map_bspname, MapInfo_Map_description, MapInfo_Map_supportedGametypes, MapInfo_Map_title, strcat(), and strcpy.

10 {
11  me.currentMapIndex = i;
12  me.startButton.onClickEntity = mlb;
14 
15  strcpy(me.currentMapBSPName, MapInfo_Map_bspname);
16  strcpy(me.currentMapTitle, strdecolorize(MapInfo_Map_title));
17  strcpy(me.currentMapAuthor, strdecolorize(MapInfo_Map_author));
18  strcpy(me.currentMapDescription, MapInfo_Map_description);
19  strcpy(me.currentMapPreviewImage, strcat("/maps/", MapInfo_Map_bspname));
20 
21  me.frame.setText(me.frame, me.currentMapBSPName);
22  me.titleLabel.setText(me.titleLabel, me.currentMapTitle);
23  me.authorLabel.setText(me.authorLabel, me.currentMapAuthor);
24  me.descriptionLabel.setText(me.descriptionLabel, me.currentMapDescription);
25  if(draw_PictureSize(me.currentMapPreviewImage) == '0 0 0')
26  me.previewImage.src = "nopreview_map";
27  else
28  me.previewImage.src = me.currentMapPreviewImage;
29 
30  for(i = 0; i < GameType_GetTotalCount(); ++i)
31  {
32  entity e;
33  e = me.(typeLabels[i]);
34  e.disabled = !(MapInfo_Map_supportedGametypes & GameType_GetID(i).m_flags);
35  }
36 
38 }
entity() spawn
bool MapInfo_Get_ByID(int i)
Definition: mapinfo.qc:256
string MapInfo_Map_description
Definition: mapinfo.qh:9
#define strcpy(this, s)
Definition: string.qh:49
string MapInfo_Map_author
Definition: mapinfo.qh:10
int MapInfo_Map_supportedGametypes
Definition: mapinfo.qh:13
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
void MapInfo_ClearTemps()
Definition: mapinfo.qc:1299
string MapInfo_Map_title
Definition: mapinfo.qh:7
string MapInfo_Map_bspname
Definition: mapinfo.qh:6
+ Here is the call graph for this function: