comparison mm7_4.cpp @ 1545:c4ab816fcc5e

assert, Abortf, AbortWithError -> Assert, Error refactors here and there
author Nomad
date Sat, 07 Sep 2013 20:05:20 +0200
parents 61458df2cb4f
children 9a6567c6c76c
comparison
equal deleted inserted replaced
1544:499761153844 1545:c4ab816fcc5e
1 #ifdef _MSC_VER 1 #ifdef _MSC_VER
2 #define _CRT_SECURE_NO_WARNINGS 2 #define _CRT_SECURE_NO_WARNINGS
3 #endif 3 #endif
4
5 #include <assert.h>
6 4
7 #include "Texture.h" 5 #include "Texture.h"
8 #include "mm7_data.h" 6 #include "mm7_data.h"
9 #include "VideoPlayer.h" 7 #include "VideoPlayer.h"
10 #include "Sprites.h" 8 #include "Sprites.h"
1556 1554
1557 v1 = Str; 1555 v1 = Str;
1558 v2 = fopen("data\\dpft.bin", "wb"); 1556 v2 = fopen("data\\dpft.bin", "wb");
1559 v3 = v2; 1557 v3 = v2;
1560 if ( !v2 ) 1558 if ( !v2 )
1561 Abortf("Unable to save dpft.bin!"); 1559 Error("Unable to save dpft.bin");
1562 fwrite(v1, 4u, 1u, v2); 1560 fwrite(v1, 4u, 1u, v2);
1563 fwrite(v1->pFrames, 0xAu, v1->uNumFrames, v3); 1561 fwrite(v1->pFrames, 0xAu, v1->uNumFrames, v3);
1564 fclose(v3); 1562 fclose(v3);
1565 } 1563 }
1566 1564
1613 v2 = this; 1611 v2 = this;
1614 //TileTable::dtor((TileTable *)this); 1612 //TileTable::dtor((TileTable *)this);
1615 v3 = fopen(Args, "r"); 1613 v3 = fopen(Args, "r");
1616 File = v3; 1614 File = v3;
1617 if ( !v3 ) 1615 if ( !v3 )
1618 Abortf("PlayerFrameTable::load - Unable to open file: %s.", Args); 1616 Error("PlayerFrameTable::load - Unable to open file: %s.", Args);
1619 v4 = 0; 1617 v4 = 0;
1620 v25 = 0; 1618 v25 = 0;
1621 v26 = 1; 1619 v26 = 1;
1622 if ( fgets(&Buf, 490, v3) ) 1620 if ( fgets(&Buf, 490, v3) )
1623 { 1621 {
1626 *strchr(&Buf, 10) = 0; 1624 *strchr(&Buf, 10) = 0;
1627 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); 1625 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24));
1628 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) 1626 if ( v24.uPropCount && *v24.pProperties[0] != 47 )
1629 { 1627 {
1630 if ( v24.uPropCount < 3 ) 1628 if ( v24.uPropCount < 3 )
1631 Abortf("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26); 1629 Error("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26);
1632 ++v25; 1630 ++v25;
1633 } 1631 }
1634 ++v26; 1632 ++v26;
1635 } 1633 }
1636 while ( fgets(&Buf, 490, File) ); 1634 while ( fgets(&Buf, 490, File) );
1638 } 1636 }
1639 v2->uNumFrames = v4; 1637 v2->uNumFrames = v4;
1640 v5 = pAllocator->AllocNamedChunk(v2->pFrames, 10 * v4, "P Frames"); 1638 v5 = pAllocator->AllocNamedChunk(v2->pFrames, 10 * v4, "P Frames");
1641 v2->pFrames = (PlayerFrame *)v5; 1639 v2->pFrames = (PlayerFrame *)v5;
1642 if ( !v5 ) 1640 if ( !v5 )
1643 Abortf("PlayerFrameTable::load - Out of Memory!"); 1641 Error("PlayerFrameTable::load - Out of Memory!");
1644 v6 = File; 1642 v6 = File;
1645 v2->uNumFrames = 0; 1643 v2->uNumFrames = 0;
1646 fseek(v6, 0, 0); 1644 fseek(v6, 0, 0);
1647 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) 1645 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) )
1648 { 1646 {