Xonotic
credits.qc File Reference
#include "credits.qh"
+ Include dependency graph for credits.qc:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _CREDITS_PERSON(p)   CREDITS_PERSON(#p)
 
#define CREDITS(TITLE, FUNCTION, PERSON, PERSON_, NL)
 
#define CREDITS_FUNCTION(f)   credits_add_line(fh, n, CREDITS_TYPE_FUNCTION, f);
 
#define CREDITS_NL()   credits_add_line(fh, n, CREDITS_TYPE_NL, "");
 
#define CREDITS_PERSON(p)   credits_add_line(fh, n, CREDITS_TYPE_PERSON, p);
 
#define CREDITS_TITLE(t)   credits_add_line(fh, n, CREDITS_TYPE_TITLE, t);
 

Functions

void credits_add_line (int fh, int n, int type, string line)
 
void credits_build (int fh, int n)
 
void credits_export ()
 
int credits_get ()
 
entity makeXonoticCreditsList ()
 
void XonoticCreditsList_configureXonoticCreditsList (entity me)
 
void XonoticCreditsList_destroy (entity me)
 
void XonoticCreditsList_draw (entity me)
 
void XonoticCreditsList_drawListBoxItem (entity me, int i, vector absSize, bool isSelected, bool isFocused)
 
float XonoticCreditsList_keyDown (entity me, float key, float ascii, float shift)
 
void XonoticCreditsList_resizeNotify (entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
 

Variables

int CREDITS_TYPE_FUNCTION = 1
 
int CREDITS_TYPE_NL = -1
 
int CREDITS_TYPE_PERSON = 0
 
int CREDITS_TYPE_TITLE = 2
 

Macro Definition Documentation

◆ _CREDITS_PERSON

#define _CREDITS_PERSON (   p)    CREDITS_PERSON(#p)

Referenced by credits_build().

◆ CREDITS

#define CREDITS (   TITLE,
  FUNCTION,
  PERSON,
  PERSON_,
  NL 
)

Definition at line 3 of file credits.qc.

Referenced by credits_build().

◆ CREDITS_FUNCTION

#define CREDITS_FUNCTION (   f)    credits_add_line(fh, n, CREDITS_TYPE_FUNCTION, f);

Referenced by credits_build().

◆ CREDITS_NL

#define CREDITS_NL ( )    credits_add_line(fh, n, CREDITS_TYPE_NL, "");

Referenced by credits_build().

◆ CREDITS_PERSON

#define CREDITS_PERSON (   p)    credits_add_line(fh, n, CREDITS_TYPE_PERSON, p);

Referenced by credits_build().

◆ CREDITS_TITLE

#define CREDITS_TITLE (   t)    credits_add_line(fh, n, CREDITS_TYPE_TITLE, t);

Referenced by credits_build().

Function Documentation

◆ credits_add_line()

void credits_add_line ( int  fh,
int  n,
int  type,
string  line 
)

Definition at line 414 of file credits.qc.

References CREDITS_TYPE_FUNCTION, CREDITS_TYPE_TITLE, fputs(), and strcat().

415 {
416  if (type == CREDITS_TYPE_TITLE)
417  line = strcat("**", line);
418  else if (type == CREDITS_TYPE_FUNCTION)
419  line = strcat("*", line);
420 
421  if (fh >= 0)
422  fputs(fh, strcat(line, "\n"));
423  if (n >= 0)
424  bufstr_add(n, line, 0);
425 }
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"))
int CREDITS_TYPE_TITLE
Definition: credits.qc:410
int CREDITS_TYPE_FUNCTION
Definition: credits.qc:411
+ Here is the call graph for this function:

◆ credits_build()

void credits_build ( int  fh,
int  n 
)

Definition at line 427 of file credits.qc.

References _CREDITS_PERSON, CREDITS, CREDITS_FUNCTION, CREDITS_NL, CREDITS_PERSON, and CREDITS_TITLE.

Referenced by credits_export(), and credits_get().

428 {
429  #define CREDITS_TITLE(t) credits_add_line(fh, n, CREDITS_TYPE_TITLE, t);
430  #define CREDITS_FUNCTION(f) credits_add_line(fh, n, CREDITS_TYPE_FUNCTION, f);
431  #define CREDITS_PERSON(p) credits_add_line(fh, n, CREDITS_TYPE_PERSON, p);
432  #define _CREDITS_PERSON(p) CREDITS_PERSON(#p)
433  #define CREDITS_NL() credits_add_line(fh, n, CREDITS_TYPE_NL, "");
435  #undef CREDITS_TITLE
436  #undef CREDITS_FUNCTION
437  #undef CREDITS_PERSON
438  #undef _CREDITS_PERSON
439  #undef CREDITS_NL
440 }
#define CREDITS(TITLE, FUNCTION, PERSON, PERSON_, NL)
Definition: credits.qc:3
#define CREDITS_TITLE(t)
#define _CREDITS_PERSON(p)
#define CREDITS_PERSON(p)
#define CREDITS_NL()
#define CREDITS_FUNCTION(f)
+ Here is the caller graph for this function:

◆ credits_export()

void credits_export ( )

Definition at line 449 of file credits.qc.

References credits_build(), FILE_WRITE, and fopen().

Referenced by XonoticCreditsList_configureXonoticCreditsList().

450 {
451  int fh = fopen("credits.txt", FILE_WRITE);
452  if(fh < 0)
453  return;
454  credits_build(fh, -1);
455 }
void credits_build(int fh, int n)
Definition: credits.qc:427
const float FILE_WRITE
Definition: csprogsdefs.qc:233
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ credits_get()

int credits_get ( )

Definition at line 442 of file credits.qc.

References buf_create, and credits_build().

Referenced by XonoticCreditsList_configureXonoticCreditsList().

443 {
444  int n = buf_create();
445  credits_build(-1, n);
446  return n;
447 }
void credits_build(int fh, int n)
Definition: credits.qc:427
#define buf_create
Definition: dpextensions.qh:63
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ makeXonoticCreditsList()

entity makeXonoticCreditsList ( )

Definition at line 459 of file credits.qc.

References entity(), and NEW.

Referenced by XonoticCreditsDialog_fill().

460 {
461  entity me;
462  me = NEW(XonoticCreditsList);
463  me.configureXonoticCreditsList(me);
464  return me;
465 }
#define NEW(cname,...)
Definition: oo.qh:105
entity() spawn
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XonoticCreditsList_configureXonoticCreditsList()

void XonoticCreditsList_configureXonoticCreditsList ( entity  me)

Definition at line 466 of file credits.qc.

References credits_export(), credits_get(), cvar(), and cvar_set().

467 {
468  me.configureXonoticListBox(me);
469  me.bufferIndex = credits_get();
470  me.nItems = buf_getsize(me.bufferIndex);
471  if (cvar("_menu_credits_export")) // set by the menu_credits_export alias
472  {
473  credits_export();
474  cvar_set("_menu_credits_export", "0");
475  }
476 }
int credits_get()
Definition: credits.qc:442
void credits_export()
Definition: credits.qc:449
+ Here is the call graph for this function:

◆ XonoticCreditsList_destroy()

void XonoticCreditsList_destroy ( entity  me)

Definition at line 477 of file credits.qc.

478 {
479  buf_del(me.bufferIndex);
480 }

◆ XonoticCreditsList_draw()

void XonoticCreditsList_draw ( entity  me)

Definition at line 481 of file credits.qc.

References bound(), SUPER, and time.

482 {
483  if(me.scrolling)
484  {
485  me.scrollPos = bound(0, (time - me.scrolling) * me.itemHeight, me.nItems * me.itemHeight - 1);
486  me.scrollPosTarget = me.scrollPos;
487  }
488  SUPER(XonoticCreditsList).draw(me);
489 }
#define SUPER(cname)
Definition: oo.qh:219
float time
Definition: csprogsdefs.qc:16
+ Here is the call graph for this function:

◆ XonoticCreditsList_drawListBoxItem()

void XonoticCreditsList_drawListBoxItem ( entity  me,
int  i,
vector  absSize,
bool  isSelected,
bool  isFocused 
)

Definition at line 498 of file credits.qc.

References draw_CenterText(), eX, eY, strlen(), substring(), and vector().

499 {
500  string s;
501  float theAlpha;
502  vector theColor;
503 
504  s = bufstr_get(me.bufferIndex, i);
505 
506  if(substring(s, 0, 2) == "**")
507  {
508  s = substring(s, 2, strlen(s) - 2);
509  theColor = SKINCOLOR_CREDITS_TITLE;
510  theAlpha = SKINALPHA_CREDITS_TITLE;
511  }
512  else if(substring(s, 0, 1) == "*")
513  {
514  s = substring(s, 1, strlen(s) - 1);
515  theColor = SKINCOLOR_CREDITS_FUNCTION;
516  theAlpha = SKINALPHA_CREDITS_FUNCTION;
517  }
518  else
519  {
520  theColor = SKINCOLOR_CREDITS_PERSON;
521  theAlpha = SKINALPHA_CREDITS_PERSON;
522  }
523 
524  draw_CenterText(me.realUpperMargin * eY + 0.5 * eX, s, me.realFontSize, theColor, theAlpha, 0);
525 }
const vector eY
Definition: vector.qh:45
vector(float skel, float bonenum) _skel_get_boneabs_hidden
const vector eX
Definition: vector.qh:44
+ Here is the call graph for this function:

◆ XonoticCreditsList_keyDown()

float XonoticCreditsList_keyDown ( entity  me,
float  key,
float  ascii,
float  shift 
)

Definition at line 527 of file credits.qc.

References SUPER.

528 {
529  me.scrolling = 0;
530  return SUPER(XonoticCreditsList).keyDown(me, key, ascii, shift);
531 }
#define SUPER(cname)
Definition: oo.qh:219

◆ XonoticCreditsList_resizeNotify()

void XonoticCreditsList_resizeNotify ( entity  me,
vector  relOrigin,
vector  relSize,
vector  absOrigin,
vector  absSize 
)

Definition at line 490 of file credits.qc.

References SUPER.

491 {
492  SUPER(XonoticCreditsList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
493 
494  me.realFontSize_y = me.fontSize / (absSize.y * me.itemHeight);
495  me.realFontSize_x = me.fontSize / (absSize.x * (1 - me.controlWidth));
496  me.realUpperMargin = 0.5 * (1 - me.realFontSize.y);
497 }
#define SUPER(cname)
Definition: oo.qh:219

Variable Documentation

◆ CREDITS_TYPE_FUNCTION

int CREDITS_TYPE_FUNCTION = 1

Definition at line 411 of file credits.qc.

Referenced by credits_add_line().

◆ CREDITS_TYPE_NL

int CREDITS_TYPE_NL = -1

Definition at line 413 of file credits.qc.

◆ CREDITS_TYPE_PERSON

int CREDITS_TYPE_PERSON = 0

Definition at line 412 of file credits.qc.

◆ CREDITS_TYPE_TITLE

int CREDITS_TYPE_TITLE = 2

Definition at line 410 of file credits.qc.

Referenced by credits_add_line().