\n"
"Language-Team: German\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: src/baller1.c:68
msgid "Oaf"
msgstr "Tlpel"
#: src/baller1.c:68
msgid "Yokel"
msgstr "Dummel"
#: src/baller1.c:68
msgid "Boor"
msgstr "Brubbel"
#: src/baller1.c:68
msgid "Doofus"
msgstr "Wusel"
#: src/baller1.c:69
msgid "Fumbler"
msgstr "Brsel"
#: src/baller1.c:69
msgid "Geezer"
msgstr "Toffel"
#: src/baller1.c:69
msgid "Ruffian"
msgstr "Rpel"
#: src/baller1.c:105
msgid "Not enough memory for loading the castles."
msgstr "Nicht genug Speicher um die Burgen zu laden."
#: src/baller1.c:117
msgid "William"
msgstr "Wilhelm"
#: src/baller1.c:118
msgid "Frederick"
msgstr "Friedrich"
#: src/baller1.c:180
msgid "Games"
msgstr "Spiele"
#: src/baller1.c:181
msgid "Total won"
msgstr "Gewonnen"
#: src/baller1.c:182
msgid "Total lost"
msgstr "Verloren"
#: src/baller1.c:183
msgid "Won in %"
msgstr "Siege %"
#: src/baller1.c:295
msgid "You don't have enough gunpowder."
msgstr "Dein Pulver reicht nicht!"
#: src/baller1.c:295 src/baller1.c:299
msgid "Cancel"
msgstr "Abbruch"
#: src/baller1.c:299
msgid "You don't have any cannonballs left."
msgstr "Du hast keine Kugeln mehr!"
#: src/baller1.c:385
#, c-format
msgid "!! %s has won !!"
msgstr "!! %s hat gewonnen !!"
#: src/baller1.c:398
#, c-format
msgid "( %s' king was hit,"
msgstr "( %s' Knig wurde getroffen,"
#: src/baller1.c:400
#, c-format
msgid "( %s's king was hit,"
msgstr "( %ss Knig wurde getroffen,"
#: src/baller1.c:401
msgid "and upon hearing this, the people capitulated. )"
msgstr " daraufhin ergab sich dessen Volk. )"
#: src/baller1.c:405
#, c-format
msgid "( %s' king has capitulated"
msgstr "( %s' Knig hat aufgrund der"
#: src/baller1.c:408
#, c-format
msgid "( %s's king has capitulated"
msgstr "( %ss Knig hat aufgrund der"
#: src/baller1.c:410
msgid " because of the hopeless situation. )"
msgstr " aussichtslosen Lage kapituliert. )"
#: src/baller1.c:413
#, c-format
msgid "( %s has no folk left. )"
msgstr "( %s hat kein Volk mehr. )"
#: src/baller1.c:417
msgid "( The limit of maximum rounds has been reached."
msgstr "( Die maximale Rundenzahl ist erreicht."
#: src/baller1.c:418
#, c-format
msgid "%s is worse off. )"
msgstr "%s befindet sich in der schlechteren Lage. )"
#: src/baller1.c:514
msgid "Wind:"
msgstr ""
#: src/baller2.c:507
msgid " Round "
msgstr " Runde "
#: src/baller2.c:680
msgid "The king says:"
msgstr "Der Knig meint:"
#: src/baller2.c:681
msgid "Humbly acknowledged"
msgstr "Demtig zur Kenntnis genommen"
#: src/baller2.c:682
msgid ""
"Well...\n"
" alright...\n"
" Carry on..."
msgstr ""
"Naja...\n"
" Nun gut...\n"
" Weiter so..."
#: src/baller2.c:683
msgid ""
"We are satisfied\n"
" with your performance!"
msgstr ""
"Ich bin zufrieden\n"
" mit Ihren Leistungen!"
#: src/baller2.c:684
msgid ""
"Excellent,\n"
" keep at it!"
msgstr ""
"Hervorragend,\n"
" weiter so!"
#: src/baller2.c:685
msgid ""
"Maybe you ought to\n"
" lower Our taxes..."
msgstr ""
"Vielleicht sollten Sie mal\n"
" die Steuern senken..."
#: src/baller2.c:686
msgid ""
"If you keep this up,\n"
" We shall discharge you!"
msgstr ""
"Wenn Sie so weiter machen\n"
" werde ich Sie entlassen!"
#: src/baller2.c:687
msgid ""
"Why don't you buy\n"
" a shaft tower..."
msgstr ""
"Vielleicht mal 'nen\n"
" Frderturm kaufen..."
#: src/baller2.c:688
msgid ""
"You ought to\n"
" kindly make more of\n"
" an effort!"
msgstr ""
"Sie sollten sich\n"
" geflligst mehr Mhe\n"
" geben!"
#: src/baller2.c:689
msgid ""
"You don't need to visit Us\n"
" in each round."
msgstr ""
"Sie brauchen nicht\n"
" jede Runde zu kommen."
#: src/baller2.c:690
#, c-format
msgid ""
"Are you aware\n"
" that you have already visited Us\n"
" %d times thus far?"
msgstr ""
"Wissen Sie eigentlich,\n"
" dass Sie mich bereits\n"
" %d mal besucht haben?"
#: src/baller2.c:691
msgid ""
"So, are you certain\n"
" that you will manage\n"
" without a weather vane?"
msgstr ""
"Und Sie sind sich sicher,\n"
" dass Sie auch ohne eine\n"
" Windfahne zurecht kommen?"
#: src/baller2.c:692
msgid "Nice to see you..."
msgstr "Schn, Sie zu sehen..."
#: src/baller2.c:693
msgid ""
"What are We supposed\n"
" to say in such an\n"
" early phase?"
msgstr ""
"Was soll ich denn in\n"
" so einer frhen Phase\n"
" schon sagen?"
#: src/baller2.c:694
msgid ""
"You ought to earn more money,\n"
" build more shaft towers,\n"
" and vanquish the opponent."
msgstr ""
"Sie sollten mehr Geld\n"
" verdienen, Frdertrme bauen\n"
" und den Gegner besiegen."
#: src/baller2.c:695
msgid ""
"We do not have anything new\n"
" to say to you."
msgstr ""
"Ich habe Ihnen nichts\n"
" neues zu sagen."
#: src/baller2.c:696
msgid ""
"We are pleased for you\n"
" to come around and visit Us."
msgstr ""
"Find' ich nett, dass\n"
" Sie mich mal besuchen!"
#: src/baller2.c:711
msgid ""
"The king is not in the mood\n"
"to talk to you."
msgstr ""
"Der Knig hat keine Lust,\n"
"dich zu sprechen."
#: src/baller2.c:711
msgid "Too bad."
msgstr "Schade"
#: src/ballergui.c:52 src/settings.c:222
msgid "Quit Ballerburg?"
msgstr "Ballerburg beenden?"
#: src/ballergui.c:52 src/settings.c:222
msgid "Yes"
msgstr "Ja"
#: src/ballergui.c:52 src/settings.c:222
msgid "No"
msgstr "Nein"
#: src/cannoneer.c:59
msgid "Cannon"
msgstr "Kanone"
#: src/cannoneer.c:61
msgid "Angle:"
msgstr "Winkel:"
#: src/cannoneer.c:68 src/market.c:83
msgid "Gunpowder:"
msgstr "Pulver:"
#: src/market.c:77
msgid "You have:"
msgstr "Du hast:"
#: src/market.c:79
msgid "Funds:"
msgstr "Geld:"
#: src/market.c:80
msgid "Shaft towers:"
msgstr "Frdertrme:"
#: src/market.c:81
msgid "Cannons:"
msgstr "Geschtze:"
#: src/market.c:82 src/market.c:104
msgid "Weather vane:"
msgstr "Windfahne:"
#: src/market.c:84
msgid "Cannonballs:"
msgstr "Kugeln:"
#: src/market.c:85
msgid "Population:"
msgstr "Volk:"
#: src/market.c:86
msgid "Taxes in %"
msgstr "Steuern in %"
#: src/market.c:99
msgid "Market:"
msgstr "Markt:"
#: src/market.c:101
msgid "Lay bricks:"
msgstr "Anbauen:"
#: src/market.c:102
msgid "Shaft tower:"
msgstr "Frderturm:"
#: src/market.c:103
msgid "Cannon:"
msgstr "Geschtz:"
#: src/market.c:105
msgid "Powder x30:"
msgstr "30 Pulver:"
#: src/market.c:106
msgid "2 cannonballs:"
msgstr "2 Kugeln:"
#: src/market.c:114 src/screen.c:56
msgid "Done"
msgstr "Fertig"
#: src/market.c:135
msgid " Lay bricks: "
msgstr " Anbauen: "
#: src/market.c:136 src/market.c:162
#, c-format
msgid " Bricks left: %02d "
msgstr " Verbleibende Steine: %02d "
#: src/settings.c:64
msgid "Settings"
msgstr "Einstellungen"
#: src/settings.c:67 src/settings.c:246
msgid "Player 1"
msgstr "Spieler 1"
#: src/settings.c:68 src/settings.c:85
msgid "Name:"
msgstr "Name:"
#: src/settings.c:70 src/settings.c:87
msgid "Human"
msgstr "Mensch"
#: src/settings.c:71 src/settings.c:88
msgid "Computer"
msgstr "Computer"
#: src/settings.c:72 src/settings.c:89
msgid "AI strategy:"
msgstr "KI Strategie:"
#: src/settings.c:77 src/settings.c:94
msgid "AI strength:"
msgstr "KI Strke:"
#: src/settings.c:84 src/settings.c:250
msgid "Player 2"
msgstr "Spieler 2"
#: src/settings.c:100
msgid "Maximum rounds:"
msgstr "Maximale Rundenzahl:"
#: src/settings.c:104
msgid "unlimited"
msgstr "unbegrenzt"
#: src/settings.c:106
msgid "King may capitulate"
msgstr "Knig kann kapitulieren"
#: src/settings.c:107
msgid "Players may build"
msgstr "Anbauen ist erlaubt"
#: src/settings.c:109 src/settings.c:244
msgid "New game"
msgstr "Neues Spiel"
#: src/settings.c:110
msgid "Continue game"
msgstr "Weiterspielen"
#: src/settings.c:111
msgid "Exit program"
msgstr "Programm beenden"
ballerburg-1.2.1/doc/ 0000775 0001750 0001750 00000000000 14244352606 013761 5 ustar thomas thomas ballerburg-1.2.1/doc/de/ 0000775 0001750 0001750 00000000000 14244352606 014351 5 ustar thomas thomas ballerburg-1.2.1/doc/de/anleitung.html 0000664 0001750 0001750 00000035461 14244352606 017236 0 ustar thomas thomas
Ballerburg SDL Anleitung
Spielanleitung zu Ballerburg SDL
1. Sinn des Spieles
Bei dem Spiel Ballerburg geht es darum, dass sich zwei Burgherren mit dem Ziel
gegenüber stehen, durch gezielte Kanonenschüsse den Gegner zu
besiegen. Dabei haben die Spieler die Möglichkeit, durch Kauf von
Fördertürmen Geld zu verdienen, vom Volk Steuern zu fordern und mit
diesen Einnahmen zum Beispiel neue Geschütze und Munition zu kaufen.
2. Verschiedene Spielmodi
Über die ESC-Taste erreichen Sie das Einstellungsmenü, in welchem Sie
verschiedene Spielmodi auswählen können:
Normalerweise kämpfen zwei Spieler
gegeneinander. Weiterhin besteht die Möglichkeit, dass ein Spieler gegen
einen Computer spielt. Dabei kann der Computer wahlweise auf der linken
oder rechten Seite spielen. Schließlich können Sie auch zwei Computer
gegeneinander spielen lassen. Da Sie den Modus während des laufenden
Spieles ändern können, besteht zum Beispiel die Möglichkeit, dass
Sie zwischendurch auch einmal den Computer für sich schießen lassen,
oder dass Sie in einem aussichtslosen Kampf gegen den Computer durch
vorübergehendes Umschalten auf 'Spieler gegen Spieler' Ihren Gegner durch
eigene Entscheidungen schwächen.
3. Spielernamen und Computerspieler
Im Einstellungsmenü können Sie die Namen der menschlichen Spieler
bestimmen. Die Namen der Computer legen Sie beim unter 'KI Strategie' fest.
Beides kann auch während einer Partie geändert werden.
Computer 1 und Spieler 1 spielen immer auf der linken Computer 2 und Spieler 2
auf der rechten Seite. Die Namen der Computer stehen gleichzeitig für
eine bestimmte Strategie. Die Zahlen 1-4 unter 'KI Stärke' stellen die
Treffsicherheit der Computerspieler dar. Dabei bedeutet 4, dass praktisch jeder
Schuss ein Treffer ist. Die Strategien unterscheiden sich darin, dass die
Computer den Zielen eine unterschiedliche Priorität geben, d.h. manche
Computer schießen grundsätzlich auf Kanonen, wenn welche vorhanden
sind, während andere zum Beispiel eher auf das gegnerische Geld zielen.
Tölpel : |
Kein konkretes Ziel, versucht nur, die Burg irgendwie zu treffen. |
Dummel : |
Geld vor Pulver/Kugeln vor König |
Brubbel : |
Geld vor Kanonen vor König |
Wusel : |
Geld, Pulver, Kugeln, Fördertürme, Kanonen, König:
Alle mit gleicher Wahrscheinlichkeit |
Brösel : |
Kanonen vor König |
Toffel : |
Förderturme vor Kanonen vor König |
Rüpel : |
Zielt nur auf den König. |
Desweiteren sind nur Wusel, Brösel, Toffel und Rüpel in der Lage, sich
Fördertürme zu kaufen.
4. Neues Spiel, Wahl der Burgen
Nach Anklicken von 'Neues Spiel' können Sie für die beiden Seiten
Burgen auswählen und anschließend mit 'OK' das Spiel beginnen.
Sollten Sie nicht bereits die Burgendatei 'BALLER.DAT' erweitert haben, so
stehen Ihnen 9 Burgen zur Verfügung. Bei gleichguten Spielern sollten Sie
in der Regel auch gleiche Burgen auswählen, denn sie unterscheiden sich in
der Stärke teilweise recht erheblich untereinander. Bei der Wahl von
kleineren Burgen wird sich natürlich auch im allgemeinen die
Gesamtspieldauer verkürzen.
Hier nun die Werte der Standard-Burgen:
Kanonen | Geld | Pulver | Kugeln | Volk |
2 | 400 | 180 | 12 | 200 |
5 | 500 | 180 | 12 | 270 |
5 | 500 | 150 | 14 | 270 |
6 | 500 | 190 | 12 | 300 |
3 | 500 | 120 | 6 | 220 |
4 | 500 | 120 | 10 | 240 |
6 | 800 | 120 | 12 | 500 |
3 | 500 | 120 | 9 | 500 |
1 | 1000 | 120 | 12 | 300 |
5. Das Spielfeld: Der Berg und die Burgen
Nachdem Sie nun mit 'Neues Spiel' das Spiel begonnen haben, werden die
Burgen und der Berg gezeichnet. Sowohl die Lage der Burgen als auch das
Aussehen und die Höhe das Berges sind (innerhalb eines gewissen Rahmens)
zufällig. Die Burgen bestehen aus folgenden Teilen:
- den eigentlichen Gemäuern sowie den Dächern
- dem Saal, im dem der König thront
- den verschiedenen Kanonen
- der Pulverkammer (ein Fass entspricht 30 Pulvereinheiten)
- der Kammer für die Kugeln
- der Schatzkammer (ein Sack entspricht 150 Geldeinheiten)
- der Windfahne (es ist immer nur die Windfahne des Spielers, der an der
Reihe ist, gehisst)
Durch die aktive Windanzeige sieht man, wer am Zug ist. Ist der Spieler im
Besitz einer Windfahne, so wird sie im Kasten unten vergrößert
gezeigt und außerdem die genaue Windgeschwindigkeit und -richtung
angegeben.
6. Spielablauf
Nach dem Starten des Spieles führen die Spieler immer abwechselnd Ihre
Aktionen aus, bis einer gewonnen hat. Innerhalb eines Zuges kann der
Spieler verschiedene Dinge machen: Nach Anklicken einer der Kammern für
Pulver, Kugeln oder Geld wird der Besitz des Spielers angezeigt und man
hat dann die Möglichkeit, auf dem Markt verschiedene Dinge zu kaufen. Mehr
dazu wird im nächsten Abschnitt gesagt. Durch Anklicken des Königs
können Sie erfahren, was Ihr Herrscher denn zu Ihren Erfolgen zu sagen hat.
Abgeschlossen werden kann der Zug durch zweierlei Möglichkeiten: Sollten
Sie keine Kanone, nicht genügend Pulver bzw. Kugeln oder einfach keine
Lust zum Schießen haben, so müssen Sie auf 'Fertig' am unteren
Bildschirmrand klicken.
Andernfalls wählen Sie die Kanone, mit der Sie schießen wollen, aus,
stellen Winkel und Pulver ein und klicken auf 'OK'. (Näheres zum
Schießen in Abschnitt 8)
7. Der eigene Besitz und der Markt
Wenn Sie während Ihres Zuges auf eine der drei Kammern klicken, so
erscheint eine Übersicht, auf die jetzt näher eingegangen werden soll.
Unter 'Du hast' steht eine genaue Aufzählung über Ihren Besitz sowie
über die Größe Ihres Volkes. Außerdem können Sie
hier die Steuern, die Sie von Ihrem Volk fordern, durch Klicken auf die
entsprechenden Pfeile einstellen. Bei hohen Steuern bekommen Sie natürlich
mehr Geld als bei niedrigen. Allerdings kann Sie bei zu hohen Steuern ein Teil
des Volkes verlassen. Bei niedrigen Steuern hingegen können Sie sich einer
gewissen Zahl Einwanderer erfreuen. Um das ganze etwas interessanter zu machen,
schwanken allerdings die Zahl der Ein/Auswanderer sowie die Einnahmen auch
bei konstanten Steuern innerhalb einer gewissen Bandbreite. Außerdem,
seien Sie gewarnt: Bei gar zu hohen Steuern, nehmen Ihre Einnahmen wieder
ab. (Welches Volk hat schon Lust, Gewinne zu erwirtschaften, wenn es
sowieso wieder alles abgeben muss.)
Der zweite Teil der Anzeige stellt den Markt dar. Hier haben Sie die
Möglichkeit, gewisse Dinge zu kaufen oder auch Ihre Burg zu reparieren.
Sie führen eine Aktion aus, indem sie einfach auf die entsprechende
Bezeichnung klicken. Dies ist jedoch nur dann möglich, wenn der Eintrag
aktiv ist. Sollte er nicht anwählbar sein, so liegt es entweder an
mangelndem Geld oder an einem der nachfolgenden Gründe:
- Sie können nur eine Windfahne haben. Besitzen Sie also eine, so ist
der Eintrag nicht aktiv.
- Sie können nie mehr Kanonen haben, als zu Spielbeginn auf der Burg
waren. Sollten Sie im Laufe des Spieles Kanonenstandplätze durch
'Anbauen' zugemauert haben, so können auch dort keine Kanonen mehr
plaziert werden.
- Maximal kann ein Spieler fünf Fördertürme besitzen. Je nach
Burggröße kann diese Obergrenze auch niedriger liegen, denn
Fördertürme dürfen nicht über die Bildschirmmitte
hinaus gebaut werden.
Beim Kaufen von Kugeln oder Pulver sollten Sie beachten, dass Sie nur
soviel einkaufen können, wie in Ihre Kammern passt. Weiteres Anklicken der
entsprechenden Menüpunkte verringert zwar nach wie vor das Geld um den
angezeigten Preis, bringt aber keine neuen Kugeln oder Fässer! Ähnliches
gilt für die Schatzkammer: Ist sie gefüllt, so können Sie auch
mit den schönsten Einnahmen Ihr Vermögen nicht weiter steigern.
Der Kauf von Fördertürmen ist eine langfristige Investition. Pro Runde
und pro Turm nehmen Sie ungefähr zwischen 40 und 70 Geldeinheiten ein.
Nun noch zum Anbauen: Wählen Sie diesen Punkt an, so stehen Ihnen 20
Steine zur Verfügung ( die verbleibenen werden unten angezeigt ), die Sie
sofort alle anbauen müssen. Beachten Sie, dass Sie nicht 'irgendwo in der
Luft' anbauen können, sondern von den vorhanden Wänden ausgehen
müssen. Desweiteren brauchen Sie nicht auf den bösen Gedanken zu
kommen, bei der Burg des Gegners zum Beispiel die Geschütze zuzumauern
- das geht nämlich nicht, Sie können nur im Bereich Ihrer eigenen
Burg bauen.
Zu den Preisen ist nur zu sagen, dass Sie alle jeweils in einem bestimmten
Bereich schwanken und dass Sie teilweise unterschiedlich starken Sprüngen
unterworfen sind. (Mehr möchte ich eigentlich nicht verraten, denn so
können Sie noch immer wieder staunen, wie teuer doch Fördertürme
sein können...)
8. Schießen
Nach dem Anklicken einer Kanone haben Sie Winkel und Pulver einzustellen.
Mit den einfachen Pfeilen stellen Sie in Einerschritten, mit den doppelten
in Dreier- ( Pulver ) bzw. Zehnerschritten ( Winkel ) ein. Die Pulvermenge
liegt zwischen 5 und 20 Einheiten. ( Wenn Sie insgesamt weniger als 20
Pulvereinheiten haben, liegt die Obergrenze automatisch auch niedriger. )
Pulvermengen im Bereich von 5 werden Sie eigentlich nur selten gebrauchen,
nämlich nur dann, wenn Sie Ihre eigenen Fördertürme kaputt
schießen wollen?!
Winkel können Sie im Bereich von 0 bis 180 Grad einstellen. Winkel
über 90 (bei stärkerem Gegenwind auch schon über 80) und unter
10 Grad sind allerdings erfahrungsgemäß auch nur sehr bedingt
brauchbar.
Wenn Sie schließlich mit Ihren Einstellungen zufrieden sind (haben Sie
auch den Wind berücksichtigt?), können Sie mit 'OK' den Schuss
auslösen.
9. Treffen
Nachdem Sie in Abschnitt 8 lesen konnten, wie man schießt, möchte ich
Ihnen nun verraten, was man denn so alles treffen kann:
In der größten Zahl der Fälle wird die Kugel wohl nur den Berg
oder die Mauern der Burg treffen. In diesem Fall passiert nicht viel: Es entsteht
ein in der Tiefe der Aufprallgeschwindigkeit proportionales Loch. Sollten
Sie die Burg getroffen haben, so können außerdem ein paar Leute der
Bevölkerung sterben.
Interessanter wird es dagegen, wenn Sie eine Kanone treffen. Diese wird dann
nämlich mit einer Explosion verschwinden.
Gleiches gilt für die Windfahne. Treffen Sie die Kammern für Geld oder
Kugeln, so geht ein bestimmter Betrag verloren. Ein Treffer in der
Pulverkammer bewirkt, dass das gesamte Pulver explodiert. Wenn Sie den
König treffen, ist das besonders effektiv - Sie haben dann nämlich
gewonnen.
Die hohe Kunst des Schießens, Fördertürme zu zerstören, ist
eine schwierige Angelegenheit. Mitunter sind sie sowieso schon so hinter dem
Berg versteckt, dass sie nur mit steilen Schüssen und viel Pulver zu
erreichen sind. Nun kommt aber auch noch hinzu, dass man häufig eine ganze
Reihe von Schüssen braucht, um einen Turm zu zerstören. Hier ein
kleiner Tip: Schüsse, die den Turm seitlich treffen, sind eher von Erfolg
gekrönt.
10. Spieloptionen
Da sich bei gleichguten Spielern manchmal Patt-Situationen einstellten, in
denen keiner es schaffte, den anderen zu besiegen, kann es zu dem Problem
kommen, dass ein Spiel quasi endlos dauern konnte. Insbesondere durch viel Volk
und häufiges 'Anbauen' kann es passieren, dass man praktisch unbesiegbar
wird.
Für diesen Fall gibt es im Hauptmenü daher noch verschiedene Optionen, mit
welchen sich die Spieldauer begrenzen lässt:
- es besteht die Möglichkeit das 'Anbauen' zu verbieten.
- man kann eine maximale Rundenzahl festlegen oder auch unbegrenzt spielen.
Ist die maximale Rundenzahl erreicht, wird das Spiel automatisch beendet.
Sieger ist der, der sich in der besseren Situation befindet. Die
Beurteilung erfolgt nach dem Gesamtwert von Kanonen,
Fördertürmen, Geld, Pulver, Kugeln, Windfahne und Volk.
- Man kann wählen, ob der König in einer aussichtslosen Lage von
alleine kapituliert und damit das Spiel beendet.
11. Spielende
Wann ist das Spiel denn eigentlich zu Ende? Nun, ganz einfach: Der weit am
häufigsten auftretende Fall ist, dass ein König getroffen wird.
Es besteht jedoch auch die Möglichkeit, dass sich ein König von ganz
alleine ergibt. Dies ist jedoch nur dann der Fall, wenn man keine Kanonen
mehr besitzt, die finanziellen Mittel so bescheiden sind, dass man sich in
absehbarer Zeit keine Kanone leisten können wird und auch das Volk
aufgrund mangelnder Größe nicht die Hoffnung zulässt, durch
Steuern genug Einkünfte zu schaffen. Die dritte, letzte und seltenste
Möglichkeit für ein Spielende besteht darin, dass man kein Volk mehr
hat, denn dann gibt es ja auch nichts mehr zu regieren. Dieser Fall tritt aber
wirklich nur dann ein, wenn jemand sein Volk über längere Zeit mit
gewaltigen Steuern zum Auswandern veranlasst hat.
ballerburg-1.2.1/doc/authors.txt 0000664 0001750 0001750 00000001421 14244352606 016205 0 ustar thomas thomas
People who contributed to Ballerburg SDL:
- Thomas Huth : Main developer of Ballerburg SDL,
adapted the old Ballerburg sources to recent systems, maintains the
Ballerburg SDL project.
- Eero Tamminen : Finnish translations
- Jens Ropers : Most of the English translations
- Andrea Musuruane : Italian translations
- Guus Sliepen : Dutch translations
Ballerburg SDL uses source code from other projects which we would like to
acknowledge here:
- Eckhard Kruse : Wrote the original Ballerburg game for the Atari ST.
- Stefan Berndtsson : The original version of the PSG soundchip emulation.
- Kolja Koischwitz : Designed some additional castles (used in Ballerburg^2)
- Andreas Schiffler : SDL_gfxPrimitives (graphics primitives for SDL surfaces)
ballerburg-1.2.1/doc/CMakeLists.txt 0000664 0001750 0001750 00000000667 14244352606 016532 0 ustar thomas thomas
INSTALL(FILES de/anleitung.html en/manual.html DESTINATION ${DOCDIR})
add_custom_target(manpages ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ballerburg.6.gz)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ballerburg.6.gz
COMMAND gzip -c -9 ${CMAKE_CURRENT_SOURCE_DIR}/ballerburg.6 > ${CMAKE_CURRENT_BINARY_DIR}/ballerburg.6.gz
DEPENDS ballerburg.6)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/ballerburg.6.gz DESTINATION ${MANDIR})
ballerburg-1.2.1/doc/en/ 0000775 0001750 0001750 00000000000 14244352606 014363 5 ustar thomas thomas ballerburg-1.2.1/doc/en/manual.html 0000664 0001750 0001750 00000032540 14244352606 016532 0 ustar thomas thomas
Manual for Ballerburg SDL
Manual for Ballerburg SDL
1. Objective of the game
Ballerburg is about two lords of castles pitted against each other, with
the goal of defeating the opponent through targeted cannon shots.
Players are able to obtain money from mining after buying shaft towers and
from their people by levying taxes, and with these funds players may
purchase e.g. new cannons and ammunition.
2. Game modes
There are different playing modes available in the game's settings menu,
which can be brought up by pressing the Escape key. Ordinarily, the game is
played between two human players. Another option is for one player to fight
the computer. The computer can be set to be the player on the left or right
hand side of the screen. It is also possible to let two computer-
controlled players battle each other. Since it is possible to change
playing modes mid-game, one can for example momentarily let the computer
shoot for one's own side, or, if you're battling a computer-controlled
player and the situation's dire, you might for instance momentarily switch
modes to human vs. human and weaken the opponent by making bad decisions
for him.
3. Player names and computer-controlled player
In the settings menu you can change the name of the human player. The name
for the computer-controlled player can be changed under the label 'AI strategy'.
Both settings can also safely be changed while a game is already running.
The first player is always on the left side of the screen, and the second
player is on the right side.
The name of the computer-controlled player also stand for a certain strategy.
The numbers next to 'AI strength' control the shooting accuracy of the computer
players. The highest value 4 here means that almost every shot will hit its
goal.
The AI strategies differentiate into the priorities of the targets, i.e. some
computer players shoot always at the cannons (if available), while some others
rather try to hit the money of the opponent.
Oaf : |
No special target, just tries to hit the castle somewhere. |
Yokel : |
First the money, then gunpowder/cannonballs, then the king |
Boor : |
First the money, then cannons, then the king |
Doofus : |
Money, gunpowder, cannonballs, shaft towers, cannons, king:
Everything with the same probability |
Fumbler : |
First cannons, then the king |
Geezer : |
First the shaft towers, then cannons, then the king |
Ruffian : |
Aims only at the king |
Note that only Doofus, Fumbler, Geezer and Ruffian are able to buy shaft towers.
4. New game, choosing the castles
By clicking 'New game' in the settings menu, you can choose new castles for
both sides and then start the new game by clicking 'OK'.
Unless you've already extended the file with the castles, 'BALLER.DAT', you can
decide between 9 different standard castles here.
If both players are on the same skill level, you should of course select the
same castles here, because the different castles have quite different strengths.
If you choose smaller castles, the game normally won't last as long as with
the bigger castles.
Here are now the values of the 9 standard castles:
Cannons | Money | Gunpowder |
Cannonballs | People |
2 | 400 | 180 | 12 | 200 |
5 | 500 | 180 | 12 | 270 |
5 | 500 | 150 | 14 | 270 |
6 | 500 | 190 | 12 | 300 |
3 | 500 | 120 | 6 | 220 |
4 | 500 | 120 | 10 | 240 |
6 | 800 | 120 | 12 | 500 |
3 | 500 | 120 | 9 | 500 |
1 | 1000 | 120 | 12 | 300 |
5. The battlefield: The mountain and the castles
After you've started a new game, the castles and the mountain will be drawn on
the screen. Both, the position of the castles and the shape and height of the
mountain are random (within certain limits).
The castles consist of the following parts:
- the walls and the roofs
- the throne room
- the various cannons
- the powder magazine (one barrel contains 30 units of powder)
- the cannonball magazine
- the treasure chamber (one bag contains 150 units of money)
- the vane (only the vane of the active player is hoisted)
The active wind information indicates the active player. If the player still
has a vane, a zoomed version of the vane will be shown in the box at the
bottom of the screen together with the strength and direction of the wind.
6. Course of the game
After starting the game, the players take their turns until one of them wins.
Within a turn, the player can do several things: After clicking on either the
powder magazine, the cannonballs magazine or the treasure chamber, the
properties of the player will be displayed along with the market where the
player can buy various things (more on this topic can be found in the next
chapter). By clicking on the throne room, the king will comment on your latest
progress.
The round can be completed in two ways: In case you don't have a
cannon anymore, or you don't have enough powder or cannonballs or just don't
like to shoot, you can simply click on 'Done' at the bottom of the screen.
In all other cases you should choose the cannon that you want to shoot with,
select the angle and powder and then click 'OK' to fire a cannonball.
More on shooting can be found in chapter 8.
7. Your properties and the market
When clicking on one of the three magazines, you get the properties and market
dialog which is described here now:
In the section titled with 'You have' your properties and the amount of your
people are listed. By clicking on the corresponding arrows, you can also
adjust the taxes here that you demand from your people.
Higher taxes mean more money per subject. But beware, when you raise the taxes,
some of your people might leave your kingdom. On the other side, lowering the
taxes might render your kingdom more attractive again, so that a certain
amount of people might immigrate again.
But like in real life, there are no exact values for the amount of immigrants,
emmigrants and the amount of money you earn, they fluctuate within certain
ranges.
And be warned: If you raise the taxes too much, your income declines again
– which people are really interested in generating earnings if they
have to give everything away again?
The second part of the dialog is used for the market. Here you can buy certain
things and repair your castle. You can trigger one of the actions by clicking
on the price of the corresponding entry.
However, this is only possible if the entry is active. In case it is inactive,
you either do not have enough money or one of the following reasons occurred:
- You can have only one vane. If you already have one, the entry for a new
vane is disabled.
- You can not have more cannons than you had at the beginning of the game.
In case you built additional walls at the places that are used for the
cannons, you even can not fill these places with cannons anymore.
- You can own five shaft towers at maximum. Depending on the size of your
castle, this limit might even be smaller because you are only allowed
to built shaft towers on your side of the mountain – and a bigger
castle means a smaller mountain.
Please also note that you can not buy more cannonballs and gunpowder than you
can store in your magazines. If you try to buy more, you still have to pay
the money, but you can not store the bought goods!
The treasure chamber behaves in a similar way: If it is completely filled,
all additional earned money will be discarded.
Buying a shaft tower is long-term capital investment.
For each shaft tower, you earn approximately between 40 and 70 money units each
round.
Now a word about laying bricks: When you choose this menu entry, you get 20
bricks (the remeaining are shown at the bottom of the screen) which you have
to lay immediately. Please note that you can only extend the existing walls of
your castle, i.e. you can not lay the bricks somewhere up in the air.
Furthermore, don't even think of laying the bricks at your opponent's castle,
e.g. to block the other's cannons – of course this is forbidden, you
are only allowed to extend your own castle.
Please also note that the prices at the market vary each round.
Goods that are very cheap in one round might become expensive in the next one.
(I won't tell more about the price system here, so you can be surprised again
and again how expensive those shaft towers can be when you just thought that
you were ready to buy one...)
8. Shooting
After clicking on one of the cannons, you have to adjust the cannon angle and
the amount of gunpowder. By clicking on the single arrows, you adjust the
values with single steps, and by clicking on the double arrows you adjust the
powder by three units and the angle by 10 degrees.
Powder can be selected from 5 units up to 20 units (unless you have less than
20 powder units in your magazine, then the maximum limit will be adjusted
accordingly).
Using 5 powder units or something similar is hardly of any use – unless
you would like to destroy your own shaft towers!?!
The angle can be adjusted in the range of 0 up to 180 degrees. Angles above
90 degrees (or even 80 degrees if you've got very strong opposing wind) are also
only useful for self-destructive players.
When you are satisfied with your settings (did you take the wind into account,
too?), then you should press 'OK' to fire your cannonball.
9. Striking
In most cases the cannonballs only hit the mountain or the walls of the
opponent's castle. The effect is not too exciting; the cannonball creates
a crater with a size proportional to the impact velocity.
In case you hit the castle, there is also the chance that you killed some of
the opponent's people.
Striking a cannon is more exciting; the cannon is destroyed with a big
explosion. The same applies to the vane.
If you hit the cannonball magazine or the treasure chamber, a certain amount
of the content will be destroyed. In case you hit the powder magazine, the
whole stock of powder will explode. And if you hit the king, you can
congratulate yourself – in this case you've won the game!
The fine art of shooting is to destroy the shaft towers. This is a very
difficult task. First, they are located right behind the mountain anyway, so
that you need a big angle and a lot of powder to hit them. But additionally
you often have to hit them multiple times until they explode.
Here's a little hint: If you hit the towers from the side instead from the
top, chances are higher that they will be destroyed.
10. Game options
In case two players are playing at the same level, there can be a dead-lock
situation where neither player manages to hit the opponent's king.
Especially when both players have a lot of people, shaft towers and lay a lot
of bricks, it can happen that they get almost unbeatable and these games
last forever.
To avoid such neverending games, there are some options in the settings menu
which can be used to limit the duration of a party:
- You can prohibit the possibility to lay bricks.
- You can set a maximum number of rounds (or play without limit).
Once the maximum number of rounds has been reached, the party is stopped
automatically. The player who is in the better situation will win the game.
The decision is made according to the total value of available cannons,
shaft towers, money, powder, cannonballs, vane and people.
- You can choose whether the king is allowed to capitulate in hopeless
situations.
11. The end of the game
How can a game end? In the most likely case, one of the two kings gets hit
by a cannonball. There is also the possibility that one of the kings surrenders.
However, this is only the case if you do not have any cannons left, your
treasure room is almost empty and your amount of people is also very low –
so it is very unlikely that you can buy a new cannon in the near future.
Finally there is the possibility that you run out of people. But this case
only happens if you're imposing too high taxes for several rounds, so that all
your people emigrate.
ballerburg-1.2.1/doc/ballerburg.6 0000664 0001750 0001750 00000003517 14244352606 016177 0 ustar thomas thomas .\" Hey, EMACS: -*- nroff -*-
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH "BALLERBURG" "6" "2015-03-29" "Ballerburg SDL" ""
.\" Please adjust this date whenever revising the manpage.
.SH "NAME"
ballerburg \- A castle combat game
.SH "SYNOPSIS"
.B ballerburg
.SH "DESCRIPTION"
Ballerburg is a castle combat game. Two players (which can be human or
computer-controlled) try to destroy the opponent's castle with their cannons.
.PP
There are two ways to win the game: Either by directly hitting the opponents
king with a cannonball, or by destroying enough of the opponents commodities
so that the king capitulates automatically.
.SH "COMMANDS"
Beside the intuitive control of the game with the mouse cursor, there are
a couple of shortcut keys, too:
.TP
.B ESC
show the settings dialog
.TP
.B f
toggle fullscreen mode
.TP
.B t
show high-score table
.TP
.B q
quit Ballerburg
.SH COPYRIGHT
Copyright (C) 1987, 1989 Eckhard Kruse
.br
Copyright (C) 2010, 2015 Thomas Huth
.PP
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.PP
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.PP
You should have received a copy of the GNU General Public License
along with this program. If not, see .
.SH "SEE ALSO"
The main program documentation, usually in /usr/share/doc/ballerburg.
.PP
The homepage of Ballerburg SDL: http://baller.tuxfamily.org/
ballerburg-1.2.1/COPYING.txt 0000664 0001750 0001750 00000104513 14244352606 015071 0 ustar thomas thomas GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Copyright (C)
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
ballerburg-1.2.1/src/ 0000775 0001750 0001750 00000000000 14244352606 014003 5 ustar thomas thomas ballerburg-1.2.1/src/screen.c 0000664 0001750 0001750 00000026773 14244352606 015445 0 ustar thomas thomas /*
screen.c - Screen functions for Ballerburg
Copyright (C) 2010, 2014 Thomas Huth
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
#include
#include
#include
#include
#include
#include "i18n.h"
#include "screen.h"
#include "sdlgui.h"
#include "sdlgfx.h"
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#if WITH_SDL2
static SDL_Window *sdlWindow;
#define USE_SDL2_RENDERER 0
#if USE_SDL2_RENDERER
static SDL_Renderer *sdlRenderer;
static SDL_Texture *sdlTexture;
static bool bIsSoftwareRenderer = false;
#else
static SDL_Surface *windowSurf;
#endif
#endif
SDL_Surface *surf;
static Uint32 the_color, fill_color;
static Uint32 bg_color;
static int fill_style, fill_interior;
static SGOBJ donebuttondlg[] =
{
{ SGBOX, 0, 0, 36,29, 8,1, NULL },
{ SGBUTTON, SG_EXIT, 0, 0,0, 8,1, N_("Done") }
};
#if WITH_SDL2
static int fullscreenflag = 0;
static void scr_sdl2_init(void)
{
#if USE_SDL2_RENDERER
SDL_RendererInfo sRenderInfo = { 0 };
#endif
sdlWindow = SDL_CreateWindow("Ballerburg SDL",
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
640, 480, fullscreenflag);
#if USE_SDL2_RENDERER
sdlRenderer = SDL_CreateRenderer(sdlWindow, -1, 0);
if (!sdlWindow || !sdlRenderer)
{
fprintf(stderr,"Failed to create window or renderer!\n");
exit(-1);
}
SDL_RenderSetLogicalSize(sdlRenderer, 640, 480);
sdlTexture = SDL_CreateTexture(sdlRenderer, SDL_PIXELFORMAT_RGB888,
SDL_TEXTUREACCESS_STREAMING, 640, 480);
SDL_GetRendererInfo(sdlRenderer, &sRenderInfo);
bIsSoftwareRenderer = sRenderInfo.flags & SDL_RENDERER_SOFTWARE;
#else
windowSurf = SDL_GetWindowSurface(sdlWindow);
#endif
}
#endif
void scr_init(void)
{
if (SDL_Init(SDL_INIT_VIDEO) < 0)
{
fprintf(stderr, "Could not initialize the SDL library:\n %s\n",
SDL_GetError() );
exit(-1);
}
#if WITH_SDL2
scr_sdl2_init();
surf = SDL_CreateRGBSurface(SDL_SWSURFACE, 640, 480, 32, 0x00FF0000,
0x0000FF00, 0x000000FF, 0);
#else
surf = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE);
SDL_WM_SetCaption("Ballerburg SDL", "Ballerburg");
#endif
if (!surf)
{
fprintf(stderr, "Could not initialize the SDL library:\n %s\n",
SDL_GetError() );
exit(-1);
}
bg_color = SDL_MapRGB(surf->format,0xe0,0xf0,0xff);
SDLGui_Init();
SDLGui_SetScreen(surf);
}
void scr_exit(void)
{
SDLGui_UnInit();
#if WITH_SDL2
if (surf)
SDL_FreeSurface(surf);
#if USE_SDL2_RENDERER
if (sdlTexture)
SDL_DestroyTexture(sdlTexture);
if (sdlRenderer)
SDL_DestroyRenderer(sdlRenderer);
#endif
if (sdlWindow)
SDL_DestroyWindow(sdlWindow);
#endif
SDL_Quit();
}
void scr_togglefullscreen(void)
{
#if WITH_SDL2
#if USE_SDL2_RENDERER
SDL_DestroyTexture(sdlTexture);
SDL_DestroyRenderer(sdlRenderer);
fullscreenflag ^= SDL_WINDOW_FULLSCREEN_DESKTOP;
#else
fullscreenflag ^= SDL_WINDOW_FULLSCREEN;
#endif
SDL_DestroyWindow(sdlWindow);
scr_sdl2_init();
scr_update(0, 0, 640, 480);
#else
SDL_WM_ToggleFullScreen(surf);
#endif
}
void scr_clear(void)
{
SDL_Rect rect;
Uint32 white;
int i;
white = SDL_MapRGB(surf->format,0xff,0xff,0xff);
rect.x = 0;
rect.y = 0;
rect.w = 640;
rect.h = 400;
SDL_FillRect(surf, &rect, bg_color);
for (i = 0; i < 80; i += 1)
{
rect.x = 0;
rect.y = 479-i;
rect.w = 640;
rect.h = 1;
SDL_FillRect(surf, &rect, SDL_MapRGB(surf->format,8+i/2,32+i,8+i/2));
}
/* Left vane box: */
rect.x = 5; rect.y = 410;
rect.w = 104; rect.h = 48+16;
for (i = 1; i < 5; i++)
{
rectangleRGBA(surf, rect.x-i, rect.y-i,
rect.x+rect.w-1+i, rect.y+rect.h-1+i,
0xf0, 0xff, 0xf0, 0xff-i*0x3c);
}
SDL_FillRect(surf, &rect, white);
/* Right vane box: */
rect.x = 5+(629-104); rect.y = 410;
rect.w = 104; rect.h = 48+16;
for (i = 1; i < 5; i++)
{
rectangleRGBA(surf, rect.x-i, rect.y-i,
rect.x+rect.w-1+i, rect.y+rect.h-1+i,
0xf0, 0xff, 0xf0, 0xff-i*0x3c);
}
SDL_FillRect(surf, &rect, white);
}
void scr_l_text(int x, int y, const char *text)
{
SDL_Rect rect;
// printf("v_gtext: %s\n", text);
y -= 12;
rect.x = x;
rect.y = y;
rect.w = strlen(text) * sdlgui_fontwidth;
rect.h = sdlgui_fontheight;
SDL_FillRect(surf, &rect, SDL_MapRGB(surf->format,0xff,0xff,0xff));
SDLGui_Text(x, y, text);
scr_update_rects(surf, 1, &rect);
}
/**
* Draw centered text
*/
void scr_ctr_text(int cx, int y, const char *text)
{
SDL_Rect rect;
rect.w = strlen(text) * sdlgui_fontwidth;
rect.h = sdlgui_fontheight;
rect.x = cx - rect.w / 2;
rect.y = y;
SDL_FillRect(surf, &rect, SDL_MapRGB(surf->format,0xff,0xff,0xff));
SDLGui_Text(rect.x, rect.y, text);
scr_update_rects(surf, 1, &rect);
}
void scr_circle(int x, int y, int w)
{
SDL_Rect rect;
filledCircleColor(surf, x, y, w, the_color);
rect.x = max(x-w, 0);
rect.y = max(y-w, 0);
rect.w = min(2*w, 640-x+w);
rect.h = min(2*w, 480-y+w);
scr_update_rects(surf, 1, &rect);
}
static void update_fill_color(void)
{
if (fill_interior == 0)
{
fill_color = 0xffffffff;
}
else if (fill_interior == 1)
{
fill_color = 0x000000ff;
}
else if (fill_interior == 2)
{
switch (fill_style)
{
case 1: fill_color = 0xc0b0a0ff; break; // Table color
case 2: fill_color = 0x602060ff; break; // King color
case 9: fill_color = 0x909080ff; break; // Wall color
case 11: fill_color = 0xc04020ff; break; // Roof color
}
}
else
{
puts("unknown fill interior");
}
}
void scr_sf_style(short val)
{
fill_style = val;
update_fill_color();
}
void scr_sf_interior(short val)
{
fill_interior = val;
update_fill_color();
}
void scr_bar(short *xy)
{
SDL_Rect rect;
Uint8 r, g, b;
r = fill_color >> 24;
g = fill_color >> 16;
b = fill_color >> 8;
rect.x = xy[0];
rect.y = xy[1];
rect.w = xy[2]-xy[0]+1;
rect.h = xy[3]-xy[1]+1;
SDL_FillRect(surf, &rect, SDL_MapRGB(surf->format,r,g,b));
rectangleColor(surf, xy[0], xy[1], xy[2], xy[3], the_color);
scr_update_rects(surf, 1, &rect);
}
void clr(short x, short y, short w, short h)
{
SDL_Rect rect;
rect.x = x;
rect.y = y;
rect.w = w;
rect.h = h;
SDL_FillRect(surf, &rect, SDL_MapRGB(surf->format,0xff,0xff,0xff));
scr_update(x,y, w,h);
}
void clr_bg(short x, short y, short w, short h)
{
SDL_Rect rect;
rect.x = x;
rect.y = y;
rect.w = w;
rect.h = h;
SDL_FillRect(surf, &rect, bg_color);
scr_update(x,y, w,h);
}
void scr_fillarea(short num, short *xy)
{
int i;
Sint16 vx[512], vy[512];
if (num > 512) {
puts("scr_fillarea overflow");
exit(-2);
}
for (i = 0; i < num; i++) {
vx[i] = xy[i*2];
vy[i] = xy[i*2+1];
}
filledPolygonColor(surf, vx, vy, num, fill_color);
scr_update(0,0, 640,480);
}
void scr_pline(short num, short *xy)
{
int i;
int maxx, maxy;
int minx, miny;
minx = 639; miny = 399;
maxx = 0; maxy = 0;
// printf("v_pline %i\n", num);
for (i = 0; i < num-1; i++)
{
if (xy[i*2] < 0 || xy[i*2] > 639
|| xy[i*2+1] < 0 || xy[i*2+1] > 479) {
printf("bad coordinates!\n");
return;
}
if (xy[i*2] > maxx) maxx = xy[i*2];
if (xy[i*2+1] > maxy) maxy = xy[i*2+1];
if (xy[i*2] < minx) minx = xy[i*2];
if (xy[i*2+1] < miny) miny = xy[i*2+1];
lineColor(surf, xy[i*2], xy[i*2+1], xy[i*2+2], xy[i*2+3], the_color|0x1000);
}
if (xy[i*2] > maxx) maxx = xy[i*2];
if (xy[i*2+1] > maxy) maxy = xy[i*2+1];
if (xy[i*2] < minx) minx = xy[i*2];
if (xy[i*2+1] < miny) miny = xy[i*2+1];
//printf("blit %i %i %i %i\n", minx,miny, maxx-minx+1,maxy-miny+1);
scr_update(minx,miny, maxx-minx+1,maxy-miny+1);
}
void scr_line(int x1, int y1, int x2, int y2, int rgb)
{
lineColor(surf, x1, y1, x2, y2, (rgb<<8)|0xff);
}
int scr_getpixel(int x, int y)
{
Uint32 *p = surf->pixels;
Uint32 c;
SDL_PixelFormat *fmt = surf->format;
c = p[y*640+x];
c = ((((c & fmt->Rmask) >> fmt->Rshift) << fmt->Rloss) << 16)
| ((((c & fmt->Gmask) >> fmt->Gshift) << fmt->Gloss) << 8)
| (((c & fmt->Bmask) >> fmt->Bshift) << fmt->Bloss);
return c;
}
void scr_color(int c)
{
the_color = (c << 8) | 0xff;
}
void scr_fillcolor(int c)
{
fill_color = (c << 8) | 0xff;
}
/**
* Select foreground (1) or background (0) color
*/
void color(int c)
{
if (c)
the_color = 0x000000ff;
else
the_color = (bg_color<<8) | 0x0ff;
}
void scr_init_done_button(int *bx, int *by, int *bw, int *bh)
{
int fontw, fonth;
/* Calculate the "Done" button coordinates */
SDLGui_GetFontSize(&fontw, &fonth);
*bx = donebuttondlg[0].x * fontw;
*by = donebuttondlg[0].y * fonth;
*bw = donebuttondlg[0].w * fontw;
*bh = donebuttondlg[0].h * fonth;
}
void scr_draw_done_button(int selected)
{
if (selected)
donebuttondlg[1].state |= SG_SELECTED;
else
donebuttondlg[1].state &= ~SG_SELECTED;
SDLGui_DrawButton(donebuttondlg, 1);
scr_update(0,0, 0,0);
}
/**
* Draws a fast cannonball
*/
void scr_cannonball(int x, int y)
{
lineColor(surf, x-1,y-2, x+1,y-2, the_color);
lineColor(surf, x-2,y-1, x+2,y-1, the_color);
lineColor(surf, x-2,y , x+2,y , the_color);
lineColor(surf, x-2,y+1, x+2,y+1, the_color);
lineColor(surf, x-1,y+2, x+1,y+2, the_color);
}
/**
* Stores information about saved background area
*/
struct savebg
{
SDL_Rect rect;
SDL_Rect bgrect;
SDL_Surface *bgsurf;
};
/**
* Save a part of the background of the screen
*/
void *scr_save_bg(int x, int y, int w, int h)
{
struct savebg *s;
s = malloc(sizeof(struct savebg));
if (!s)
return NULL;
s->rect.x = x; s->rect.y = y;
s->rect.w = w; s->rect.h = h;
s->bgrect.x = s->bgrect.y = 0;
s->bgrect.w = s->rect.w;
s->bgrect.h = s->rect.h;
s->bgsurf = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, surf->format->BitsPerPixel,
surf->format->Rmask, surf->format->Gmask,
surf->format->Bmask, surf->format->Amask);
if (s->bgsurf != NULL)
{
/* Save background */
SDL_BlitSurface(surf, &s->rect, s->bgsurf, &s->bgrect);
}
else
{
fprintf(stderr, "scr_save_bg: CreateRGBSurface failed: %s\n",
SDL_GetError());
}
return s;
}
/**
* Restore part of the background
*/
void scr_restore_bg(void *ps)
{
struct savebg *s = ps;
/* Restore background */
if (s != NULL && s->bgsurf != NULL)
{
SDL_BlitSurface(s->bgsurf, &s->bgrect, surf, &s->rect);
SDL_FreeSurface(s->bgsurf);
}
scr_update_rects(surf, 1, &s->rect);
free(ps);
}
void scr_update_rects(SDL_Surface *screen, int numrects, SDL_Rect *rects)
{
#if WITH_SDL2
# if USE_SDL2_RENDERER
SDL_UpdateTexture(sdlTexture, NULL, screen->pixels, screen->pitch);
if (!bIsSoftwareRenderer)
SDL_RenderClear(sdlRenderer);
SDL_RenderCopy(sdlRenderer, sdlTexture, NULL, NULL);
SDL_RenderPresent(sdlRenderer);
# else
SDL_BlitSurface(surf, rects, windowSurf, rects);
SDL_UpdateWindowSurfaceRects(sdlWindow, rects, numrects);
# endif
#else
SDL_UpdateRects(screen, numrects, rects);
#endif
}
void scr_update(int x, int y, int w, int h)
{
SDL_Rect rect;
if (x >= 640 || y >= 480)
return;
if (x < 0)
x = 0;
if (y < 0)
y = 0;
if (w == 0 && h == 0) {
w = 640;
h = 480;
}
if (x + w > 640)
w = 640 - x;
if (y + h > 480)
h = 480 - y;
rect.x = x; rect.y = y;
rect.w = w; rect.h = h;
scr_update_rects(surf, 1, &rect);
}
ballerburg-1.2.1/src/dlgAlert.c 0000664 0001750 0001750 00000013223 14244352606 015706 0 ustar thomas thomas /*
* dlgAlert.c - AES-like AlertBox
*
* Copyright (c) 2004 Petr Stehlik
* Copyright (c) 2004, 2010 Thomas Huth
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This file is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* (http://www.gnu.org/licenses/) for more details.
*/
const char DlgAlert_fileid[] = "dlgAlert.c : " __DATE__ " " __TIME__;
#include
#include
#include
#include "sdlgui.h"
#include "screen.h"
#define MAX_LINES 4
static char dlglines[MAX_LINES][50+1];
#define DLGALERT_OK 5
#define DLGALERT_CANCEL 6
/* The "Alert"-dialog: */
static SGOBJ alertdlg[] =
{
{ SGBOX, 0, 0, 0,0, 52,8, NULL },
{ SGTEXT, 0, 0, 1,1, 50,1, dlglines[0] },
{ SGTEXT, 0, 0, 1,2, 50,1, dlglines[1] },
{ SGTEXT, 0, 0, 1,3, 50,1, dlglines[2] },
{ SGTEXT, 0, 0, 1,4, 50,1, dlglines[3] },
{ SGBUTTON, SG_DEFAULT, 0, 5,6, 8,1, "OK" },
{ SGBUTTON, SG_CANCEL, 0, 24,6, 8,1, "Cancel" },
{ -1, 0, 0, 0,0, 0,0, NULL }
};
/*-----------------------------------------------------------------------*/
/**
* Breaks long string to several strings of max_width, divided by '\0',
* sets text_width to the longest line width and returns the number of lines
* you need to display the strings.
*/
static int DlgAlert_FormatTextToBox(char *text, int max_width, int *text_width)
{
int columns = 0;
int lines = 1;
int txtlen;
char *p; /* pointer to begin of actual line */
char *q; /* pointer to start of next search */
char *llb; /* pointer to last place suitable for breaking the line */
char *txtend; /* pointer to end of the text */
txtlen = strlen(text);
q = p = text;
llb = text-1; /* pointer to last line break */
txtend = text + txtlen;
if (txtlen <= max_width && strchr(text, '\n') == NULL)
{
*text_width = txtlen;
return lines;
}
while(q < txtend) /* q was last place suitable for breaking */
{
char *r = strpbrk(q, " \t/\\\n"); /* find next suitable place for the break */
if (r == NULL)
r = txtend; /* if there's no place then point to the end */
if ((r-p) <= max_width && *r != '\n') /* '\n' is always used for breaking */
{
llb = r; /* remember new place suitable for breaking */
q++;
if ((r-p) > columns)
columns = r - p;
continue; /* search again */
}
if ((r-p) > max_width) /* too long line already? */
{
if (p > llb) /* bad luck - no place for the delimiter. Let's do it the strong way */
llb = p + max_width; /* we loose one character */
}
else
llb = r; /* break from previous delimiter */
*llb = '\0'; /* BREAK */
if ((llb-p) > columns)
columns = llb - p; /* longest line so far */
p = q = llb + 1; /* next line begins here */
lines++; /* increment line counter */
}
*text_width = columns;
return lines; /* return line counter */
}
/*-----------------------------------------------------------------------*/
/**
* Show the "alert" dialog. Return true if user pressed "OK".
*/
static int DlgAlert_ShowDlg(const char *text)
{
static int maxlen = sizeof(dlglines[0])-1;
char *t = (char *)malloc(strlen(text)+1);
char *orig_t = t;
int lines, i, len, offset;
bool bOldMouseVisibility;
int nOldMouseX, nOldMouseY;
strcpy(t, text);
lines = DlgAlert_FormatTextToBox(t, maxlen, &len);
offset = (maxlen-len)/2;
for(i=0; i