冒险解谜游戏中文网 ChinaAVG
标题:
半影系列引擎源代码公开 2010.10.7 更新
[打印本页]
作者:
shane007
时间:
2010-10-5 23:53
标题:
半影系列引擎源代码公开 2010.10.7 更新
相关网址
/ J# o+ Y2 \$ b
http://www.frictionalgames.com/forum/forum-27.html
) j! Z/ x% L3 x T1 q' t
/ c9 i. L) _% t$ E
----------------------------------
9 W8 `5 O# u& }; b" g
2010.10.7 更新
; V+ O( B. n' j2 ^' y
研究了一下这个游戏的源代码,在\sources\resources\FontManager.cpp里,我发现这个游戏还可以支持ttf字体文件。
3 Q9 d! c9 ?: O. x6 h X
方法很简单,只要在fonts目录下放上和.fnt文件同名的.ttf文件,然后把.fnt文件移走即可。
- h& m% }0 Y. z+ i* J
相关代码如下
5 x% G6 I/ I0 f4 Q, h7 a
iFontData* cFontManager::CreateFontData(const tString& asName, int alSize,unsigned short alFirstChar,
2 o& C1 \5 J, q- m# D& _1 Y" W
unsigned short alLastChar)
7 {" }- t9 e, ^, Y5 j' q
{
7 C- r7 X& H* u, l* `0 h
tString sPath;
/ n+ }4 B8 @8 ]' }
iFontData* pFont;
8 E4 ^/ u# }6 _ p
tString asNewName = cString::ToLowerCase(asName);
+ Z% a5 P* S3 e0 J$ H
BeginLoad(asName);
! L( a$ `- o* }$ P4 R# y3 C. {; ~
2 G* u( j3 T. G0 j4 d$ [2 E! c$ G
//asNewName = cString::SetFileExt(asName,"ttf");
0 }5 G: x$ v4 m9 m/ C
pFont = static_cast<iFontData*>(this->FindLoadedResource(asNewName,sPath));
& p3 T4 R* q6 L! R7 V/ C3 i
if(pFont==NULL && sPath!="")
& l4 F0 O9 ]5 j% o3 V
{
. U% `; f9 M, x7 P5 t9 {
pFont = mpGraphics->GetLowLevel()->CreateFontData(asNewName);
5 e& m' s2 Z5 c. Z: G# V4 M
pFont->SetUp(mpGraphics->GetDrawer(),mpLowLevelResources,mpGui);
& C4 i5 q6 h9 P' b
( R$ J0 \, S/ k9 X. z& [
tString sExt = cString::ToLowerCase(cString::GetFileExt(asName));
8 \3 p6 o* C2 E9 s4 s% m
//True Type Font
8 z+ y" P5 q1 U" V P- x2 c
if(sExt == "ttf")
# [9 p" x- } \: G# `# {7 d& a8 E, @
{
6 W) O& I/ {( |% p/ o5 U" O- M
if(pFont->CreateFromFontFile(sPath,alSize,alFirstChar,alLastChar)==false){
( } J) p4 i: V' b
hplDelete(pFont);
# t2 \, ?! n; ]4 R+ A# Z' I
EndLoad();
& m6 a: \* E# ~6 i$ H+ h2 m3 X
return NULL;
' M& x% `, o+ U. b( h5 L9 h0 ]
}
, }0 ~* J% t. G6 W
}
6 o; B2 S1 F2 b% N
//Angel code font type
( y! _0 a- U5 h" Z N3 f
else if(sExt == "fnt")
5 k. Y. G% {0 g. j: y
{
! U; G4 r. { c8 b
if(pFont->CreateFromBitmapFile(sPath)==false){
& H8 o1 x8 f4 g2 t# u( r3 Z- _
hplDelete(pFont);
/ h; k8 ~7 ~- L9 K2 C7 Q! Z) G
EndLoad();
. X+ h. o0 k( t0 \" Y7 |
return NULL;
4 \$ j- @* Q3 p7 R
}
' m7 n$ H9 o% l3 H6 A* R9 h) V% C, ^1 ^
}
" _6 _. D1 j+ O' W( S: f1 s5 G
else
0 A- Y- G5 _0 ?- \- {+ x$ f' W& L
{
6 E7 U5 N1 G) |) k3 D
Error("Font '%s' has an unkown extension!\n",asName.c_str());
3 V& V5 J; Z/ g( M! {
hplDelete(pFont);
. ?$ h) Y$ \# Q. p. k) ~2 u ~
EndLoad();
) c# ^& O8 a, `2 F* Y
return NULL;
: t) j- z+ \5 w1 o8 [8 N
}
' }: r- s# C3 g7 o3 d- u
5 ]# Y* O$ d7 w$ R. w% I. F( ^
//mpResources->GetImageManager()->FlushAll();
- z$ m# P7 D6 G
AddResource(pFont);
/ A+ j* g I0 s" S% _ C
}
" X% C, b0 N- M: V5 ?8 ^
if(pFont)pFont->IncUserCount();
5 k& l: r' o5 s+ a
else Error("Couldn't create font '%s'\n",asNewName.c_str());
' C$ a! ^* V! ^2 A6 \
& n9 K w- g9 H6 j$ F7 ], F. @
EndLoad();
# x: i; N, Q p7 \( J
return pFont;
- ]. V# c! G1 f& |% [7 o% [- I. l& v: V
}
作者:
shane007
时间:
2010-10-7 07:58
Credits.cpp(44): mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
/ B' L5 v# _7 X$ \+ U
DeathMenu.cpp(45): mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
9 F5 p- ?7 Q% A9 [# L
DeathMenu.cpp(177): mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
1 E* ~ S8 `: r# n2 S7 E
DemoEndText.cpp(39): //mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
* ~; \( C8 e H
EffectHandler.cpp(676): mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
5 A: R9 K- m! A6 f( E/ M
GameMessageHandler.cpp(39): mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
m8 H( P. U) _5 s
GraphicsHelper.cpp(40): mpFont =mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("font_menu_small.fnt");
s6 N; a! ]6 k R* [2 ?
Init.cpp(607): mpDefaultFont = mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
' i% X M% s1 I0 A2 S) [3 t) j f
IntroStory.cpp(340): mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("font_computer.fnt");
/ @! ?. H& B. X
Inventory.cpp(59): mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
2 T4 p9 |6 d' p, _' x
Inventory.cpp(193): mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
) C2 ]8 E9 d' z8 a' W( U1 w
Inventory.cpp(744): mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
! e3 H E6 N% B% m, l# N
MainMenu.cpp(101): mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("font_menu_small.fnt",30);
+ i. [) j" k6 T( [
MainMenu.cpp(188): mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("font_menu_small.fnt",30);
* m2 ^% D7 V6 f1 p% q
MainMenu.cpp(291): mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("font_menu_small.fnt",30);
" M# P% Z2 ^1 {
MainMenu.cpp(410): mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("font_menu_small.fnt",30);
# k5 ^3 R% S( T
MainMenu.cpp(2070): mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("font_menu_small.fnt",20,32,255);
3 n3 F+ Y8 L- J* C H
MainMenu.cpp(2071): mpTipFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
. Q3 E( ?) q; v6 H
MapLoadText.cpp(40): mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
7 J. j: t, R7 R+ i, o O8 m
MapLoadText.cpp(41): mpTextFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("font_computer.fnt");
' ^* s. [: `# @4 |2 K# `' W( [ F
Notebook.cpp(39): mpFrontFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
# J' A, [2 O7 Q1 {# m
Notebook.cpp(168): mpTextFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("cour.fnt",14);
y/ m: D6 a. Z; q4 D5 Q+ A
Notebook.cpp(397): mpTextFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt",14);
/ ~- F3 @, k& c4 x! S- P' A, d
Notebook.cpp(670): mpTextFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("cour.fnt",14);
, J' r7 u, H0 o7 _4 s- @. `& ?; A' X
Notebook.cpp(671): mpNavigateFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
! y0 a3 @8 ]1 G# R
Player.cpp(196): mpFont = mpResources->GetFontManager()->CreateFontData("verdana.fnt");
/ P$ ]4 z% q0 q: p
PlayerHelper.cpp(2134): mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
6 ]8 S& s7 A$ b0 e1 i* n3 G
PlayerState_Interact.cpp(53): mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
% {0 M7 G3 A ^5 q; [4 w: f4 m
PlayerState_InteractHaptX.cpp(54): mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
: g$ z5 ~1 R/ S3 V
PreMenu.cpp(39): mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
; j7 h3 p% f- E2 f' A) j
PreMenu.cpp(40): mpTextFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("font_computer.fnt");
" c2 x+ E' Y4 T$ D" W2 m! b
RadioHandler.cpp(35): mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
作者:
shane007
时间:
2010-10-7 11:42
2010.10.7 更新
欢迎光临 冒险解谜游戏中文网 ChinaAVG (https://chinaavg.com/)
Powered by Discuz! X3.2