hedgewars/uChat.pas
author unc0rr
Wed, 21 May 2008 20:22:51 +0000
changeset 943 a0c36a0b3ad9
parent 942 b41af014d85e
child 945 4ead9cde4e14
permissions -rw-r--r--
Use firepunch sprite
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
942
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
     1
(*
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
     2
 * Hedgewars, a worms-like game
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
     3
 * Copyright (c) 2008 Andrey Korotaev <unC0Rr@gmail.com>
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
     4
 *
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
     8
 *
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    12
 * GNU General Public License for more details.
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    13
 *
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    17
 *)
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    18
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    19
unit uChat;
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    20
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    21
interface
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    22
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    23
procedure AddChatString(s: shortstring);
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    24
procedure DrawChat;
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    25
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    26
implementation
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    27
uses uMisc, uStore, uConsts;
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    28
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    29
const MaxStrIndex = 7;
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    30
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    31
type TStr = record
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    32
		Time: Longword;
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    33
		Tex: PTexture;
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    34
		end;
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    35
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    36
var Strs: array[0 .. MaxStrIndex] of TStr;
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    37
	lastStr: Longword = 0;
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    38
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    39
procedure AddChatString(s: shortstring);
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    40
begin
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    41
lastStr:= (lastStr + 1) mod (MaxStrIndex + 1);
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    42
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    43
Strs[lastStr].Time:= RealTicks + 7500;
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    44
Strs[lastStr].Tex:= RenderStringTex(s, $FFFFFF, fnt16)
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    45
end;
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    46
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    47
procedure DrawChat;
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    48
begin
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    49
if Strs[lastStr].Tex <> nil then DrawTexture(10, 10, Strs[lastStr].Tex)
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    50
end;
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    51
b41af014d85e Stub for chat implementation
unc0rr
parents:
diff changeset
    52
end.