Example #1
0
  @Override
  public void Ticker() {

    int i;
    boolean rc;
    char c;

    // tick down message counter if message is up
    if ((message_counter != 0) && !((--message_counter) != 0)) {
      message_on[0] = false;
      message_nottobefuckedwith = false;
    }

    if (M.getShowMessages() || message_dontfuckwithme) {

      // display message if necessary
      if (((plr.message != null) && !message_nottobefuckedwith)
          || ((plr.message != null) && message_dontfuckwithme)) {
        this.w_message.addMessageToSText(null, plr.message);
        plr.message = null;
        message_on[0] = true;
        message_counter = HU_MSGTIMEOUT;
        message_nottobefuckedwith = message_dontfuckwithme;
        message_dontfuckwithme = false;
      }
    } // else message_on = false;

    // check for incoming chat characters
    if (DM.netgame) {
      for (i = 0; i < MAXPLAYERS; i++) {
        if (!DM.playeringame[i]) continue;
        if ((i != DM.consoleplayer) && ((c = DM.players[i].cmd.chatchar) != 0)) {
          if (c <= HU_BROADCAST) chat_dest[i] = c;
          else {
            if (c >= 'a' && c <= 'z') c = (char) shiftxform[c];
            rc = w_inputbuffer[i].keyInIText(c);
            if (rc && c == KEY_ENTER) {
              if ((w_inputbuffer[i].l.len != 0) && (chat_dest[i] == DM.consoleplayer + 1)
                  || (chat_dest[i] == HU_BROADCAST)) {
                w_message.addMessageToSText(player_names[i], w_inputbuffer[i].l.text.toString());

                message_nottobefuckedwith = true;
                message_on[0] = true;
                message_counter = HU_MSGTIMEOUT;
                if (DM.isCommercial()) S.StartSound(null, sfxenum_t.sfx_radio);
                else S.StartSound(null, sfxenum_t.sfx_tink);
              }
              w_inputbuffer[i].resetIText();
            }
          }
          DM.players[i].cmd.chatchar = 0;
        }
      }
    }
  }
Example #2
0
  @Override
  public void Start() {

    int i;
    String s;

    // MAES: fugly hax. These were compile-time inlines,
    // so they can either work as functions, or be set whenever the HU is started
    // (typically once per level). They need to be aware of game progress,
    // and episode numbers <1 will cause it to bomb.
    // MAES: hack to handle Betray in XBLA 31/5/2011
    if ((DM.gamemap > 32) && (DM.getGameMode() == GameMode.pack_xbla)) {
      this.HU_TITLE = mapnames[(DM.gameepisode - 1) * 9 + DM.gamemap - 2];

      this.HU_TITLE2 = mapnames2[DM.gamemap - 1];
      this.HU_TITLEP = mapnamesp[DM.gamemap - 2]; // fixed from HU_TITLEPw
      this.HU_TITLET = mapnamest[DM.gamemap - 2];
    } else {
      this.HU_TITLE = mapnames[(DM.gameepisode - 1) * 9 + DM.gamemap - 1];
      this.HU_TITLE2 = mapnames2[DM.gamemap - 1];
      this.HU_TITLEP = mapnamesp[DM.gamemap - 1]; // fixed from HU_TITLEP
      this.HU_TITLET = mapnamest[DM.gamemap - 1];
    }

    if (headsupactive) this.Stop();

    plr = DM.players[DM.consoleplayer];
    message_on[0] = false;
    message_dontfuckwithme = false;
    message_nottobefuckedwith = false;
    chat_on[0] = false;

    // create the message widget
    this.w_message.initSText(
        HU_MSGX, HU_MSGY, HU_MSGHEIGHT, hu_font, HU_FONTSTART, this.message_on);

    // create the map title widget
    this.w_title.initTextLine(HU_TITLEX, HU_TITLEY, hu_font, HU_FONTSTART);

    switch (DM.getGameMode()) {
      case shareware:
      case registered:
      case retail:
        s = HU_TITLE;
        break;

      case pack_plut:
        s = HU_TITLEP;
        break;
      case pack_tnt:
        s = HU_TITLET;
        break;

      case commercial:
      default:
        s = HU_TITLE2;
        break;
    }

    // MAES: oh great, more pointer-char magic... oh no you don't, you ugly
    // cow horse and reindeer lover.

    // while (*s) this.w_title.addCharToTextLine(*(s++));
    int ptr = 0;
    while (ptr < s.length()) {
      this.w_title.addCharToTextLine(s.charAt(ptr++));
    }
    // create the chat widget
    this.w_chat.initIText(HU_INPUTX, HU_INPUTY, hu_font, HU_FONTSTART, chat_on);

    // create the inputbuffer widgets
    for (i = 0; i < MAXPLAYERS; i++) {
      w_inputbuffer[i] = new hu_itext_t();
      w_inputbuffer[i].initIText(0, 0, null, 0, always_off);
    }
    headsupactive = true;
  }