ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/oup/current/Tools/TxmpReplace.pas
(Generate patch)

Comparing oup/current/Tools/TxmpReplace.pas (file contents):
Revision 194 by alloc, Sat May 26 18:26:48 2007 UTC vs.
Revision 201 by alloc, Sat May 26 21:36:23 2007 UTC

# Line 102 | Line 102 | var
102    mem: TMemoryStream;
103    new_storetype: Byte;
104    formatinfo: TImageFormatInfo;
105 +  i: Integer;
106 + const
107 +  powers: array[0..8] of Integer = (1, 2, 4, 8, 16, 32, 64, 128, 256);
108   begin
109    if filelist.ItemIndex >= 0 then
110    begin
# Line 111 | Line 114 | begin
114      else
115        ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $9C, 4, @old_rawaddr);
116  
117 +    if (OniImage_New.Width[1] > 256) or (OniImage_New.Height[1] > 256) then
118 +    begin
119 +      ShowMessage('Widht and height have to be smaller than or equal to 256.');
120 +      Exit;
121 +    end;
122 +    for i := 0 to High(powers) do
123 +      if OniImage_New.Width[1] = powers[i] then
124 +        Break;
125 +    if i = Length(powers) then
126 +    begin
127 +      ShowMessage('Width has to be a power of 2 (1, 2, 4, 8, 16 ...)');
128 +      Exit;
129 +    end;
130 +    for i := 0 to High(powers) do
131 +      if OniImage_New.Height[1] = powers[i] then
132 +        Break;
133 +    if i = Length(powers) then
134 +    begin
135 +      ShowMessage('Height has to be a power of 2 (1, 2, 4, 8, 16 ...)');
136 +      Exit;
137 +    end;
138 +
139      if (OniImage_Old.Width[1] <> OniImage_New.Width[1]) or
140        (OniImage_Old.Height[1] <> OniImage_New.Height[1]) then
141      begin
# Line 129 | Line 154 | begin
154      mem := TMemoryStream.Create;
155  
156      case OniImage_New.Format of
157 +      ifX1R5G5B5: new_storetype := 1;
158        ifA1R5G5B5: new_storetype := 2;
159        ifA4R4G4B4: new_storetype := 0;
160        ifA8R8G8B8:
# Line 164 | Line 190 | begin
190        ConManager.Connection[ConnectionID].UpdateRawFile(fileid, $9C, mem);
191      end;
192  
167    datbyte := $00;
193      if check_fading.Checked then
194 <      datbyte := datbyte or $01;
194 >      oldfading := oldfading or $01
195 >    else
196 >      oldfading := oldfading and (not Byte($01));
197      ConManager.Connection[ConnectionID].UpdateDatFilePart(fileid, $88, 1, @datbyte);
198      datbyte := $10;
199   //    if check_transparency.Checked then

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)