예제 #1
0
  /** Reads a client_persistant structure from a file. */
  public void read(QuakeFile f) throws IOException {

    userinfo = f.readString();
    netname = f.readString();

    hand = f.readInt();

    connected = f.readInt() != 0;
    health = f.readInt();

    max_health = f.readInt();
    savedFlags = f.readInt();
    selected_item = f.readInt();

    for (int n = 0; n < Defines.MAX_ITEMS; n++) inventory[n] = f.readInt();

    max_bullets = f.readInt();
    max_shells = f.readInt();
    max_rockets = f.readInt();
    max_grenades = f.readInt();
    max_cells = f.readInt();
    max_slugs = f.readInt();

    weapon = f.readItem();
    lastweapon = f.readItem();
    power_cubes = f.readInt();
    score = f.readInt();

    game_helpchanged = f.readInt();
    helpchanged = f.readInt();
    spectator = f.readInt() != 0;
  }
예제 #2
0
  /** Writes a client_persistant structure to a file. */
  public void write(QuakeFile f) throws IOException {
    // client persistant_t
    f.writeString(userinfo);
    f.writeString(netname);

    f.writeInt(hand);

    f.writeInt(connected ? 1 : 0);
    f.writeInt(health);

    f.writeInt(max_health);
    f.writeInt(savedFlags);
    f.writeInt(selected_item);

    for (int n = 0; n < Defines.MAX_ITEMS; n++) f.writeInt(inventory[n]);

    f.writeInt(max_bullets);
    f.writeInt(max_shells);
    f.writeInt(max_rockets);
    f.writeInt(max_grenades);
    f.writeInt(max_cells);
    f.writeInt(max_slugs);

    f.writeItem(weapon);
    f.writeItem(lastweapon);
    f.writeInt(power_cubes);
    f.writeInt(score);

    f.writeInt(game_helpchanged);
    f.writeInt(helpchanged);
    f.writeInt(spectator ? 1 : 0);
  }