From 71fa444424be52b9b2c3fd508ad663923d28a62c Mon Sep 17 00:00:00 2001 From: Steven Fuller Date: Sat, 28 Jul 2001 23:13:49 +0000 Subject: Removed headers that were accidently checked in. Lots of compiling. --- src/win95/animchnk.cpp | 4 +- src/win95/animchnk.hpp | 2 +- src/win95/animobs.cpp | 5 +- src/win95/chnkload.cpp | 58 +++-- src/win95/chnktexi.cpp | 2 +- src/win95/chnktype.cpp | 10 +- src/win95/chunk.cpp | 11 - src/win95/chunkpal.cpp | 26 ++- src/win95/fail.c | 10 - src/win95/hash_tem.hpp | 4 +- src/win95/hierchnk.cpp | 3 +- src/win95/iff.cpp | 2 - src/win95/iff.hpp | 20 +- src/win95/iff_ilbm.cpp | 3 +- src/win95/io.c | 18 +- src/win95/media.cpp | 1 - src/win95/mishchnk.cpp | 5 +- src/win95/obchunk.cpp | 7 +- src/win95/oechunk.cpp | 6 +- src/win95/oechunk.h | 4 +- src/win95/rad.h | 606 ------------------------------------------------- src/win95/shpchunk.cpp | 21 +- src/win95/sprchunk.cpp | 4 +- src/win95/sprchunk.hpp | 6 +- src/win95/texio.c | 5 +- src/win95/wpchunk.cpp | 12 +- 26 files changed, 138 insertions(+), 717 deletions(-) delete mode 100644 src/win95/rad.h (limited to 'src/win95') diff --git a/src/win95/animchnk.cpp b/src/win95/animchnk.cpp index 3f5d87a..f6802cb 100644 --- a/src/win95/animchnk.cpp +++ b/src/win95/animchnk.cpp @@ -61,7 +61,7 @@ Animation_Chunk::Animation_Chunk(Chunk_With_Children* parent,const char* data,si fl->Textures[k]=*((int*)data); data+=4; } - for(k=0;k<(2*ta->NumVerts)*fl->NumFrames;k++) + for(int k=0;k<(2*ta->NumVerts)*fl->NumFrames;k++) { fl->UVCoords[k]=*((int*)data); data+=4; @@ -164,7 +164,7 @@ void Animation_Chunk::fill_data_block(char* data_start) *(int*)data_start=fl->Textures[k]; data_start+=4; } - for(k=0;k<(2*ta->NumVerts)*fl->NumFrames;k++) + for(int k=0;k<(2*ta->NumVerts)*fl->NumFrames;k++) { *(int*)data_start=fl->UVCoords[k]; data_start+=4; diff --git a/src/win95/animchnk.hpp b/src/win95/animchnk.hpp index 9c30cbc..531f7f8 100644 --- a/src/win95/animchnk.hpp +++ b/src/win95/animchnk.hpp @@ -1,7 +1,7 @@ #ifndef _animchnk_hpp #define _animchnk_hpp #include "chunk.hpp" -#include "Chnktype.hpp" +#include "chnktype.hpp" struct TEXANIM; diff --git a/src/win95/animobs.cpp b/src/win95/animobs.cpp index f85001f..847361c 100644 --- a/src/win95/animobs.cpp +++ b/src/win95/animobs.cpp @@ -1,5 +1,5 @@ #include "hierchnk.hpp" -#include "Animobs.hpp" +#include "animobs.hpp" #include "list_tem.hpp" #include @@ -329,7 +329,8 @@ Object_Animation_Sequence_Chunk * Object_Animation_Sequences_Chunk::get_sequence List seq_list; list_sequences(&seq_list); - for (LIF sli(&seq_list); !sli.done(); sli.next()) + LIF sli(&seq_list); + for (; !sli.done(); sli.next()) { Object_Animation_Sequence_Header_Chunk * oashc = sli()->get_header(); if (oashc) diff --git a/src/win95/chnkload.cpp b/src/win95/chnkload.cpp index 2113372..757c68c 100644 --- a/src/win95/chnkload.cpp +++ b/src/win95/chnkload.cpp @@ -1,5 +1,8 @@ #include -#include +#include +#include + +#include "string.hpp" #include "list_tem.hpp" #include "chnkload.hpp" @@ -476,9 +479,12 @@ RIFFHANDLE load_rif (const char * fname) CL_LogFile.lprintf("FAILED TO LOAD RIF: %s\n",fname); #endif ReleaseDirect3D(); +#if 0 char message[200]; sprintf(message,"Error loading %s",fname); MessageBox(NULL,message,"AvP",MB_OK+MB_SYSTEMMODAL); +#endif + fprintf(stderr, "load_rif: Error loading %s\n", fname); exit(0x111); return INVALID_RIFFHANDLE; } @@ -510,9 +516,12 @@ RIFFHANDLE load_rif_non_env (const char * fname) #endif ReleaseDirect3D(); +#if 0 char message[200]; sprintf(message,"Error loading %s",fname); MessageBox(NULL,message,"AvP",MB_OK+MB_SYSTEMMODAL); +#endif + fprintf(stderr, "load_rif_non_env: Error loading %s\n", fname); exit(0x111); return INVALID_RIFFHANDLE; } @@ -667,7 +676,9 @@ static void setup_tex_conv_array ( // load in the textures from the shape max_indices = 0; - for (LIF bns (&blsc->bmps); !bns.done(); bns.next()) + LIF bns (&blsc->bmps); + + for (; !bns.done(); bns.next()) { max_indices = max(bns().index,max_indices); } @@ -707,7 +718,7 @@ static void setup_tex_conv_array ( } -CopyShapeAnimationHeader(SHAPEHEADER* shpfrom,SHAPEHEADER* shpto) +void CopyShapeAnimationHeader(SHAPEHEADER* shpfrom,SHAPEHEADER* shpto) { GLOBALASSERT(shpfrom->numitems==shpto->numitems); GLOBALASSERT(shpfrom->animation_header); @@ -1170,7 +1181,9 @@ BOOL load_rif_bitmaps (RIFFHANDLE h, int/* flags*/) if (gbnc) { - for (LIF bns (&gbnc->bmps); !bns.done(); bns.next()) + LIF bns (&gbnc->bmps); + + for (; !bns.done(); bns.next()) { h->max_index = max(bns().index,h->max_index); } @@ -1286,9 +1299,12 @@ BOOL copy_rif_tlt (RIFFHANDLE h, int /*flags*/) ScreenDescriptorBlock.SDB_Flags &= ~(SDB_Flag_TLTSize|SDB_Flag_TLTShift); if (tltch->width != 256) { + int shft; + ScreenDescriptorBlock.SDB_Flags |= SDB_Flag_TLTSize; ScreenDescriptorBlock.TLTSize = tltch->width; - for (int shft = 0; 1<width; ++shft) + + for (shft = 0; 1<width; ++shft) ; if (1<width) { @@ -1891,10 +1907,14 @@ void SetupAnimOnQuad(Shape_Chunk* sc,SHAPEHEADER* shp,TEXANIM* ta1,TEXANIM* ta2, if(ta1->ID!=ta2->ID)return; int VertConv[3];//conversion between vert nos in triangles and vert nos in quad int VertFrom,VertTo;//for remaining vert in second poly + int i; + VertTo=6; - for(int i=0;i<3;i++) + for(i=0;i<3;i++) { - for(int j=0;j<4;j++) + int j; + + for(j=0;j<4;j++) { if(sc->shape_data.poly_list[ta1->poly].vert_ind[i]==(shp->items[poly][j+4]))break; } @@ -2018,7 +2038,7 @@ void SetupAnimatedTextures(Shape_Chunk* sc,SHAPEHEADER* shp,Animation_Chunk* ac, } - for(i=0;iNumPolys;i++) + for(int i=0;iNumPolys;i++) { TEXANIM* ta1,*ta2; ta1=ac->AnimList[i]; @@ -2028,6 +2048,8 @@ void SetupAnimatedTextures(Shape_Chunk* sc,SHAPEHEADER* shp,Animation_Chunk* ac, } else if(mgd[ta1->poly]>ta1->poly) { + int j; + for(j=0;jNumPolys;j++) { if(ac->AnimList[j]->poly==mgd[ta1->poly])break; @@ -2119,7 +2141,9 @@ void SetupAnimatingShape(Shape_Chunk* sc,SHAPEHEADER* shp, Shape_Merge_Data_Chun int numseq=0; List chlist; sc->lookup_child("ANIMSEQU",chlist); - for(LIF chlif(&chlist);!chlif.done();chlif.next()) + + LIF chlif(&chlist); + for(;!chlif.done();chlif.next()) { Anim_Shape_Sequence_Chunk* assc=(Anim_Shape_Sequence_Chunk*)chlif(); numseq=max(assc->sequence_data.SequenceNum+1,numseq); @@ -2164,7 +2188,7 @@ void SetupAnimatingShape(Shape_Chunk* sc,SHAPEHEADER* shp, Shape_Merge_Data_Chun sas->vertex_normals=(int*)PoolAllocateMem(sizeof(VECTORCH)*cas->num_verts); - for(i=0;inum_verts;i++) + for(int i=0;inum_verts;i++) { sas->vertex_normals[i*3]=(int)(cas->v_normal_list[i].x*ONE_FIXED); sas->vertex_normals[i*3+1]=(int)(cas->v_normal_list[i].y*ONE_FIXED); @@ -2174,7 +2198,7 @@ void SetupAnimatingShape(Shape_Chunk* sc,SHAPEHEADER* shp, Shape_Merge_Data_Chun sas->num_frames=cas->NumFrames; sas->anim_frames=(shapeanimationframe*)PoolAllocateMem(sizeof(shapeanimationframe)*cas->NumFrames); - for(i=0;iNumFrames;i++) + for(int i=0;iNumFrames;i++) { const ChunkAnimFrame* caf=cas->Frames[i]; shapeanimationframe* saf=&sas->anim_frames[i]; @@ -2188,7 +2212,7 @@ void SetupAnimatingShape(Shape_Chunk* sc,SHAPEHEADER* shp, Shape_Merge_Data_Chun } saf->item_normals=(int*) PoolAllocateMem(sizeof(VECTORCH)*shp->numitems); - for(j=0;jnum_polys;j++) + for(int j=0;jnum_polys;j++) { saf->item_normals[PolyConv[j]*3]=(int)(caf->p_normal_list[j].x*ONE_FIXED); saf->item_normals[PolyConv[j]*3+1]=(int)(caf->p_normal_list[j].y*ONE_FIXED); @@ -2203,6 +2227,8 @@ void SetupAnimatingShape(Shape_Chunk* sc,SHAPEHEADER* shp, Shape_Merge_Data_Chun //find a sequence which has some frames; shapeanimationsequence* sas=0; + int i; + for(i=0;ianimation_header->num_sequences;i++) { sas=&shp->animation_header->anim_sequences[i]; @@ -2588,7 +2614,8 @@ BOOL copy_sprite_to_shapeheader (RIFFHANDLE h, SHAPEHEADER *& shphd,Sprite_Heade // load in the textures from the shape local_max_index = 0; - for (LIF bns (&blsc->bmps); !bns.done(); bns.next()) + LIF bns (&blsc->bmps); + for (; !bns.done(); bns.next()) { local_max_index = max(bns().index,local_max_index); } @@ -3157,9 +3184,10 @@ void merge_polygons_in_chunkshape (ChunkShape & shp, Shape_Merge_Data_Chunk * sm int mpoly=mgd[i]; //find the 'unique vertex' in the second triangle - for(int j=0;j<3;j++) + int j, k; + for(j=0;j<3;j++) { - for(int k=0;k<3;k++) + for(k=0;k<3;k++) { if(shp.poly_list[mpoly].vert_ind[j]==shp.poly_list[i].vert_ind[k])break; } diff --git a/src/win95/chnktexi.cpp b/src/win95/chnktexi.cpp index 640f011..7dad3d9 100644 --- a/src/win95/chnktexi.cpp +++ b/src/win95/chnktexi.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include "string.hpp" #ifndef DB_LEVEL #define DB_LEVEL 4 #endif diff --git a/src/win95/chnktype.cpp b/src/win95/chnktype.cpp index bddaaae..d09728e 100644 --- a/src/win95/chnktype.cpp +++ b/src/win95/chnktype.cpp @@ -1079,10 +1079,12 @@ ChunkAnimSequence& ChunkAnimSequence::operator=(const ChunkAnimSequence &seq) void ChunkAnimSequence::UpdateNormalsAndExtents(ChunkShape const * cs,List* poly_not_in_bb) { + int i; + if(!cs) return; num_verts=cs->num_verts; if(!v_normal_list)v_normal_list=new ChunkVectorFloat[cs->num_verts]; - for(int i=0;i* void ChunkAnimSequence::DeleteInterpolatedFrames() { + int i; int NewNumFrames=NumFrames; - for(int i=0;iflags & animframeflag_interpolated_frame)NewNumFrames--; } @@ -1218,4 +1222,4 @@ void ChunkAnimSequence::GenerateInterpolatedFrames(ChunkShape const *cs) Frames=NewFrames; NumFrames=NewNumFrames; */ -} \ No newline at end of file +} diff --git a/src/win95/chunk.cpp b/src/win95/chunk.cpp index a123ba0..a068f87 100644 --- a/src/win95/chunk.cpp +++ b/src/win95/chunk.cpp @@ -586,14 +586,3 @@ Chunk* Chunk_With_Children::DynCreate(const char* data) } return new Miscellaneous_Chunk(this,data,(data + 12), (*(int *) (data + 8))-12); } - - - - - - - - - - - diff --git a/src/win95/chunkpal.cpp b/src/win95/chunkpal.cpp index 0cf1185..8bf84da 100644 --- a/src/win95/chunkpal.cpp +++ b/src/win95/chunkpal.cpp @@ -66,7 +66,9 @@ BOOL IsFixedPalette(Chunk_With_Children * parent) { List plist; parent->lookup_child("PRSETPAL",plist); - for (LIF plit(&plist); !plit.done(); plit.next()) + + LIF plit(&plist); + for (; !plit.done(); plit.next()) { for (LIF findconst(&((Preset_Palette_Chunk *)plit())->pplist); !findconst.done(); findconst.next()) { @@ -291,7 +293,9 @@ Environment_TLT_Chunk::Environment_TLT_Chunk (Chunk_With_Children * parent, cons : Chunk (parent, "ENVTXLIT"), width (*((int*)(sdata))), num_levels (*((int*)(sdata+4))), flags(*(int *)(sdata+28)), table (0), filename(0) { - for (int i=0; i::_base_HashTable(_base_HashTa { for (unsigned i=0; i::ConstIterator it(ht); !it.Done(); it.Next() ) + +// for(HashTable::ConstIterator it(ht); !it.Done(); it.Next() ) + for (_base_HashTable::ConstIterator it(ht); !it.Done(); it.Next() ) { AddRegardless( it.Get() ); } diff --git a/src/win95/hierchnk.cpp b/src/win95/hierchnk.cpp index 5b26379..3f48e48 100644 --- a/src/win95/hierchnk.cpp +++ b/src/win95/hierchnk.cpp @@ -298,6 +298,7 @@ Object_Hierarchy_Alternate_Shape_Set_Chunk::Object_Hierarchy_Alternate_Shape_Set Object_Hierarchy_Alternate_Shape_Set_Chunk::Object_Hierarchy_Alternate_Shape_Set_Chunk(Chunk_With_Children* parent,const char* data,size_t) :Chunk(parent,"OBHALTSH") { + int i; Shape_Set_Num=*(int*)data; data+=4; @@ -310,7 +311,7 @@ Object_Hierarchy_Alternate_Shape_Set_Chunk::Object_Hierarchy_Alternate_Shape_Set int num_shapes=*(int*)data; data+=4; - for(int i=0;i -#include #if defined(_CPPRTTI) && !defined(NDEBUG) #include diff --git a/src/win95/iff.hpp b/src/win95/iff.hpp index b03b6b2..103ddb0 100644 --- a/src/win95/iff.hpp +++ b/src/win95/iff.hpp @@ -48,11 +48,13 @@ namespace IFF #else inline void DisplayMessage(char const * pszTitle,char const * pszText) { - ::printf("%s\n%s\n",pszTitle,pszText); + ::printf("DisplayMessage\n%s\n%s\n",pszTitle,pszText); + /* while (::kbhit()) ::getch(); while (!::kbhit() || '\r' != ::getch()) ; + */ } #endif @@ -121,17 +123,17 @@ namespace IFF #undef BYTE #pragma message("BYTE was defined - undefining") #endif - typedef signed char BYTE; - typedef unsigned char UBYTE; + typedef int8_t BYTE; + typedef uint8_t UBYTE; - typedef signed short INT16; - typedef unsigned short UINT16; + typedef int16_t INT16; + typedef uint16_t UINT16; - typedef signed INT32; - typedef unsigned UINT32; + typedef int32_t INT32; + typedef uint32_t UINT32; - typedef signed __int64 INT64; - typedef unsigned __int64 UINT64; + typedef int64_t INT64; + typedef uint64_t UINT64; struct RGBTriple { diff --git a/src/win95/iff_ilbm.cpp b/src/win95/iff_ilbm.cpp index 128f7ad..b5ebcc5 100644 --- a/src/win95/iff_ilbm.cpp +++ b/src/win95/iff_ilbm.cpp @@ -1,5 +1,4 @@ -#include "advwin32.h" -#include "iff_ILBM.hpp" +#include "iff_ilbm.hpp" IFF_IMPLEMENT_DYNCREATE("ILBM","BMHD",IlbmBmhdChunk) IFF_IMPLEMENT_DYNCREATE("ILBM","CMAP",IlbmCmapChunk) diff --git a/src/win95/io.c b/src/win95/io.c index ab2c540..ef3400f 100644 --- a/src/win95/io.c +++ b/src/win95/io.c @@ -1,6 +1,6 @@ #include "3dc.h" -#include +#include #include #include "inline.h" @@ -600,11 +600,12 @@ void (*SetVideoMode[]) (void) = { */ -void InitialiseSystem(HINSTANCE hInstance, int nCmdShow) - +void InitialiseSystem() { BOOL rc; - + HINSTANCE hInstance = 0; + int nCmdShow = 1; + /* Pick up processor type */ @@ -1764,15 +1765,6 @@ void InitPrintQueue(void) AND ONLY ONCE!!!! */ -#if debug || PreBeta -extern LPDIRECTDRAWSURFACE lpDDDbgFont; -#endif - - - - - - /* diff --git a/src/win95/media.cpp b/src/win95/media.cpp index acb1427..ee8a347 100644 --- a/src/win95/media.cpp +++ b/src/win95/media.cpp @@ -1,4 +1,3 @@ -#include "advwin32.h" #include "media.hpp" void * MediaMedium::GetWriteBuffer(unsigned * pSize, unsigned /*nDesiredSize*/) diff --git a/src/win95/mishchnk.cpp b/src/win95/mishchnk.cpp index 5f4dde3..b463028 100644 --- a/src/win95/mishchnk.cpp +++ b/src/win95/mishchnk.cpp @@ -10,8 +10,6 @@ #include "huffman.hpp" -#include - #ifdef cencon #define new my_new #endif @@ -644,7 +642,8 @@ void File_Chunk::post_input_processing() child_lists.delete_first_entry(); } - for (LIF sli(&shplist); !sli.done(); sli.next()) + LIF sli(&shplist); + for (; !sli.done(); sli.next()) { Shape_Chunk::max_id = max (Shape_Chunk::max_id,sli()->get_header()->file_id_num); } diff --git a/src/win95/obchunk.cpp b/src/win95/obchunk.cpp index 86e8857..e90c7ce 100644 --- a/src/win95/obchunk.cpp +++ b/src/win95/obchunk.cpp @@ -228,7 +228,8 @@ BOOL Object_Chunk::assoc_with_shape_no(File_Chunk *fc) List chlst; fc->lookup_child("REBSHAPE",chlst); - for (LIF l(&chlst); !l.done(); l.next()) + LIF l(&chlst); + for (; !l.done(); l.next()) { shp = (Shape_Chunk *)l(); shphd = shp->get_header(); @@ -1233,6 +1234,8 @@ Object_Track_Chunk2::Object_Track_Chunk2 (Chunk_With_Children * parent,const cha Object_Track_Chunk2::Object_Track_Chunk2 (Chunk_With_Children * parent,const char * data, size_t /*size*/) : Chunk (parent, "OBJTRAK2") { + int i; + num_sections=*(int*)data; data+=4; @@ -1241,7 +1244,7 @@ Object_Track_Chunk2::Object_Track_Chunk2 (Chunk_With_Children * parent,const cha else sections=0; - for(int i=0;i - #include - #include - - #define radstrlen strlen - - #define radmemset memset - - #define radmemcmp memcmp - - #define radmemcpy(dest,source,size) BlockMoveData((Ptr)(source),(Ptr)(dest),size) - - #define radmemcpydb(dest,source,size) BlockMoveData((Ptr)(source),(Ptr)(dest),size) - - #define radstrcat strcat - - #define radstrcpy strcpy - - static u32 inline radsqr(s32 a) { return(a*a); } - - #ifdef __RAD68K__ - - #pragma parameter __D0 mult64anddiv(__D0,__D1,__D2) - u32 mult64anddiv(u32 m1,u32 m2,u32 d) ={0x4C01,0x0C01,0x4C42,0x0C01}; - // muls.l d1,d1:d0 divs.l d2,d1:d0 - - #pragma parameter radconv32a(__A0,__D0) - void radconv32a(void* p,u32 n) ={0x4A80,0x600C,0x2210,0xE059,0x4841,0xE059,0x20C1,0x5380,0x6EF2}; - // tst.l d0 bra.s @loope @loop: move.l (a0),d1 ror.w #8,d1 swap d1 ror.w #8,d1 move.l d1,(a0)+ sub.l #1,d0 bgt.s @loop @loope: - - #else - - u32 mult64anddiv(u32 m1,u32 m2,u32 d); - - void radconv32a(void* p,u32 n); - - #endif - - #else - - #ifdef __WATCOMC__ - - u32 radsqr(s32 a); - #pragma aux radsqr = "mul eax" parm [eax] modify [EDX eax]; - - u32 mult64anddiv(u32 m1,u32 m2,u32 d); - #pragma aux mult64anddiv = "mul ecx" "div ebx" parm [eax] [ecx] [ebx] modify [EDX eax]; - - s32 radabs(s32 ab); - #pragma aux radabs = "test eax,eax" "jge skip" "neg eax" "skip:" parm [eax]; - - #define radabs32 radabs - - u32 DOSOut(const char* str); - #pragma aux DOSOut = "cld" "mov ecx,0xffffffff" "xor eax,eax" "mov edx,edi" "repne scasb" "not ecx" "dec ecx" "mov ebx,1" "mov ah,0x40" "int 0x21" parm [EDI] modify [EAX EBX ECX EDX EDI] value [ecx]; - - void DOSOutNum(const char* str,u32 len); - #pragma aux DOSOutNum = "mov ah,0x40" "mov ebx,1" "int 0x21" parm [edx] [ecx] modify [eax ebx]; - - u32 ErrOut(const char* str); - #pragma aux ErrOut = "cld" "mov ecx,0xffffffff" "xor eax,eax" "mov edx,edi" "repne scasb" "not ecx" "dec ecx" "xor ebx,ebx" "mov ah,0x40" "int 0x21" parm [EDI] modify [EAX EBX ECX EDX EDI] value [ecx]; - - void ErrOutNum(const char* str,u32 len); - #pragma aux ErrOutNum = "mov ah,0x40" "xor ebx,ebx" "int 0x21" parm [edx] [ecx] modify [eax ebx]; - - void radmemset16(void* dest,u16 value,u32 size); - #pragma aux radmemset16 = "cld" "mov bx,ax" "shl eax,16" "mov ax,bx" "mov bl,cl" "shr ecx,1" "rep stosd" "mov cl,bl" "and cl,1" "rep stosw" parm [EDI] [EAX] [ECX] modify [EAX EDX EBX ECX EDI]; - - void radmemset(void* dest,u8 value,u32 size); - #pragma aux radmemset = "cld" "mov ah,al" "mov bx,ax" "shl eax,16" "mov ax,bx" "mov bl,cl" "shr ecx,2" "and bl,3" "rep stosd" "mov cl,bl" "rep stosb" parm [EDI] [AL] [ECX] modify [EAX EDX EBX ECX EDI]; - - void radmemset32(void* dest,u32 value,u32 size); - #pragma aux radmemset32 = "cld" "rep stosd" parm [EDI] [EAX] [ECX] modify [EAX EDX EBX ECX EDI]; - - void radmemcpy(void* dest,const void* source,u32 size); - #pragma aux radmemcpy = "cld" "mov bl,cl" "shr ecx,2" "rep movsd" "mov cl,bl" "and cl,3" "rep movsb" parm [EDI] [ESI] [ECX] modify [EBX ECX EDI ESI]; - - void __far *radfmemcpy(void __far* dest,const void __far* source,u32 size); - #pragma aux radfmemcpy = "cld" "push es" "push ds" "mov es,cx" "mov ds,dx" "mov ecx,eax" "shr ecx,2" "rep movsd" "mov cl,al" "and cl,3" "rep movsb" "pop ds" "pop es" parm [CX EDI] [DX ESI] [EAX] modify [ECX EDI ESI] value [CX EDI]; - - void radmemcpydb(void* dest,const void* source,u32 size); //Destination bigger - #pragma aux radmemcpydb = "std" "mov bl,cl" "lea esi,[esi+ecx-4]" "lea edi,[edi+ecx-4]" "shr ecx,2" "rep movsd" "and bl,3" "jz dne" "add esi,3" "add edi,3" "mov cl,bl" "rep movsb" "dne:" "cld" parm [EDI] [ESI] [ECX] modify [EBX ECX EDI ESI]; - - char* radstrcpy(void* dest,const void* source); - #pragma aux radstrcpy = "cld" "mov edx,edi" "lp:" "mov al,[esi]" "inc esi" "mov [edi],al" "inc edi" "cmp al,0" "jne lp" parm [EDI] [ESI] modify [EAX EDX EDI ESI] value [EDX]; - - char __far* radfstrcpy(void __far* dest,const void __far* source); - #pragma aux radfstrcpy = "cld" "push es" "push ds" "mov es,cx" "mov ds,dx" "mov edx,edi" "lp:" "lodsb" "stosb" "test al,0xff" "jnz lp" "pop ds" "pop es" parm [CX EDI] [DX ESI] modify [EAX EDX EDI ESI] value [CX EDX]; - - char* radstpcpy(void* dest,const void* source); - #pragma aux radstpcpy = "cld" "lp:" "mov al,[esi]" "inc esi" "mov [edi],al" "inc edi" "cmp al,0" "jne lp" "dec edi" parm [EDI] [ESI] modify [EAX EDI ESI] value [EDI]; - - char* radstpcpyrs(void* dest,const void* source); - #pragma aux radstpcpyrs = "cld" "lp:" "mov al,[esi]" "inc esi" "mov [edi],al" "inc edi" "cmp al,0" "jne lp" "dec esi" parm [EDI] [ESI] modify [EAX EDI ESI] value [ESI]; - - u32 radstrlen(const void* dest); - #pragma aux radstrlen = "cld" "mov ecx,0xffffffff" "xor eax,eax" "repne scasb" "not ecx" "dec ecx" parm [EDI] modify [EAX ECX EDI] value [ECX]; - - char* radstrcat(void* dest,const void* source); - #pragma aux radstrcat = "cld" "mov ecx,0xffffffff" "mov edx,edi" "xor eax,eax" "repne scasb" "dec edi" "lp:" "lodsb" "stosb" "test al,0xff" "jnz lp" \ - parm [EDI] [ESI] modify [EAX ECX EDI ESI] value [EDX]; - - char* radstrchr(const void* dest,char chr); - #pragma aux radstrchr = "cld" "lp:" "lodsb" "cmp al,dl" "je fnd" "cmp al,0" "jnz lp" "mov esi,1" "fnd:" "dec esi" parm [ESI] [DL] modify [EAX ESI] value [esi]; - - s8 radmemcmp(const void* s1,const void* s2,u32 len); - #pragma aux radmemcmp = "cld" "rep cmpsb" "setne al" "jbe end" "neg al" "end:" parm [EDI] [ESI] [ECX] modify [ECX EDI ESI]; - - s8 radstrcmp(const void* s1,const void* s2); - #pragma aux radstrcmp = "lp:" "mov al,[esi]" "mov ah,[edi]" "cmp al,ah" "jne set" "cmp al,0" "je set" "inc esi" "inc edi" "jmp lp" "set:" "setne al" "jbe end" "neg al" "end:" \ - parm [EDI] [ESI] modify [EAX EDI ESI]; - - s8 radstricmp(const void* s1,const void* s2); - #pragma aux radstricmp = "lp:" "mov al,[esi]" "mov ah,[edi]" "cmp al,'a'" "jb c1" "cmp al,'z'" "ja c1" "sub al,32" "c1:" "cmp ah,'a'" "jb c2" "cmp ah,'z'" "ja c2" "sub ah,32" "c2:" "cmp al,ah" "jne set" "cmp al,0" "je set" \ - "inc esi" "inc edi" "jmp lp" "set:" "setne al" "jbe end" "neg al" "end:" \ - parm [EDI] [ESI] modify [EAX EDI ESI]; - - s8 radstrnicmp(const void* s1,const void* s2,u32 len); - #pragma aux radstrnicmp = "lp:" "mov al,[esi]" "mov ah,[edi]" "cmp al,'a'" "jb c1" "cmp al,'z'" "ja c1" "sub al,32" "c1:" "cmp ah,'a'" "jb c2" "cmp ah,'z'" "ja c2" "sub ah,32" "c2:" "cmp al,ah" "jne set" "cmp al,0" "je set" \ - "dec ecx" "jz set" "inc esi" "inc edi" "jmp lp" "set:" "setne al" "jbe end" "neg al" "end:" \ - parm [EDI] [ESI] [ECX] modify [EAX ECX EDI ESI]; - - char* radstrupr(void* s1); - #pragma aux radstrupr = "mov ecx,edi" "lp:" "mov al,[edi]" "cmp al,'a'" "jb c1" "cmp al,'z'" "ja c1" "sub [edi],32" "c1:" "inc edi" "cmp al,0" "jne lp" parm [EDI] modify [EAX EDI] value [ecx]; - - char* radstrlwr(void* s1); - #pragma aux radstrlwr = "mov ecx,edi" "lp:" "mov al,[edi]" "cmp al,'A'" "jb c1" "cmp al,'Z'" "ja c1" "add [edi],32" "c1:" "inc edi" "cmp al,0" "jne lp" parm [EDI] modify [EAX EDI] value [ecx]; - - u32 radstru32(const void* dest); - #pragma aux radstru32 = "cld" "xor ecx,ecx" "xor ebx,ebx" "xor edi,edi" "lodsb" "cmp al,45" "jne skip2" "mov edi,1" "jmp skip" "lp:" "mov eax,10" "mul ecx" "lea ecx,[eax+ebx]" \ - "skip:" "lodsb" "skip2:" "cmp al,0x39" "ja dne" "cmp al,0x30" "jb dne" "mov bl,al" "sub bl,0x30" "jmp lp" "dne:" "test edi,1" "jz pos" "neg ecx" "pos:" \ - parm [ESI] modify [EAX EBX EDX EDI ESI] value [ecx]; - - u16 GetDS(); - #pragma aux GetDS = "mov ax,ds" value [ax]; - - #ifdef __RADWINEXT__ - - #define _16To32(ptr16) ((void*)(((GetSelectorBase((u16)(((u32)(ptr16))>>16))+((u16)(u32)(ptr16)))-GetSelectorBase(GetDS())))) - - #endif - - #ifndef __RADWIN__ - #define int86 int386 - #define int86x int386x - #endif - - #define u32regs x - #define u16regs w - - #else - - #define radstrcpy strcpy - #define radstrcat strcat - #define radmemcpy memcpy - #define radmemcpydb memmove - #define radmemcmp memcmp - #define radmemset memset - #define radstrlen strlen - #define radstrchr strchr - #define radtoupper toupper - #define radstru32(s) ((u32)atol(s)) - #define radstricmp _stricmp - #define radstrcmp strcmp - #define radstrupr _strupr - #define radstrlwr _strlwr - #define BreakPoint() _asm {int 3} - - #ifdef _MSC_VER - - #pragma warning( disable : 4035) - - typedef char* RADPCHAR; - - u32 __inline radsqr(u32 m) { - _asm { - mov eax,[m] - mul eax - } - } - - u32 __inline mult64anddiv(u32 m1,u32 m2, u32 d) { - _asm { - mov eax,[m1] - mov ecx,[m2] - mul ecx - mov ecx,[d] - div ecx - } - } - - s32 __inline radabs(s32 ab) { - _asm { - mov eax,[ab] - test eax,eax - jge skip - neg eax - skip: - } - } - - u8 __inline radinp(u16 p) { - _asm { - mov dx,[p] - in al,dx - } - } - - void __inline radoutp(u16 p,u8 v) { - _asm { - mov dx,[p] - mov al,[v] - out dx,al - } - } - - RADPCHAR __inline radstpcpy(char* p1, char* p2) { - _asm { - mov edx,[p1] - mov ecx,[p2] - cld - lp: - mov al,[ecx] - inc ecx - mov [edx],al - inc edx - cmp al,0 - jne lp - dec edx - mov eax,edx - } - } - - RADPCHAR __inline radstpcpyrs(char* p1, char* p2) { - _asm { - mov edx,[p1] - mov ecx,[p2] - cld - lp: - mov al,[ecx] - inc ecx - mov [edx],al - inc edx - cmp al,0 - jne lp - dec ecx - mov eax,ecx - } - } - - void __inline radmemset16(void* dest,u16 value,u32 sizeb) { - _asm { - mov edi,[dest] - mov ax,[value] - mov ecx,[sizeb] - shl eax,16 - cld - mov ax,[value] - mov bl,cl - shr ecx,1 - rep stosd - mov cl,bl - and cl,1 - rep stosw - } - } - - void __inline radmemset32(void* dest,u32 value,u32 sizeb) { - _asm { - mov edi,[dest] - mov eax,[value] - mov ecx,[sizeb] - cld - rep stosd - } - } - - #pragma warning( default : 4035) - - #endif - - #endif - - #endif - -#else - - #define PTR4 __far - - #define u16 unsigned int - #define s16 signed int - - #ifdef __WATCOMC__ - - u32 radsqr(s32 a); - #pragma aux radsqr = "shl edx,16" "mov dx,ax" "mov eax,edx" "xor edx,edx" "mul eax" "shld edx,eax,16" parm [dx ax] modify [DX ax] value [dx ax]; - - s16 radabs(s16 ab); - #pragma aux radabs = "test ax,ax" "jge skip" "neg ax" "skip:" parm [ax] value [ax]; - - s32 radabs32(s32 ab); - #pragma aux radabs32 = "test dx,dx" "jge skip" "neg dx" "neg ax" "sbb dx,0" "skip:" parm [dx ax] value [dx ax]; - - u32 DOSOut(const char far* dest); - #pragma aux DOSOut = "cld" "and edi,0xffff" "mov dx,di" "mov ecx,0xffffffff" "xor eax,eax" 0x67 "repne scasb" "not ecx" "dec ecx" "mov bx,1" "push ds" "push es" "pop ds" "mov ah,0x40" "int 0x21" "pop ds" "movzx eax,cx" "shr ecx,16" \ - parm [ES DI] modify [AX BX CX DX DI ES] value [CX AX]; - - void DOSOutNum(const char far* str,u16 len); - #pragma aux DOSOutNum = "push ds" "mov ds,cx" "mov cx,bx" "mov ah,0x40" "mov bx,1" "int 0x21" "pop ds" parm [cx dx] [bx] modify [ax bx cx]; - - u32 ErrOut(const char far* dest); - #pragma aux ErrOut = "cld" "and edi,0xffff" "mov dx,di" "mov ecx,0xffffffff" "xor eax,eax" 0x67 "repne scasb" "not ecx" "dec ecx" "xor bx,bx" "push ds" "push es" "pop ds" "mov ah,0x40" "int 0x21" "pop ds" "movzx eax,cx" "shr ecx,16" \ - parm [ES DI] modify [AX BX CX DX DI ES] value [CX AX]; - - void ErrOutNum(const char far* str,u16 len); - #pragma aux ErrOutNum = "push ds" "mov ds,cx" "mov cx,bx" "mov ah,0x40" "xor bx,bx" "int 0x21" "pop ds" parm [cx dx] [bx] modify [ax bx cx]; - - void radmemset(void far *dest,u8 value,u32 size); - #pragma aux radmemset = "cld" "and edi,0ffffh" "shl ecx,16" "mov cx,bx" "mov ah,al" "mov bx,ax" "shl eax,16" "mov ax,bx" "mov bl,cl" "shr ecx,2" 0x67 "rep stosd" "mov cl,bl" "and cl,3" "rep stosb" parm [ES DI] [AL] [CX BX]; - - void radmemset16(void far* dest,u16 value,u32 size); - #pragma aux radmemset16 = "cld" "and edi,0ffffh" "shl ecx,16" "mov cx,bx" "mov bx,ax" "shl eax,16" "mov ax,bx" "mov bl,cl" "shr ecx,1" "rep stosd" "mov cl,bl" "and cl,1" "rep stosw" parm [ES DI] [AX] [CX BX]; - - void radmemcpy(void far* dest,const void far* source,u32 size); - #pragma aux radmemcpy = "cld" "push ds" "mov ds,dx" "and esi,0ffffh" "and edi,0ffffh" "shl ecx,16" "mov cx,bx" "shr ecx,2" 0x67 "rep movsd" "mov cl,bl" "and cl,3" "rep movsb" "pop ds" parm [ES DI] [DX SI] [CX BX] modify [CX SI DI ES]; - - s8 radmemcmp(const void far* s1,const void far* s2,u32 len); - #pragma aux radmemcmp = "cld" "push ds" "mov ds,dx" "shl ecx,16" "mov cx,bx" "rep cmpsb" "setne al" "jbe end" "neg al" "end:" "pop ds" parm [ES DI] [DX SI] [CX BX] modify [CX SI DI ES]; - - char far* radstrcpy(void far* dest,const void far* source); - #pragma aux radstrcpy = "cld" "push ds" "mov ds,dx" "and esi,0xffff" "and edi,0xffff" "mov dx,di" "lp:" "lodsb" "stosb" "test al,0xff" "jnz lp" "pop ds" parm [ES DI] [DX SI] modify [AX DX DI SI ES] value [es dx]; - - char far* radstpcpy(void far* dest,const void far* source); - #pragma aux radstpcpy = "cld" "push ds" "mov ds,dx" "and esi,0xffff" "and edi,0xffff" "lp:" "lodsb" "stosb" "test al,0xff" "jnz lp" "dec di" "pop ds" parm [ES DI] [DX SI] modify [DI SI ES] value [es di]; - - u32 radstrlen(const void far* dest); - #pragma aux radstrlen = "cld" "and edi,0xffff" "mov ecx,0xffffffff" "xor eax,eax" 0x67 "repne scasb" "not ecx" "dec ecx" "movzx eax,cx" "shr ecx,16" parm [ES DI] modify [AX CX DI ES] value [CX AX]; - - char far* radstrcat(void far* dest,const void far* source); - #pragma aux radstrcat = "cld" "and edi,0xffff" "mov ecx,0xffffffff" "and esi,0xffff" "push ds" "mov ds,dx" "mov dx,di" "xor eax,eax" 0x67 "repne scasb" "dec edi" "lp:" "lodsb" "stosb" "test al,0xff" "jnz lp" "pop ds" \ - parm [ES DI] [DX SI] modify [AX CX DI SI ES] value [es dx]; - - char far* radstrchr(const void far* dest,char chr); - #pragma aux radstrchr = "cld" "lp:" 0x26 "lodsb" "cmp al,dl" "je fnd" "cmp al,0" "jnz lp" "xor ax,ax" "mov es,ax" "mov si,1" "fnd:" "dec si" parm [ES SI] [DL] modify [AX SI ES] value [es si]; - - s8 radstricmp(const void far* s1,const void far* s2); - #pragma aux radstricmp = "and edi,0xffff" "push ds" "mov ds,dx" "and esi,0xffff" "lp:" "mov al,[esi]" "mov ah,[edi]" "cmp al,'a'" "jb c1" "cmp al,'z'" "ja c1" "sub al,32" "c1:" \ - "cmp ah,'a'" "jb c2" "cmp ah,'z'" "ja c2" "sub ah,32" "c2:" "cmp al,ah" "jne set" "cmp al,0" "je set" \ - "inc esi" "inc edi" "jmp lp" "set:" "setne al" "jbe end" "neg al" "end:" "pop ds" \ - parm [ES DI] [DX SI] modify [AX DI SI]; - - u32 radstru32(const void far* dest); - #pragma aux radstru32 = "cld" "xor ecx,ecx" "xor ebx,ebx" "xor edi,edi" 0x26 "lodsb" "cmp al,45" "jne skip2" "mov edi,1" "jmp skip" "lp:" "mov eax,10" "mul ecx" "lea ecx,[eax+ebx]" \ - "skip:" 0x26 "lodsb" "skip2:" "cmp al,0x39" "ja dne" "cmp al,0x30" "jb dne" "mov bl,al" "sub bl,0x30" "jmp lp" "dne:" "test edi,1" "jz pos" "neg ecx" "pos:" \ - "movzx eax,cx" "shr ecx,16" parm [ES SI] modify [AX BX DX DI SI] value [cx ax]; - - u32 mult64anddiv(u32 m1,u32 m2,u32 d); - #pragma aux mult64anddiv = "shl ecx,16" "mov cx,ax" "shrd eax,edx,16" "mov ax,si" "mul ecx" "shl edi,16" "mov di,bx" "div edi" "shld edx,eax,16" "and edx,0xffff" "and eax,0xffff" parm [cx ax] [dx si] [di bx] \ - modify [ax bx cx dx si di] value [dx ax]; - - #endif - -#endif - -RADDEFEND - -#define u32neg1 ((u32)(s32)-1) -#define RAD_align(var) var; u8 junk##var[4-(sizeof(var)&3)]; -#define RAD_align_after(var) u8 junk##var[4-(sizeof(var)&3)]={0}; -#define RAD_align_init(var,val) var=val; u8 junk##var[4-(sizeof(var)&3)]={0}; -#define RAD_align_array(var,num) var[num]; u8 junk##var[4-(sizeof(var)&3)]; -#define RAD_align_string(var,str) char var[]=str; u8 junk##var[4-(sizeof(var)&3)]={0}; - -RADEXPFUNC void PTR4* RADEXPLINK radmalloc(u32 numbytes); -RADEXPFUNC void RADEXPLINK radfree(void PTR4* ptr); - -#ifdef __WATCOMC__ - - char bkbhit(); - #pragma aux bkbhit = "mov ah,1" "int 0x16" "lahf" "shr eax,14" "and eax,1" "xor al,1" ; - - char bgetch(); - #pragma aux bgetch = "xor ah,ah" "int 0x16" "test al,0xff" "jnz done" "mov al,ah" "or al,0x80" "done:" modify [AX]; - - void BreakPoint(); - #pragma aux BreakPoint = "int 3"; - - u8 radinp(u16 p); - #pragma aux radinp = "in al,dx" parm [DX]; - - u8 radtoupper(u8 p); - #pragma aux radtoupper = "cmp al,'a'" "jb c1" "cmp al,'z'" "ja c1" "sub al,32" "c1:" parm [al] value [al]; - - void radoutp(u16 p,u8 v); - #pragma aux radoutp = "out dx,al" parm [DX] [AL]; - -#endif - -// for multi-processor machines - -#ifdef __RADNT__ - #define LockedIncrement(var) _asm { lock inc [var] } - #define LockedDecrement(var) _asm { lock dec [var] } -#else - #define LockedIncrement(var) _asm { inc [var] } - #define LockedDecrement(var) _asm { dec [var] } -#endif - -#endif - -#endif - diff --git a/src/win95/shpchunk.cpp b/src/win95/shpchunk.cpp index a494767..0514de0 100644 --- a/src/win95/shpchunk.cpp +++ b/src/win95/shpchunk.cpp @@ -423,7 +423,9 @@ BOOL Shape_Chunk::assoc_with_object_list(File_Chunk *fc) for (LIF n(&(hdptr->object_names_store)); !n.done(); n.next()) { - for (LIF l(&chlst); !l.done(); l.next()) + LIF l(&chlst); + + for (; !l.done(); l.next()) { ob = (Object_Chunk *)l(); if ( !strcmp(ob->object_data.o_name, n()) ) @@ -955,6 +957,8 @@ BOOL Shape_Polygon_Chunk::output_chunk (HANDLE &hand) void Shape_Polygon_Chunk::fill_data_block(char * data_start) { + int i, j; + strncpy (data_start, identifier, 8); data_start += 8; @@ -963,12 +967,12 @@ void Shape_Polygon_Chunk::fill_data_block(char * data_start) data_start += 4; - for (int i=0;i cl; lookup_child("SUBSHAPE",cl); - for (LIF cli(&cl); !cli.done(); cli.next()) + LIF cli(&cl); + + for (; !cli.done(); cli.next()) { max_id = max (max_id, ((Shape_Sub_Shape_Chunk *)cli())->get_header()->file_id_num); } diff --git a/src/win95/sprchunk.cpp b/src/win95/sprchunk.cpp index c8f74f3..4f718d2 100644 --- a/src/win95/sprchunk.cpp +++ b/src/win95/sprchunk.cpp @@ -266,7 +266,7 @@ Sprite_Header_Chunk::Sprite_Header_Chunk(const char * file_name, Chunk_With_Chil } -Sprite_Header_Chunk::write_file(const char* fname) +int Sprite_Header_Chunk::write_file(const char* fname) { HANDLE rif_file; @@ -287,7 +287,7 @@ Sprite_Header_Chunk::write_file(const char* fname) return 0; } -Sprite_Header_Chunk::output_chunk(HANDLE & hand) +BOOL Sprite_Header_Chunk::output_chunk(HANDLE & hand) { unsigned long junk; BOOL ok; diff --git a/src/win95/sprchunk.hpp b/src/win95/sprchunk.hpp index de0fff7..867f9f8 100644 --- a/src/win95/sprchunk.hpp +++ b/src/win95/sprchunk.hpp @@ -1,8 +1,8 @@ #ifndef _sprchunk_hpp #define _sprchunk_hpp #include "chunk.hpp" -#include "Chnktype.hpp" -//#include "stdafx.h" +#include "chnktype.hpp" + struct Frame { int Texture; @@ -24,7 +24,7 @@ public: Sprite_Header_Chunk(Chunk_With_Children* parent) : Chunk_With_Children(parent,"SPRIHEAD"){} - write_file(const char* fname); + int write_file(const char* fname); virtual BOOL output_chunk(HANDLE &hand); #if cencon virtual void post_input_processing(); diff --git a/src/win95/texio.c b/src/win95/texio.c index 27c85cb..0ffb1ae 100644 --- a/src/win95/texio.c +++ b/src/win95/texio.c @@ -3,8 +3,7 @@ #include "3dc.h" -#include -#include +#include #include "inline.h" @@ -19,7 +18,7 @@ #include #include -#include +#include #include "system.h" #include "equates.h" diff --git a/src/win95/wpchunk.cpp b/src/win95/wpchunk.cpp index c26a5a6..bc20a4f 100644 --- a/src/win95/wpchunk.cpp +++ b/src/win95/wpchunk.cpp @@ -116,6 +116,8 @@ Module_Waypoint_Chunk::Module_Waypoint_Chunk(Chunk_With_Children* parent,const c int first_ground_waypoint=-1; for(int i=0;iindex=i; @@ -139,7 +141,7 @@ Module_Waypoint_Chunk::Module_Waypoint_Chunk(Chunk_With_Children* parent,const c else cw->WayLinks=0; - for(int j=0;jNumWPLinks;j++) + for(j=0;jNumWPLinks;j++) { cw->WayLinks[j]=*(WaypointLink*)data; data+=sizeof(WaypointLink); @@ -244,6 +246,8 @@ void Module_Waypoint_Chunk::fill_data_block(char* data_start) for(int i=0;imin; @@ -270,7 +274,7 @@ void Module_Waypoint_Chunk::fill_data_block(char* data_start) *(int*)data_start=cw->NumWPLinks; data_start+=4; - for(int j=0;jNumWPLinks;j++) + for(j=0;jNumWPLinks;j++) { *(WaypointLink*)data_start=cw->WayLinks[j]; data_start+=sizeof(WaypointLink); @@ -299,9 +303,11 @@ void Module_Waypoint_Chunk::TransferWaypointData(Module_Waypoint_Chunk* mwc_from if(mwc_from->NumWaypoints) { + int i; + ChunkWaypoint* new_wp=new ChunkWaypoint[NumWaypoints+mwc_from->NumWaypoints]; //first take alien waypoints from this chunk - for(int i=0;i