Bloodcats

Kein Durchblick im Quellcode von Ja2? Hier werden sie geholfen.

Moderator: Flashy

Antworten
Wulfy301
Bravo-Squad
Beiträge: 640
Registriert: 18 Jun 2004, 22:58

Bloodcats

Beitrag von Wulfy301 » 22 Feb 2006, 16:20

[font=Arial]Hallo Leute,

ich Bitte um Hilfe von Source Spezialisten!:cry:
Ist hier jemand in der Lage die Bloodcat Programmzeilen (siehe unten) so abzuändern das man Bloodcats auch in Untergrund Maps einbauen kann?

[/font][font=Arial]void AddSoldierInitListBloodcats()
{
SECTORINFO *pSector;

[/font][font=Arial]SOLDIERINITNODE *curr;

[/font][font=Arial]UINT8 ubSectorID;

[/font][font=Arial]if( gbWorldSectorZ )
[/font][font=Arial]{
[/font][font=Arial]return; //no bloodcats underground.
}

[/font][font=Arial]ubSectorID = (UINT8)SECTOR( gWorldSectorX, gWorldSectorY );

[/font][font=Arial]pSector = &SectorInfo[ ubSectorID ];

[/font][font=Arial]if( !pSector->bBloodCatPlacements )

[/font][font=Arial]{ //This map has no bloodcat placements, so don't waste CPU time.

[/font][font=Arial]return;
}

[/font][font=Arial]if( pSector->bBloodCatPlacements )

[/font][font=Arial]{ //We don't yet know the number of bloodcat placements in this sector so

[/font][font=Arial]//count them now, and permanently record it.

[/font][font=Arial]INT8 bBloodCatPlacements = 0;

[/font][font=Arial]curr = gSoldierInitHead;

[/font][font=Arial]while( curr )
{
if( curr->pBasicPlacement->bBodyType == BLOODCAT )
{
bBloodCatPlacements++;
}
curr = curr->next;
}
if( bBloodCatPlacements != pSector->bBloodCatPlacements &&

ubSectorID != SEC_I16 && ubSectorID != [/font][font=Arial]SEC_N5 )

[/font][font=Arial]{
#ifdef JA2BETAVERSION

[/font][font=Arial]UINT16 str[200];

[/font][font=Arial]swprintf( str, L"Table specifies that there are %d bloodcat placements in sector %c%d, but the map actually has %d bloodcat placements. Map value takes precedence. KM,LC:1",
pSector->bBloodCatPlacements, gWorldSectorY + 'A' - 1, gWorldSectorX, bBloodCatPlacements );
DoScreenIndependantMessageBox( str, MSG_BOX_FLAG_OK, NULL );

[/font][font=Arial]#endif

[/font][font=Arial]pSector->bBloodCatPlacements = bBloodCatPlacements;

[/font][font=Arial]pSector->bBloodCats = -1;

[/font][font=Arial]if( !bBloodCatPlacements )
{
return;
[/font][font=Arial]}
[/font][font=Arial]}
}
if( pSector->bBloodCats > 0 )

[/font][font=Arial]{ //Add them to the world now...

[/font][font=Arial]UINT8 ubNumAdded = 0;

[/font][font=Arial]UINT8 ubMaxNum = (UINT8)pSector->bBloodCats;

[/font][font=Arial]SOLDIERINITNODE *mark;

[/font][font=Arial]UINT8 ubSlotsToFill;

[/font][font=Arial]UINT8 ubSlotsAvailable;

[/font][font=Arial]SOLDIERINITNODE *curr;
...

Mfg...[/font]
Du hast Probleme mit dem "grünen Rand" (Item-Dateien)? Sinclair hat die Lösung -> Guckst Du hier!:hit:

Realist
Alpha-Squad
Beiträge: 1573
Registriert: 24 Apr 2003, 11:00
Wohnort: Düsseldorf

Beitrag von Realist » 22 Feb 2006, 16:34

Man könnte meinen, es liegt daran:

Code: Alles auswählen

if( gbWorldSectorZ )
{
return; //no bloodcats underground.
}
Könnte man mal probieren wegzumachen.
Allerdings wird es wohl schon seinen Grund haben, dass diese Sperre existiert. :keinpeil:

Und was das bedeutet, ist auch fraglich:

Code: Alles auswählen

if( !pSector->bBloodCatPlacements )

{ //This map has no bloodcat placements, so don't waste CPU time.

return;
}

Wulfy301
Bravo-Squad
Beiträge: 640
Registriert: 18 Jun 2004, 22:58

Beitrag von Wulfy301 » 22 Feb 2006, 20:13

Sauber, jetzt stehe ich da, wie ein Depp - es funktioniert!:rolleyes:

Aber.... das war erst der Anfang.
Ziel ist es, die Monsteranimationen einzeln in U-Maps einbauen zu können und die Bloodcats dienen mir als Grundlage wie’s gehen könnte.

Vielen Dank erst mal!:k:

Mfg...
Du hast Probleme mit dem "grünen Rand" (Item-Dateien)? Sinclair hat die Lösung -> Guckst Du hier!:hit:

Azrael
Alpha-Squad
Beiträge: 1332
Registriert: 19 Mai 2001, 11:00
Kontaktdaten:

Beitrag von Azrael » 22 Feb 2006, 23:21

Ich frage mich gerade, ob das nicht böse in die Hose gehen kann, wenn man einfach nur die erste if-Abfrage rausnimmt.
Wegen

Code: Alles auswählen

ubSectorID = (UINT8)SECTOR( gWorldSectorX, gWorldSectorY );
pSector = &SectorInfo[ ubSectorID ]; 

beziehen sich die folgenden Abfragen ja dann wohl alle auf den falschen Sektor, nämlich nicht auf den unterirdischen, sondern auf den zugehörigen Sektor an der Oberfläche.
Some scientists claim that hydrogen, because it is so plentiful, is the basic building block of the universe. I dispute that. I say there is more stupidity than hydrogen, and that is the basic building block of the universe.
(Frank Zappa)

Wulfy301
Bravo-Squad
Beiträge: 640
Registriert: 18 Jun 2004, 22:58

Beitrag von Wulfy301 » 23 Feb 2006, 19:48

Der Versuch die Larven Animation einzeln in U-Maps einzubauen ist fehlgeschlagen.

Ich habe die Bloodcats Programmstruktur als Grundlage verwendet und entsprechend angepasst in den Source eingebaut. Es gibt keine Fehlermeldung beim erstellen einer neuen JA exe, trotzdem werden keine Larven im Spiel (Neustart), in die dafür angepasste U-Map generiert.

Im Anhang habe ich eine Auflistung beigelegt welche Änderungen ich im Source vorgenommen habe. Vielleicht kann jemand etwas damit anfangen und mir sagen wieso es so, nicht Funktioniert.:keinpeil:

Mfg...
Dateianhänge
Alle Änderungen.doc
(38.5 KiB) 1197-mal heruntergeladen
Du hast Probleme mit dem "grünen Rand" (Item-Dateien)? Sinclair hat die Lösung -> Guckst Du hier!:hit:

Azrael
Alpha-Squad
Beiträge: 1332
Registriert: 19 Mai 2001, 11:00
Kontaktdaten:

Beitrag von Azrael » 24 Feb 2006, 00:36

Initialisierst du denn irgendwo bLarvaePlacements mit einem sinnvollen Wert?
Sonst bricht die Methode nämlich bei if( !pSector->bLarvaePlacements ) ab.

bLarvae müsste wegen if( pSector->bLarvae > 0 ) ebenfalls korrekt initialisiert werden.
Some scientists claim that hydrogen, because it is so plentiful, is the basic building block of the universe. I dispute that. I say there is more stupidity than hydrogen, and that is the basic building block of the universe.
(Frank Zappa)

Wulfy301
Bravo-Squad
Beiträge: 640
Registriert: 18 Jun 2004, 22:58

Beitrag von Wulfy301 » 24 Feb 2006, 19:18

@Azrael

Du hast recht das habe ich nicht getan, ist aber auch der falsche Weg. Mit den Bloodcats wird der ganze Versuch noch schwieriger als es eh schon ist.

Ich habe es noch mal mit den Monster Routinen versucht, alles einfach kopiert und zusätzlich in den Source eingebaut und die Variable ubnumCreatures in ubnumAlien umbenannt. Gleiches Ergebnis, keine Fehlermeldung beim erstellen der exe, aber auch keine Monster in der Map.

Ich habe nun nach der ubnumCreatures im Source gesucht und sehr viele Einträge gefunden. Das Problem ist das ich nicht weiß, wo ich überall die ubnumAlien Variable hinzufügen muss. Ich glaube nämlich nicht dass, wo die ubnumCreatures vorhaben ist, auch eine zusätzliche ubnumAlien Variable hinzugefügt werden muss.

[font=Arial]//Neu
void AddSoldierInitListAlien(BOOLEAN fQueen, UINT8 ubNumLarvae, UINT8 ubNumInfants,
UINT8 ubNumYoungMales, UINT8 ubNumYoungFemales, UINT8 ubNumAdultMales,
UINT8 ubNumAdultFemales )
{
SOLDIERINITNODE *curr;
INT32 iRandom;
UINT8 ubFreeSlots;
BOOLEAN fDoPlacement;
UINT8 ubNumAlien;

SortSoldierInitList();

//Okay, if we have a queen, place her first. She MUST have a special placement, else
//we can't use anything.
ubNumAlien = (UINT8)(ubNumLarvae + ubNumInfants + ubNumYoungMales + ubNumYoungFemales + ubNumAdultMales + ubNumAdultFemales);
if( fQueen )
{
curr = gSoldierInitHead;
while( curr )
{
if( !curr->pSoldier && curr->pBasicPlacement->bTeam == CREATURE_TEAM && curr->pBasicPlacement->bBodyType == QUEENMONSTER )
{
if( !AddPlacementToWorld( curr ) )
{
fQueen = FALSE;
break;
}
}
curr = curr->next;
}
if( !fQueen )
{
#ifdef JA2BETAVERSION
ScreenMsg( FONT_RED, MSG_ERROR, L"Couldn't place the queen." );
#endif
}
}

//First fill up only the priority existance slots (as long as the availability and bodytypes match)
curr = gSoldierInitHead;
while( curr && curr->pBasicPlacement->fPriorityExistance && ubNumAlien )
{
fDoPlacement = TRUE;

if( curr->pBasicPlacement->bTeam == CREATURE_TEAM )
{
//Matching team, now check the soldier class...
if( ubNumLarvae && curr->pBasicPlacement->bBodyType == LARVAE_MONSTER )
ubNumLarvae--;
[/font]usw...

Mfg...
Du hast Probleme mit dem "grünen Rand" (Item-Dateien)? Sinclair hat die Lösung -> Guckst Du hier!:hit:

Antworten